Mtranspose(Data: Array): Array;
Mtranspose(Data: System.Array): System.Array;
Data. Single dimension or two dimension number array.
The Mtranspose method returns transposed array.
Transposing is transformation of an array that results in columns becoming rows and rows becoming columns.
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[3, 3];
Matr[0, 0] := 1; Matr[0, 1] := 9; Matr[0, 2] := 9;
Matr[1, 0] := 2; Matr[1, 1] := 15; Matr[1, 2] := 0;
Matr[2, 0] := 8; Matr[2, 1] := 2; Matr[2, 2] := 13;
Debug.WriteLine("Array");
// Display created array to console
For i := 0 To Matr.GetUpperBound(1) Do
For j := 0 To Matr.GetUpperBound(2) Do
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(1) Do
For j := 0 To MInv.GetUpperBound(2) Do
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.
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[3, 3];
Matr[0, 0] := 1; Matr[0, 1] := 9; Matr[0, 2] := 9;
Matr[1, 0] := 2; Matr[1, 1] := 15; Matr[1, 2] := 0;
Matr[2, 0] := 8; Matr[2, 1] := 2; Matr[2, 2] := 13;
System.Diagnostics.Debug.WriteLine("Array");
// Display created array to console
For i := 0 To Matr.GetUpperBound(0) Do
For j := 0 To Matr.GetUpperBound(1) Do
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(0) Do
For j := 0 To MInv.GetUpperBound(1) Do
System.Diagnostics.Debug.Write(MInv[i, j] + " ");
End For;
System.Diagnostics.Debug.WriteLine("");
End For;
End Sub;
See also: