Matrix.CumSum Method

Overload List

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

Overload 1: TMtx CumSum

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
Matrix Mtx;
Mtx.Size(false,3,2,[1,2,
2,5,
3,1]);
Mtx.CumSum;
// Mtx becomes:
// 1, 2
// 3, 7
// 6, 8
See Also: Matrix.SumCols

Indexed: TMtxVec CumSum(Int32 Index, Int32 Len)

Cumulative sum.

#NameTypeDescription
1IndexInt32start index
2LenInt32element 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 Dew.Math.Matrix.ConditionCheck is true and array borders are overrun.

Examples
Matrix a;
a.SetIt(2,2,false,new double[] {1,2,3,4};
a.CumSum(0,4); // a = new double[] {1,3,6,10}
See Also: Matrix.Sum

Overload 2: TMtx CumSum(TMtx Mtx)

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

#NameTypeDescription
1MtxTMtxsource TMtx

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

Remarks:

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

Overload 3: TMtxVec CumSum(TMtxVec Vec, Int32 VecIndex, Int32 Index, Int32 Len)

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

#NameTypeDescription
1VecTMtxVecsource TVec or TMtx
2VecIndexInt32
3IndexInt32start index
4LenInt32element 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 Dew.Math.Matrix.Complex properties of the calling object must be set explicitly. Exception is raised if Dew.Math.Matrix.ConditionCheck property is True and array borders are overrun.