IMath.Mtranspose

Syntax

Mtranspose(Data: Array): Array;

Parameters

Data. Single dimension or two dimension number array.

Description

The Mtranspose method returns transposed array.

Comments

Transposing is transformation of an array that results in columns becoming rows and rows becoming columns.

Example

Add link to the MathFin system assembly.

Sub UserProc;
Var
    Matr, MInv: Array Of Double;
    i, j: integer;
Begin
    // Create two dimension array
    Matr := New Double[33];
    Matr[00] := 1; Matr[01] := 9; Matr[02] := 9;
    Matr[10] := 2; Matr[11] := 15; Matr[12] := 0;
    Matr[20] := 8; Matr[21] := 2; Matr[22] := 13;
    Debug.WriteLine("Array");
    // Display created array to console
    For i := 0 To Matr.GetUpperBound(1Do
        For j := 0 To Matr.GetUpperBound(2Do
            Debug.Write(Matr[i, j].ToString + "  ");
        End For;
        Debug.WriteLine("");
    End For;
    // Transpose array
    MInv := Math.Mtranspose(Matr);
    Debug.WriteLine("Transposed array");
    // Display transposed array in the console
    For i := 0 To MInv.GetUpperBound(1Do
        For j := 0 To MInv.GetUpperBound(2Do
            Debug.Write(MInv[i, j].ToString + "  ");
        End For;
        Debug.WriteLine("");
    End For;
End Sub UserProc;

After executing the example the MInv variable contains the Matr transposed array, and both arrays are displayed in the console window.

See also:

IMath