TVecSmallInt.Sum Method

Int32 Sum

Sums vector values.

Returns: Int32 - the sum of all calling object elements.

Examples
Matrix a = new Matrix();
a.SetIt(2, 2, false, new double[] { 1.0, 2.0, 3.0, 4.0 });
double result = a.Sum();
if (Math.Abs(result - 10.0) > 1e-10)
    throw new Exception("Matrix.Sum: expected 10.0, got " + result);
Matrix a;
double b;
a.SetIt(1,4,false,new double[] {1,2,3,4});
b = a.Sum; // b = 10

Indexed: Int32 Sum(Int32 Index, Int32 Len)

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

#NameTypeDescription
1IndexInt32start index
2LenInt32element count

Returns: Int32

Remarks:

An exception is raised if array borders are overrun/underrun.