TOpenCLVector.Sum Method

Overload List

#SignatureDescription
1Double SumSums vector values.
└ indexed: Double Sum(Int32 Index, Int32 Len)
2void Sum(ref TCplx ASum)Calculates the sum of all calling object complex elements.
└ indexed: void Sum(ref TCplx ASum, Int32 Index, Int32 Len)
3void Sum(ref Double ASum, Int32 Index, Int32 Len)Calculates the sum of calling object elements [Index]..[Index+Len-1].

Overload 1: Double Sum

Sums vector values.

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

Examples
using Dew.Math;
using Dew.Math.Units;

namespace Dew.Examples
{
    void Example()
    {
        TOpenCLVector a;
        clMtxVec.CreateIt(out a);
        try
        {
            a.CopyFromArray(new double[] {1,3,-2});
            doouble s = a.Sum();  // s = 2
        }
        finally
        {
            clMtxVec.FreeIt(ref a);
        }
    }
}

Indexed: Double Sum(Int32 Index, Int32 Len)

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

#NameTypeDescription
1IndexInt32start index
2LenInt32element count

Returns: Double

Remarks:

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

Overload 2: void Sum(ref TCplx ASum)

Calculates the sum of all calling object complex elements.

#NameTypeDescription
1ASumTCplx (ref)output sum

Result: stored in self (calling object)

Remarks:

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

Indexed: void Sum(ref TCplx ASum, Int32 Index, Int32 Len)

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

#NameTypeDescription
1ASumTCplx (ref)output sum
2IndexInt32start index
3LenInt32element count

Result: stored in self (calling object)

Remarks:

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

Overload 3: void Sum(ref Double ASum, Int32 Index, Int32 Len)

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

#NameTypeDescription
1ASumDouble (ref)output sum
2IndexInt32start index
3LenInt32element count

Result: stored in self (calling object)

Remarks:

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