matrix1 * matrix2 ;
The matrix multiplication operator (*) computes a new matrix by performing matrix multiplication. The first matrix must have the same number of columns as the second matrix has rows. The new matrix has the same number of rows as the first matrix and the same number of columns as the second matrix. That is, if is an matrix and is a matrix, then the product is an matrix. The th element of the product is the sum .
The matrix multiplication operator does not support missing values.
The following statements multiply matrices. The results are shown in Figure 23.20.
a = {1 2, 3 4}; b = {1 2}; c = b*a; d = a*b`; print c, d;
Figure 23.20: Result of Matrix Multiplication
c | |
---|---|
7 | 10 |
d |
---|
5 |
11 |