matmul(X;Y)
Returns the matrix multiplication of the two given matrices. (Available as of prod-9)
Function type
Vector only
Syntax
matmul(X;Y)
Input
Argument | Type | Description |
---|---|---|
X |
matrix model | A column name The column specified by this parameter must contain matrix models generated by the 1010data Matrix Functions. |
Y |
matrix model | A column name The column specified by this parameter must contain matrix models generated by the 1010data Matrix Functions. |
Return Value
Returns a matrix model that is the matrix product of the matrices specified by
X
and Y
.
If the matrices are incompatible, an error is returned.
Example
Consider the following example:
<table cols="name, data_1, data_2, data_3, data_4" title="matmul example"> John,8,0,5,1; John,2,0,1,1; Mary,3,1,2,2; Mary,4,1,2,2; John,5,2,3,1; John,6,2,3,1; Mary,7,3,4,2; Mary,1,3,0,2 </table> <willbe name="matrix_0" value="g_matrix(name;;;data_1 data_2 data_3 data_4;0)"/> <willbe name="matrix_0_inv" value="matinv(matrix_0)"/> <willbe name="matrix_0_mul" value="matmul(matrix_0;matrix_0_inv)"/>
For every row, the matrix in matrix_0_mul
will be the matrix
multiplication of the matrices in matrix_0
and
matrix_0_inv
.
Since the matrices in matrix_0
and matrix_0_inv
are the
inverse of one another, the product of these matrices is the identity matrix.
For example, clicking on the >
character in the first row of the
matrix_0_mul
column displays the result of the matrix multiplication of
matrix_0
and matrix_0_inv
for those rows where
name
is John.
You can see that the values along the diagonal are essentially 1 and that all the other values are essentially 0.