roofline.devPublic Beta

Sum Over Dimension

0EASYPracticeReport issue

Given matrix AA of shape m×nm \times n, produce vector r\underline{r} of length mm such that

ri=jnAijr_i = \sum_{j}^{n} A_{ij}

Input

  • A - input matrix of shape [m][n] stored in row-major order.
  • m - the number of rows in A.
  • n - the number of columns in A.

Output

  • r - output vector of length m containing the row-wise sums of A.
Open on a desktop browser to write and submit code.

Public submissions

Practice problem · every submission below is public, click to view code

No public submissions yet — be the first to submit.