Matrix.Reverse Method

Overload List

#SignatureDescription
1TMtxVec Reverse(TMtxVec Vec, Int32 VecIndex, Int32 Index, Int32 Len)Reverse Matrix elements.
2TMtxVec Reverse(Int32 Index, Int32 Len)Reverses the calling object elements [Index]..[Index+Len-1].

Overload 1: TMtxVec Reverse(TMtxVec Vec, Int32 VecIndex, Int32 Index, Int32 Len)

Reverse Matrix elements.

#NameTypeDescription
1VecTMtxVecsource TVec or TMtx
2VecIndexInt32
3IndexInt32start index
4LenInt32element count

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

Remarks:

The method reverses Vec Matrix elements from [VecIndex].. [VecIndex+Len-1] and stores them in the calling Matrix 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 Matrix elements in-place.

Examples
Matrix a;
a.SetIt(2,2,false,new double[] {1,2,3,4});
a.Reverse(0,2);   // a = new double[] {2,1,3,4}
See Also: Matrix.Rotate, Matrix.Shift

Overload 2: TMtxVec 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.