IMatrix.CreateSwapInfo

Syntax

CreateSwapInfo: IMatrixModelSwapInfo;

Description

The CreateSwapInfo method creates an object that contains information necessary to swap dimensions with matrix data.

Example

Sub Main;

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 Main;

After executing the example a matrix with random values is created. The first and second dimensions in this matrix are swapped.

See also:

IMatrix