Sum of elements along dimension dim. If dim is omitted, it defaults to the first non-singleton dimension.
If the optional argument 'native' is given, then the sum is performed in the same type as the original argument, rather than in the default double type. For example:
sum ([true, true]) ⇒ 2 sum ([true, true], 'native') ⇒ trueOn the contrary, if 'double' is given, the sum is performed in double precision even for single precision inputs.
For double precision inputs, 'extra' indicates that a more accurate algorithm than straightforward summation is to be used. For single precision inputs, 'extra' is the same as 'double'. Otherwise, 'extra' has no effect.
Product of elements along dimension dim. If dim is omitted, it defaults to the first non-singleton dimension.
Cumulative sum of elements along dimension dim. If dim is omitted, it defaults to the first non-singleton dimension.
See
sum
for an explanation of the optional parameters 'native', 'double', and 'extra'.
Cumulative product of elements along dimension dim. If dim is omitted, it defaults to the first non-singleton dimension.
Sum of squares of elements along dimension dim. If dim is omitted, it defaults to the first non-singleton dimension.
This function is conceptually equivalent to computing
sum (x .* conj (x), dim)but it uses less memory and avoids calling
conj
if x is real.See also: sum.