Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TMtxInt CumSum | Cumulative sum for each of the matrix columns. |
| └ indexed: TMtxVecInt CumSum(Int32 Index, Int32 Len) | ||
| 2 | TMtxInt CumSum(TMtxInt Mtx) | Calculate the cumulative sum for each of the X matrix columns. |
| 3 | TMtxVecInt CumSum(TMtxVecInt Vec, Int32 VecIndex, Int32 Index, Int32 Len) | Calculate the cumulative sum for Vec elements [VecIndex]..[VecIndex+Len-1]. |
Overload 1: TMtxInt CumSum
Cumulative sum for each of the matrix columns.
Result: stored in self (calling object), returns self for chaining
Calculate the cumulative sum for each of the calling matrix columns in-place. Function performs no overflow checking. It is users responsibility to ensure that the sum does not overflow the range of the used integer storage type.
TMtx Mtx;
Mtx = TMtx.Create;
try
{
Mtx.Size(3,2,false,[1,2,
2,5,
3,1]);
Mtx.CumSum;
// Mtx becomes:
// 1, 2
// 3, 7
// 6, 8
}
finally
{
Mtx.Free;
}
Indexed: TMtxVecInt CumSum(Int32 Index, Int32 Len)
Cumulative sum.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Index | Int32 | start index |
| 2 | Len | Int32 | element count |
Result: stored in self (calling object), returns self for chaining
Calculate the cumulative sum for calling object elements [Index]..[Index+Len-1] in-place. An exception is raised if Dew.Math.TMtxVecBase.ConditionCheck is true and array borders are overrun.
Matrix a;
a.SetIt(2,2,false,new double[] {1,2,3,4};
a.CumSum(0,4); // a = new double[] {1,3,6,10}
Overload 2: TMtxInt CumSum(TMtxInt Mtx)
Calculate the cumulative sum for each of the X matrix columns.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Mtx | TMtxInt | source TMtxInt |
Result: stored in self (calling object), returns self for chaining
Store the results in calling matrix. The Dew.Math.TMtxInt.Rows, Dew.Math.TMtxInt.Cols and Dew.Math.TMtxVecInt.IntPrecision properties of the callig matrix are adjusted implicitly to match those of Mtx matrix.
Overload 3: TMtxVecInt CumSum(TMtxVecInt Vec, Int32 VecIndex, Int32 Index, Int32 Len)
Calculate the cumulative sum for Vec elements [VecIndex]..[VecIndex+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVecInt | source TVecInt or TMtxInt |
| 2 | VecIndex | Int32 | |
| 3 | Index | Int32 | start index |
| 4 | Len | Int32 | element count |
Result: stored in self (calling object), returns self for chaining
Store the results in calling object elements [Index]..[Index+Len-1]. Size and Dew.Math.TMtxVecInt.IntPrecision properties of the calling object must be set explicitly. Exception is raised if Dew.Math.TMtxVecBase.ConditionCheck property is True and array borders are overrun.