IMatrixModel.OperationMatrix

Syntax

OperationMatrix(Op: MatrixOperation; Source: IMatrixModel);

Parameters

Op. Mathematical operation that must be executed for the original matrix and the matrix passed by the Source parameter.

Source. The matrix that is used in mathematical operation with the current matrix.

Description

The OperationMatrix method performs mathematical operations between the current matrix and the matrix passed as an input parameter.

Comments

The result is placed into the current matrix. All operations are executed elementwise.

Example

Add a link to the MathFin system assembly.

Sub UserProc;
Var
    M1, M2: Matrix[2];
    Mm: IMatrixModel;
    x, y: Integer;
Begin
    Debug.WriteLine("Source matrices");
    For x := 0 To 3 Do
        For y := 0 To 3 Do
            M1[x, y] := Math.RandBetweenI(010);
            Debug.Write(M1[x, y] + " ");
        End For;
        Debug.WriteLine("");
    End For;
    Debug.WriteLine("------------");
    For x := 0 To 3 Do
        For y := 0 To 3 Do
            M2[x, y] := Math.RandBetweenI(010);
            Debug.Write(M2[x, y] + " ");
        End For;
        Debug.WriteLine("");
    End For;
    Mm := M1 As IMatrixModel;
    Mm.OperationMatrix(MatrixOperation.Mul, (M2 As IMatrixModel));
    Debug.WriteLine("------------");
    For x := 0 To 3 Do
        For y := 0 To 3 Do
            Debug.Write(M1[x, y] + " ");
        End For;
        Debug.WriteLine("");
    End For;
End Sub UserProc;

After executing the example two matrices with random values are created. The matrices are multiplied elementwise. The source and output data are displayed in the development environment console.

See also:

IMatrixModel