sum#
Fully qualified name: isaacsim::common::array::sum
-
Array isaacsim::common::array::sum(const Array &a)#
Sums all array elements.
The whole array is reduced, regardless of its rank, to a 0-D Array on the operand’s device, so a CUDA result stays on the device; read it with
item<T>(). The sum accumulates in a wider dtype than the operand so that narrow integers do not overflow: boolean and signed integer operands accumulate inint64, unsigned integer operands inuint64, and floating-point operands keep their own dtype. An empty array sums to 0.Note
The summation order is unspecified and differs between devices: the CPU accumulates sequentially while the CUDA path folds partial sums in a tree. Integer results are identical either way, but a floating-point sum may differ in its last bits between the two, and neither reproduces NumPy’s pairwise summation exactly.
- Parameters:
a – [in] Operand.
- Returns:
A new 0-D Array holding the sum.