TOpenCLVector.Reverse Method

Overload List

#SignatureDescription
1TOpenCLVector Reverse(TOpenCLMtxVec Vec)Reverse all Vec elements.
└ indexed: TOpenCLMtxVec Reverse(TOpenCLMtxVec Vec, Int32 VecIndex, Int32 Index, Int32 Len)
2TOpenCLMtxVec Reverse(Int32 Index, Int32 Len)Reverses the calling object elements [Index]..[Index+Len-1].

Overload 1: TOpenCLVector Reverse(TOpenCLMtxVec Vec)

Reverse all Vec elements.

#NameTypeDescription
1VecTOpenCLMtxVecsource TOpenCLVector or TOpenCLMatrix

Returns: TOpenCLVector

Remarks:

Store the result in the calling vector elements. The Dew.Math.TOpenCLBase.Length and Dew.Math.TOpenCLBase.Complex roperties of the calling vector are set implicitly to match Vec vector.

V[k]=Vec[Nk],0kN,where N=Vec.Length1\text{V}[k]=\text{Vec}[N-k],\quad 0\leq k \leq N, \quad \text{where } N=\text{Vec.Length}-1

This overload reverses all vector elements.

Examples
TOpenCLVector a;
MtxVec.CreateIt(out a, out b);
try
    {
        a.CopyFromArray(TSingleArray.Create(1,2,3,4));
        b.Reverse(a);   // b = new double[] {4,3,2,1}
    }
finally
    {
        MtxVec.FreeIt(ref a, ref b);
    }
See Also: TOpenCLVector.Rotate, TOpenCLVector.Shift

Indexed: TOpenCLMtxVec Reverse(TOpenCLMtxVec Vec, Int32 VecIndex, Int32 Index, Int32 Len)

Reverse vector elements.

#NameTypeDescription
1VecTOpenCLMtxVecsource TOpenCLVector or TOpenCLMatrix
2VecIndexInt32
3IndexInt32start index
4LenInt32element count

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

Remarks:

The method reverses Vec vector elements from [VecIndex].. [VecIndex+Len-1] and stores them in the calling vector from [Index]...[Index+Len-1] by using the following equation:

V[k]=Vec[Nk],0kN,where N=Vec.Length1\text{V}[k]=\text{Vec}[N-k],\quad 0\leq k \leq N, \quad \text{where } N=\text{Vec.Length}-1

This overload reverses calling vector elements in-place.

Examples
clVector a;
a.CopyFromArray(TSingleArray.Create(1,2,3,4));
a.Reverse;   // a = new double[] {4,3,2,1}

Overload 2: TOpenCLMtxVec Reverse(Int32 Index, Int32 Len)

Reverses the calling object elements [Index]..[Index+Len-1].

#NameTypeDescription
1IndexInt32start index
2LenInt32element count

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

Remarks:

An exception is raised if array borders are overrun.