Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TVec Reverse | Reverse vector elements. |
| └ indexed: TMtxVec Reverse(Int32 Index, Int32 Len) | ||
| 2 | TVec Reverse(TMtxVec Vec) | Reverse all Vec elements. |
| └ indexed: TMtxVec Reverse(TMtxVec Vec, Int32 VecIndex, Int32 Index, Int32 Len) |
Overload 1: TVec Reverse
Reverse vector elements.
Result: stored in self (calling object), returns self for chaining
The method reverses vector elements by using the following equation:
This overload reverses all calling vector elements in-place.
Vector a = new Vector();
a.SetIt(new double[] { 1.0, 2.0, 3.0, 4.0 });
a.Reverse();
Vector expected = new Vector();
expected.SetIt(new double[] { 4.0, 3.0, 2.0, 1.0 });
if (!a.IsEqual(expected, 1e-10, TCompare.cmpAbsolute))
throw new Exception("Vector.Reverse: mismatch");
Vector a;
a.SetIt(false,new double[] {1,2,3,4});
a.Reverse; // a = new double[] {4,3,2,1}
Indexed: TMtxVec Reverse(Int32 Index, Int32 Len)
Reverses the calling object elements [Index]..[Index+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Index | Int32 | start index |
| 2 | Len | Int32 | element count |
Result: stored in self (calling object), returns self for chaining
An exception is raised if array borders are overrun.
Overload 2: TVec Reverse(TMtxVec Vec)
Reverse all Vec elements.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVec | source TVec or TMtx |
Result: stored in self (calling object), returns self for chaining
Store the result in the calling vector elements. The Dew.Math.Vector.Length and Dew.Math.Vector.Complex properties of the calling vector are set implicitly to match Vec vector.
Vector a = new Vector();
Vector x = new Vector();
x.SetIt(new double[] { 1.0, 2.0, 3.0, 4.0 });
a.Reverse(x);
Vector expected = new Vector();
expected.SetIt(new double[] { 4.0, 3.0, 2.0, 1.0 });
if (!a.IsEqual(expected, 1e-10, TCompare.cmpAbsolute))
throw new Exception("Vector.Reverse: mismatch");
Indexed: TMtxVec Reverse(TMtxVec Vec, Int32 VecIndex, Int32 Index, Int32 Len)
Reverse vector elements.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVec | source TVec or TMtx |
| 2 | VecIndex | Int32 | |
| 3 | Index | Int32 | start index |
| 4 | Len | Int32 | element count |
Result: stored in self (calling object), returns self for chaining
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:
This overload reverses calling vector elements in-place.
Vector a;
a.SetIt(false,new double[] {1,2,3,4});
a.Reverse; // a = new double[] {4,3,2,1}