clMatrix.Sum Method

Overload List

#SignatureDescription
1function Sum: Double;Sums vector values.
└ indexed: function Sum(Index: Integer; Len: Integer): Double;
2procedure Sum(out ASum: TCplx);Calculates the sum of all calling object complex elements.
└ indexed: procedure Sum(out ASum: TCplx; Index: Integer; Len: Integer);
3procedure Sum(out ASum: Double; Index: Integer; Len: Integer);Calculates the sum of calling object elements [Index]..[Index+Len-1].

Overload 1: function Sum: Double;

Sums vector values.

Returns: Double - the sum of all calling object elements. An exception is raised if calling object clMatrix.Complex property is true.

Examples
var a: clMatrix;
    b: double;
begin
    a.Size(2,2, clFloat, false);
    a.CopyFromArray(TDoubleArray.Create(1,2,3,4));
    b := a.Sum; // b = 10
end;
See Also: clMatrix.Sumc

Indexed: function Sum(Index: Integer; Len: Integer): Double;

Returns the sum of calling object elements [Index]..[Index+Len-1].

#NameTypeDescription
1IndexIntegerstart index
2LenIntegerelement count

Returns: Double

Remarks:

An exception is raised if calling object clMatrix.Complex property is True or array borders are overrun/underrun.

Overload 2: procedure Sum(out ASum: TCplx);

Calculates the sum of all calling object complex elements.

#NameTypeDescription
1ASumTCplxoutput sum

Result: stored in self (calling object)

Remarks:

Stores the result in complex ASum variable. An exception is raised if calling object clMatrix.Complex property is False.

Indexed: procedure Sum(out ASum: TCplx; Index: Integer; Len: Integer);

Calculates the sum of calling object complex elements [Index]..[Index+Len-1].

#NameTypeDescription
1ASumTCplxoutput sum
2IndexIntegerstart index
3LenIntegerelement count

Result: stored in self (calling object)

Remarks:

Stores the result in complex ASum variable. An exception is raised if calling object clMatrix.Complex property is False or array borders are overrun/underrun.

Overload 3: procedure Sum(out ASum: Double; Index: Integer; Len: Integer);

Calculates the sum of calling object elements [Index]..[Index+Len-1].

#NameTypeDescription
1ASumDoubleoutput sum
2IndexIntegerstart index
3LenIntegerelement count

Result: stored in self (calling object)

Remarks:

Stores the result in real ASum variable. An exception is raised if calling object clMatrix.Complex property is True or array borders are overrun/underrun.