Overload List
| # | Signature | Description |
|---|---|---|
| 1 | function CumSum: TVecInt; | Cumulative sum. |
| └ indexed: function CumSum(Index: Integer; Len: Integer): TMtxVecInt; | ||
| 2 | function CumSum(const Vec: TVecInt): TVecInt; | Calculate the cumulative sum for all Vec elements. |
| 3 | function CumSum(const Vec: TMtxVecInt; VecIndex: Integer; Index: Integer; Len: Integer): TMtxVecInt; | Calculate the cumulative sum for Vec elements [VecIndex]..[VecIndex+Len-1]. |
Overload 1: function CumSum: TVecInt;
Cumulative sum.
Result: stored in self (calling object), returns self for chaining
Calculate the cumulative sum for all calling object elements in-place.
var a: TVecIn;
begin
CreateIt(a);
try
a.SetIt([1,2,3,4]);
a.CumSum; // a = [1,3,6,10]
finally
FreeIt(a);
end;
end;
Indexed: function CumSum(Index: Integer; Len: Integer): TMtxVecInt;
Cumulative sum.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Index | Integer | start index |
| 2 | Len | Integer | 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 TMtxVecBase.ConditionCheck is true and array borders are overrun.
var a: TVecInt;
begin
CreateIt(a);
try
a.SetIt(false,[1,2,3,4];
a.CumSum; // a = [1,3,6,10]
finally
FreeIt(a);
end;
end;
Overload 2: function CumSum(const Vec: TVecInt): TVecInt;
Calculate the cumulative sum for all Vec elements.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TVecInt |
Result: stored in self (calling object), returns self for chaining
Store the results in calling object. Size and TMtxVecInt.IntPrecision properties of the calling object are set implicitly.
Overload 3: function CumSum(const Vec: TMtxVecInt; VecIndex: Integer; Index: Integer; Len: Integer): TMtxVecInt;
Calculate the cumulative sum for Vec elements [VecIndex]..[VecIndex+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVecInt | source TVecInt or TMtxInt |
| 2 | VecIndex | Integer | |
| 3 | Index | Integer | start index |
| 4 | Len | Integer | 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 TMtxVecInt.IntPrecision properties of the calling object must be set explicitly. Exception is raised if TMtxVecBase.ConditionCheck property is True and array borders are overrun.