Swap(IndexFrom: Integer; IndexTo: Integer);
IndexFrom. Index of the dimension, which must be swapped.
IndexTo. Index of the position, to which the dimension must be swapped.
The Swap method rearranges dimensions.
For the changes to take effect, execute the IMatrix.Swap method.
Add links to the MathFin and Matrix system assemblies.
Sub UserProc;
Var
M: Matrix[3];
Mm: IMatrixModel;
Swap: IMatrixModelSwapInfo;
x, y, z: Integer;
Begin
Debug.WriteLine("Source matrix");
For x := 1 To 3 Do
For y := 1 To 3 Do
For z := 1 To 3 Do
M[x, y, z] := Math.RandBetweenI(0, 9);
Debug.Write(M[x, y, z] + " ");
End For;
Debug.WriteLine("");
End For;
Debug.WriteLine("");
End For;
Mm := M As IMatrixModel;
Swap := (M As IMatrix).CreateSwapInfo;
Swap.Swap(0, 1);
M := (M As IMatrix).Swap(Swap);
Debug.WriteLine("Matrix with swapped dimensions");
For x := 1 To 3 Do
For y := 1 To 3 Do
For z := 1 To 3 Do
Debug.Write(M[x, y, z] + " ");
End For;
Debug.WriteLine("");
End For;
Debug.WriteLine("");
End For;
End Sub UserProc;
After executing the example a matrix containing random values is created. In this matrix the first and second dimensions will be swapped.
See also: