TVecSmallInt.Difference Method

Overload List

#SignatureDescription
1function Difference(const Vec: TMtxVecInt; Lag: Integer): TVecInt;Calculate the difference for all Vec elements.
└ indexed: function Difference(const Vec: TMtxVecInt; VecIndex: Integer; Index: Integer; Len: Integer; Lag: Integer): TMtxVecInt;
2function Difference(Lag: Integer): TVecInt;The difference between two succesive vector elements.

Overload 1: function Difference(const Vec: TMtxVecInt; Lag: Integer): TVecInt;

Calculate the difference for all Vec elements.

#NameTypeDescription
1VecTMtxVecIntsource TVecInt or TMtxInt
2LagInteger

Result: stored in self (calling object), returns self for chaining

Remarks:

Store the results in the calling vector. The TMtxVecBase.Length of the calling vector is set to one less the length of Vec.

Indexed: function Difference(const Vec: TMtxVecInt; VecIndex: Integer; Index: Integer; Len: Integer; Lag: Integer): TMtxVecInt;

Difference.

#NameTypeDescription
1VecTMtxVecIntsource TVecInt or TMtxInt
2VecIndexInteger
3IndexIntegerstart index
4LenIntegerelement count
5LagInteger

Result: stored in self (calling object), returns self for chaining

Remarks:

Calculate the difference for Vec elements [VecIndex]..[VecIndex+Len-1] and store the results in the calling object elements [Index]..[Index+Len-1]. Size and of the calling vector must be set explicitly. The following formula is used to calculate the difference:

Δ[k]=Vec[k+1]Vec[k],0k<Vec.Length1\Delta [k] = \text{Vec}[k+1] - \text{Vec}[k], \quad 0\leq k < \text{Vec.Length}-1

An exception is raised if TMtxVecBase.ConditionCheck is True and array borders are overrun or underrun.

Overload 2: function Difference(Lag: Integer): TVecInt;

The difference between two succesive vector elements.

#NameTypeDescription
1LagInteger

Result: stored in self (calling object), returns self for chaining

Remarks:

Calculate the difference for all calling vector elements. The following formula is used to calculate the difference:

The Length of calling vector is automatically decremented by one.