You are here: Symbol Reference > MtxVecInt Namespace > Classes > TMtxInt Class > public > CumSum Method > TMtxInt.CumSum Method ()
MtxVec VCL
ContentsIndex
PreviousUpNext
TMtxInt.CumSum Method ()

Cumulative sum for each of the matrix columns.

Pascal
function CumSum: TMtxInt; overload;

Calculate the cumulative sum for each of the calling matrix columns in-place. Function performs no overflow checking. It is users responsibility to ensure that the sum does not overflow the range of the used integer storage type.

var Mtx: TMtxInt; begin Mtx := TMtxInt.Create; try Mtx.Size(3,2,[1,2, 2,5, 3,1]); Mtx.CumSum; // Mtx becomes: // 1, 2 // 3, 7 // 6, 8 finally Mtx.Free; end; end;
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!