OperationConst(Op: MatrixOperation; Value: Variant);
Op. Mathematical operation, which must be executed for the original matrix and the constant passed by the Value parameter.
Value. The constant that is used in mathematical operation with the current matrix.
The OperationConst method executes mathematical operations between the current matrix and the constant passed by the Value input parameter. All operations are executed elementwise.
Sub Main;
Var
M: Matrix[2];
Mm: IMatrixModel;
x, y: Integer;
Begin
Debug.WriteLine("Source matrix");
For x := 0 To 4 Do
For y := 0 To 4 Do
M[x, y] := Math.RandBetweenI(10, 20);
Debug.Write(M[x, y] + " ");
End For;
Debug.WriteLine("");
End For;
Mm := M As IMatrixModel;
Mm.OperationConst(MatrixOperation.Mul, 11);
Debug.WriteLine("Matrix values, multiplied by 11");
For x := 0 To 4 Do
For y := 0 To 4 Do
Debug.Write(M[x, y] + " ");
End For;
Debug.WriteLine("");
End For;
End Sub Main;
After executing the example a matrix containing random values will be created. Values of this matrix will be multiplied by 11, both matrices will be displayed in the development environment console.
See also: