roofline.devPublic Beta

Sum Reduction

0VERY EASYPracticeReport issue

Compute the sum ss of all elements in the vector aa of length nn.

s=inais = \sum_{i}^{n} \underline{a}_i

Input

  • a - input vector of length n.
  • n - the number of elements in a.

Output

  • s - the sum of all elements 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