Matrix.CumSum Method

Overload List

#SignatureDescription
1function CumSum: TMtx;Cumulative sum for each of the matrix columns.
└ indexed: function CumSum(Index: Integer; Len: Integer): TMtxVec;
2function CumSum(const Mtx: TMtx): TMtx;Calculate tehe cumulative sum for each of the X matrix columns.
3function CumSum(const Vec: TMtxVec; VecIndex: Integer; Index: Integer; Len: Integer): TMtxVec;Calculate the cumulative sum for Vec elements [VecIndex]..[VecIndex+Len-1].

Overload 1: function CumSum: TMtx;

Cumulative sum for each of the matrix columns.

Result: stored in self (calling object), returns self for chaining

Remarks:

Calculate the cumulative sum for each of the calling matrix columns in-place.

Examples
var Mtx: Matrix;
begin
    Mtx.Size(false,3,2,[1,2,
        2,5,
        3,1]);
    Mtx.CumSum;
    // Mtx becomes:
    // 1, 2
    // 3, 7
    // 6, 8
end;
See Also: Matrix.SumCols

Indexed: function CumSum(Index: Integer; Len: Integer): TMtxVec;

Cumulative sum.

#NameTypeDescription
1IndexIntegerstart index
2LenIntegerelement count

Result: stored in self (calling object), returns self for chaining

Remarks:

Calculate the cumulative sum for calling object elements [Index]..[Index+Len-1] in-place. An exception is raised if Matrix.ConditionCheck is true and array borders are overrun.

Examples
var a: Matrix;
begin
    a.SetIt(2,2,false,[1,2,3,4];
    a.CumSum(0,4); // a = [1,3,6,10]
end;
See Also: Matrix.Sum

Overload 2: function CumSum(const Mtx: TMtx): TMtx;

Calculate tehe cumulative sum for each of the X matrix columns.

#NameTypeDescription
1MtxTMtx

Result: stored in self (calling object), returns self for chaining

Remarks:

Store the results in calling matrix. The Matrix.Rows, Matrix.Cols and Matrix.Complex properties of the callig matrix are adjusted implicitly to match those of Mtx matrix.

Overload 3: function CumSum(const Vec: TMtxVec; VecIndex: Integer; Index: Integer; Len: Integer): TMtxVec;

Calculate the cumulative sum for Vec elements [VecIndex]..[VecIndex+Len-1].

#NameTypeDescription
1VecTMtxVec
2VecIndexInteger
3IndexIntegerstart index
4LenIntegerelement count

Result: stored in self (calling object), returns self for chaining

Remarks:

Store the results in calling object elements [Index]..[Index+Len-1]. Size and Matrix.Complex properties of the calling object must be set explicitly. Exception is raised if Matrix.ConditionCheck property is True and array borders are overrun.