MMult(A1: Array; A2: Array): Array;
A1. Array of real numbers.
A2. Array of real numbers.
The MMult method returns a product of set matrices.
The resulting array will have the same number of rows as A1 and the same number of columns as A2.
The number of columns of A1 argument must be the same as the number of rows of A2 argument.
To execute this example, add a link to the Stat system assembly.
Sub UserProc;
Var
MM, matr1, matr2: Array Of Double;
i, j: Integer;
Begin
matr1 := New Double[3, 3];
matr1[0, 0] := 1; matr1[0, 1] := 9; matr1[0, 2] := 9;
matr1[1, 0] := 2; matr1[1, 1] := 15; matr1[1, 2] := 4;
matr1[2, 0] := 8; matr1[2, 1] := 1; matr1[2, 2] := 13;
matr2 := New Double[3, 2];
matr2[0, 0] := 10; matr2[0, 1] := 3;
matr2[1, 0] := 20; matr2[1, 1] := 16;
matr2[2, 0] := 18; matr2[2, 1] := 17;
MM := Math.MMult(matr1,matr2);
If math.Status = 0 Then
For i := 0 To MM.GetUpperBound(1) Do
For j := 0 To MM.GetUpperBound(2) Do
Debug.Write(MM[i, j].ToString + " ");
End For;
Debug.WriteLine("");
End For;
Else
Debug.WriteLine("Error " + Math.Status.ToString + ": " + Math.ErrorMsg);
End If;
End Sub UserProc;
After executing the example the console window displays the matrix that is equal to the product of set matrices.
See also: