Matrix - Multiplication of matrices
This function block will multiply the matrices MX1 and MX2 by each other.
The matrix multiplication is an operation where the elements of the rows of MX1 are multiplied with the elements of the columns of MX2 and these products are added afterwards.
This operation can only be accomplished, if the dimensions of the matrices are in an appropriate ratio to each other. An m*k matrix can only be multiplied with a k*n matrix. The result is an m*n matrix.
The resulting matrix will either be written to matrix MX3 or a new matrix will be created at output MY.
No designated output matrix (default):
The result will be written back to the additional in-/output matrix MX3. No new matrix will be created. The output MY will not be available. The provided matrix MX3 has to be large enough to hold the result of the matrix multiplication of MX1 and MX2. If this is not the case the download will be aborted with an error message.
With a designated output matrix:
A new matrix will be created on MY. The dimension of this matrix will be determined automatically out of the input matrices. The input MX3 is not available.
Example
Parameters
The parameter dialog can be used to select the way of how to provide the calculated matrix.
Signals
Name | I/O | Type(s) | Function |
---|---|---|---|
MX1 | I | UCHAR, WORD, LONG, LONGLONG, FLOAT, DOUBLE | Input matrix |
MX2 | I | UCHAR, WORD, LONG, LONGLONG, FLOAT, DOUBLE | Input matrix |
MX3 | I/O | UCHAR, WORD, LONG, LONGLONG, FLOAT, DOUBLE | In-/output matrix |
MY | O | UCHAR, WORD, LONG, LONGLONG, FLOAT, DOUBLE | Output matrix |
Visualization
If the input signals are connected incorrectly, the symbol will be depicted red in run mode.
Comments
An input matrix connected to MX1 or MX2 is not allowed to be connected at MX3 as the result matrix!
The data type will be assigned by connecting an input signal.