Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TMtxVec *CumSum(int Index, int Len) const; | Cumulative sum. |
| 2 | TMtxVec *CumSum(TMtxVec *Vec, int VecIndex, int Index, int Len) const; | Calculate the cumulative sum for Vec elements [VecIndex]..[VecIndex+Len-1]. |
| 3 | TMtx *CumSum() const; | Cumulative sum for each of the matrix columns. |
| 4 | TMtx *CumSum(TMtx *Mtx) const; | Calculate tehe cumulative sum for each of the X matrix columns. |
Overload 1: TMtxVec *CumSum(int Index, int Len) const;
Cumulative sum.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Index | int | |
| 2 | Len | int |
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.
#include "MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
Matrix a;
a.SetIt(2, 2, false, DewArray<double>{1, 2, 3, 4});
a.CumSum(0, 4); // a = [1,3,6,10]
}
Overload 2: TMtxVec *CumSum(TMtxVec *Vec, int VecIndex, int Index, int Len) const;
Calculate the cumulative sum for Vec elements [VecIndex]..[VecIndex+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVec * | |
| 2 | VecIndex | int | |
| 3 | Index | int | |
| 4 | Len | int |
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.
#include "MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
Matrix a;
a = {{1, 2}, {3, 4}};
a.CumSum(0, 4); // a = [1,3,6,10]
}
Overload 3: TMtx *CumSum() const;
Cumulative sum for each of the matrix columns.
Calculate the cumulative sum for each of the calling matrix columns in-place.
#include "MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
Matrix Mtx;
Mtx.SetIt(3, 2, false, DewArray<double>{1, 2,
2, 5,
3, 1});
Mtx.CumSum();
// Mtx becomes:
// 1, 2
// 3, 7
// 6, 8
}
Overload 4: TMtx *CumSum(TMtx *Mtx) const;
Calculate tehe cumulative sum for each of the X matrix columns.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Mtx | TMtx * |
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.