TOpenCLMatrix::Reverse Method

Overload List

#SignatureDescription
1TOpenCLMtxVec *Reverse(TOpenCLMtxVec *Vec, int VecIndex, int Index, int Len);Reverse vector elements.
2TOpenCLMtxVec *Reverse(int Index, int Len);Reverses the calling object elements [Index]..[Index+Len-1].

Overload 1: TOpenCLMtxVec *Reverse(TOpenCLMtxVec *Vec, int VecIndex, int Index, int Len);

Reverse vector elements.

#NameTypeDescription
1VecTOpenCLMtxVec *
2VecIndexint
3Indexint
4Lenint
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[N−k],0≤k≤N,where N=Vec.Length−1\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
#include "clMtxVec.h"
#include "Units.clMtxVec.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::ClMtxVec;

void Example()
{
    TOpenCLVector* a;
    CreateIt(a);
    a->CopyFromArray( DewArray<double>{1,2,3,4});
    a->Reverse();   // a = [4,3,2,1]
    FreeIt(a);
}
See Also: TOpenCLMatrix::Rotate, TOpenCLMatrix::Shift
Declared in Dew::Math::TOpenCLMtxVec · Dew.Math/clMtxVec.h · Cross-compiler

Overload 2: TOpenCLMtxVec *Reverse(int Index, int Len);

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

#NameTypeDescription
1Indexint
2Lenint
Remarks:

An exception is raised if array borders are overrun.

Declared in Dew::Math::TOpenCLMtxVec · Dew.Math/clMtxVec.h · Cross-compiler