tuple_cumultuple_cumulTupleCumulTupleCumultuple_cumul (Operator)
Name
tuple_cumultuple_cumulTupleCumulTupleCumultuple_cumul
— Calculate the cumulative sums of a tuple.
Signature
Herror tuple_cumul(const Hlong Tuple, double* Cumul)
Herror T_tuple_cumul(const Htuple Tuple, Htuple* Cumul)
def tuple_cumul(tuple: MaybeSequence[Union[float, int]]) -> Sequence[Union[float, int]]
def tuple_cumul_s(tuple: MaybeSequence[Union[float, int]]) -> Union[float, int]
Description
tuple_cumultuple_cumulTupleCumulTupleCumultuple_cumul
returns the different cumulative sums of the
corresponding elements of the input tuple TupleTupleTupletupletuple
, i.e. the i-th
element of the result tuple CumulCumulCumulcumulcumul
is the sum of the first i
elements of the input tuple TupleTupleTupletupletuple
. For example, if
TupleTupleTupletupletuple
contains the values [1,2,3,4], the output tuple
CumulCumulCumulcumulcumul
will contain the values [1,3,6,10].
All elements of TupleTupleTupletupletuple
must be numbers (integer or floating point numbers). Each element
of the result tuple CumulCumulCumulcumulcumul
will contain a floating point number if
at least one element of the calculation is a floating point number.
If all elements of the calculation are integer numbers the resulting
sum in CumulCumulCumulcumulcumul
will also be an integer number.
Exception: Empty input tuple
If the input tuple is empty, the operator returns an empty tuple.
HDevelop In-line Operation
HDevelop provides an in-line operation for tuple_cumultuple_cumulTupleCumulTupleCumultuple_cumul
,
which can be used in an expression in the following syntax:
Cumul := cumul(Tuple)
Execution Information
- Multithreading type: independent (runs in parallel even with exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Parameters
TupleTupleTupletupletuple
(input_control) number(-array) →
HTupleMaybeSequence[Union[float, int]]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)
Input tuple.
CumulCumulCumulcumulcumul
(output_control) number(-array) →
HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Cumulative sum of the corresponding tuple elements.
Alternatives
tuple_sumtuple_sumTupleSumTupleSumtuple_sum
See also
tuple_min2tuple_min2TupleMin2TupleMin2tuple_min2
,
tuple_max2tuple_max2TupleMax2TupleMax2tuple_max2
,
tuple_addtuple_addTupleAddTupleAddtuple_add
Module
Foundation