TVecSmallInt::CumSum Method

Overload List

#SignatureDescription
1TMtxVecInt *CumSum(int Index, int Len);Cumulative sum.
2TMtxVecInt *CumSum(TMtxVecInt *Vec, int VecIndex, int Index, int Len);Calculate the cumulative sum for Vec elements [VecIndex]..[VecIndex+Len-1].
3TVecInt *CumSum();Cumulative sum.
4TVecInt *CumSum(TVecInt *Vec);Calculate the cumulative sum for all Vec elements.

Overload 1: TMtxVecInt *CumSum(int Index, int Len);

Cumulative sum.

#NameTypeDescription
1Indexint
2Lenint
Remarks:

Calculate the cumulative sum for calling object elements [Index]..[Index+Len-1] in-place. An exception is raised if TVecSmallInt::ConditionCheck is true and array borders are overrun.

Examples
#include "MtxVecInt.h"
#include "Units.MtxVecInt.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::MtxVecInt;

void Example()
{
    TVecInt* a;
    CreateIt(a);
    a->SetIt(DewArray<int>{1,2,3,4});
    a->CumSum();  // a = [1,3,6,10]
    FreeIt(a);
}
See Also: TVecSmallInt::Sum
Declared in Dew::Math::TMtxVecInt · Dew.Math/AbstractMtxVecInt.h · Cross-compiler

Overload 2: TMtxVecInt *CumSum(TMtxVecInt *Vec, int VecIndex, int Index, int Len);

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

#NameTypeDescription
1VecTMtxVecInt *
2VecIndexint
3Indexint
4Lenint
Remarks:

Store the results in calling object elements [Index]..[Index+Len-1]. Size and TVecSmallInt::IntPrecision properties of the calling object must be set explicitly. Exception is raised if TVecSmallInt::ConditionCheck property is True and array borders are overrun.

Declared in Dew::Math::TMtxVecInt · Dew.Math/AbstractMtxVecInt.h · Cross-compiler

Overload 3: TVecInt *CumSum();

Cumulative sum.

Remarks:

Calculate the cumulative sum for all calling object elements in-place.

Examples
#include "MtxVecInt.h"
#include "Units.MtxVecInt.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::MtxVecInt;

void Example()
{
    TVecInt* a;

    CreateIt(a);
    a->SetIt(DewArray<int>{1,2,3,4});
    a->CumSum(); // a = [1,3,6,10]
    FreeIt(a);
}
See Also: TVecSmallInt::Sum
Declared in Dew::Math::TVecInt · Dew.Math/MtxVecInt.h · Cross-compiler

Overload 4: TVecInt *CumSum(TVecInt *Vec);

Calculate the cumulative sum for all Vec elements.

#NameTypeDescription
1VecTVecInt *
Remarks:

Store the results in calling object. Size and TVecSmallInt::IntPrecision properties of the calling object are set implicitly.

Declared in Dew::Math::TVecInt · Dew.Math/MtxVecInt.h · Cross-compiler