DADiSP Worksheet Functions > Function Categories > Matrix Math and Special Matrices > *^ (Matrix Multiply)
Multiplies two matrices.
A *^ B
A |
- |
A matrix. |
B |
- |
A matrix |
A matrix.
W1: {{1, 3, 4},
{5, 7, 9},
{8, 9, 12}}
W2: {{1, 3, 2},
{2, 4, 5},
{1, 2, 0}}
W3: W1 *^ W2
W4: W2 *^ W1
W3 and W4 contain the following matrices:
W3 == {{11, 23, 17},
{28, 61, 45}}
{38, 84, 61}}
W4 == {{32, 42, 55},
{62, 79, 104},
{11, 17, 22}}
For matrices A and B, C = A *^ B is computed formally with:
The number of columns in A must be equal to the number of rows in B. The number of rows in the output matrix is equal to the number of rows in A, and the number of columns in the output matrix is equal to the number of columns in B.
Matrix multiplication is not commutative, the product is not independent of the order of the arguments:
However the determinant is independent of the order of the product:
Matrix multiplication is associative:
Matrix multiplication is distributive over addition:
a *^ b is equivalent to mmult(a, b).
If any argument is a scalar, *^ defaults to standard element by element multiplication (equivalent to the * operator). For example:
4 *^ 5 == 20
See the ^^ (Matrix Power) operator to raise a matrix to a scalar power or raise a scalar to a matrix power.
See DADiSP/MatrixXL to significantly optimize *^.