You are here: Symbol Reference > AbstractMtxVecInt Namespace > Classes > TMtxVecInt Class > public > CumSum Method > TMtxVecInt.CumSum Method (Integer, Integer)
MtxVec VCL
ContentsIndex
PreviousUpNext
TMtxVecInt.CumSum Method (Integer, Integer)

Cumulative sum.

Pascal
function CumSum(Index: Integer; Len: Integer): TMtxVecInt; overload;

Calculate the cumulative sum for calling object elements [Index]..[Index+Len-1] in-place. An exception is raised if TMtxVecBase.ConditionCheckConditionCheckis 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;
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!