Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TVecInt CumSum | Cumulative sum. |
| └ indexed: TMtxVecInt CumSum(Int32 Index, Int32 Len) | ||
| 2 | TVecInt CumSum(TVecInt Vec) | Calculate the cumulative sum for all Vec elements. |
| 3 | TMtxVecInt CumSum(TMtxVecInt Vec, Int32 VecIndex, Int32 Index, Int32 Len) | Calculate the cumulative sum for Vec elements [VecIndex]..[VecIndex+Len-1]. |
Overload 1: TVecInt CumSum
Cumulative sum.
Result: stored in self (calling object), returns self for chaining
Calculate the cumulative sum for all calling object elements in-place.
TVecIn a;
MtxVec.CreateIt(out a);
try
{
a.SetIt(new double[] {1,2,3,4});
a.CumSum; // a = new double[] {1,3,6,10}
}
finally
{
MtxVec.FreeIt(ref a);
}
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.
using Dew.Math;
using Dew.Math.Units;
namespace Dew.Examples
{
void Example()
{
TVecInt a;
MtxVecInt.CreateIt(out a);
try
{
a.SetIt(true,new double[] {1,2,3,4});
a.CumSum(); // a = [1,3,6,10]
}
finally
{
MtxVecInt.FreeIt(ref a);
}
}
}
Overload 2: TVecInt CumSum(TVecInt Vec)
Calculate the cumulative sum for all Vec elements.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TVecInt | source TVecInt |
Result: stored in self (calling object), returns self for chaining
Store the results in calling object. Size and Dew.Math.TMtxVecInt.IntPrecision properties of the calling object are set implicitly.
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.