Array node

Array Sum

Sum all elements in a numeric array. Non-numeric elements are skipped. Outputs the total sum and the number of elements that were successfully summed.

Inputs

PortType
ArrayThe list of numbers to add up. Cable any array stream here; non-numeric entries are ignored, and an empty list sums to 0.any

Outputs

PortType
Valuefloat
Countint

How It Works

Array Sum iterates through every element in the array, converts each to a float, and accumulates the total. Elements that cannot be converted to a number (strings, bools, nested arrays) are silently skipped.

Count reports the total number of elements in the array, not just the numeric ones.

Use Cases

  • Signal energy: Sum the squared magnitudes of an FFT output to compute total signal power.
  • Score totals: Add up individual scores, measurements, or counters collected in an array.
  • Weighted averages: Use Array Map to multiply elements by weights, then Array Sum the result.
  • Batch validation: Sum a boolean array (true=1, false=0) to count how many conditions are met.

Tips

  • For the arithmetic mean, use Array Average instead (it divides by count automatically).
  • For a running cumulative sum (each element = sum of all previous), use Array Accumulate.
  • Non-numeric elements are skipped without error — the node is safe to use on mixed-type arrays.

Open Array Sum in the interactive catalog →

Array Sum is one of 381 nodes in Grafit Pro.

Free download. Every feature for 7 days, no card. Then €99.99 once — or keep playing your projects as a Player.

More Array nodes