IMath.Mtranspose

Fore Syntax

Mtranspose(Data: Array): Array;

Fore.NET Syntax

Mtranspose(Data: System.Array): System.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.

Fore 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.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.MathFin;

Public Shared Sub Main(Params: StartParams);
Var
    Matr, MInv: System.Array;
    M: Prognoz.Platform.Interop.MathFin.Math;
    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;
    System.Diagnostics.Debug.WriteLine("Array");
    // Display created array to console
    For i := 0 To Matr.GetUpperBound(0Do
        For j := 0 To Matr.GetUpperBound(1Do
            System.Diagnostics.Debug.Write(Matr[i, j] + "  ");
        End For;
        System.Diagnostics.Debug.WriteLine("");
    End For;
    M := New Prognoz.Platform.Interop.MathFin.Math.Create();
    // Transpose array
    MInv := M.Mtranspose(Matr);
    System.Diagnostics.Debug.WriteLine("Transposed array");
    // Display transposed array in the console
    For i := 0 To MInv.GetUpperBound(0Do
        For j := 0 To MInv.GetUpperBound(1Do
            System.Diagnostics.Debug.Write(MInv[i, j] + "  ");
        End For;
        System.Diagnostics.Debug.WriteLine("");
    End For;
End Sub;

See also:

IMath