Language Reference


Multiplication Operator, Matrix:   *

  • 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 $\bA $ is an $n\times p$ matrix and $\bB $ is a $p\times m$ matrix, then the product $\bA $ $*$ $\bB $ is an $n\times m$ matrix. The (i, j) element of the product is the sum $\sum _{k=1}^ p A_{ik}B_{kj}$.

The matrix multiplication operator does not support missing values.

The following statements multiply matrices. The results are shown in Figure 25.21.

a = {1 2,
     3 4};
b = {1 2};
c = b*a;
d = a*b`;
print c, d;

Figure 25.21: Result of Matrix Multiplication

c
7 10

d
5
11