| MATLAB Function Reference | ![]() |
C = A*B
C = A*B is the linear algebraic product of the matrices A and B. If A is an m-by-p and B is a p-by-n matrix, the i,j entry of C is defined by

The product C is an m-by-n matrix. For nonscalar A and B, the number of columns of A must equal the number of rows of B. You can multiply a scalar by a matrix of any size.
The preceding definition says that C(i,j) is the inner product of the ith row of A with the jth column of B. You can write this definition using the MATLAB® colon operator as
C(i,j) = A(i,:)*B(:,j)
where A(i,:) is the ith row of A and B(:,j) is the jth row of B.
Note If A is an m-by-0 empty matrix and B is a 0-by-n empty matrix, where m and n are positive integers, A*B is an m-by-n matrix of all zeros. |
If A is a row vector and B is a column vector with the same number of elements as A, A*B is simply the inner product of A and B. For example,
A = [5 3 2 6]
A =
5 3 2 6
B = [-4 9 0 1]'
B =
-4
9
0
1
A*B
ans =
13A = [1 3 5; 2 4 7]
A =
1 3 5
2 4 7
B = [-5 8 11; 3 9 21;4 0 8]
B =
-5 8 11
3 9 21
4 0 8The product of A and B is
C = A*B
C =
24 35 114
30 52 162Note that the second row of A is
A(2,:)
ans =
2 4 7while the third column of B is
B(:,3)
ans =
11
21
8The inner product of A(2,:) and B(:,3) is
A(2,:)*B(:,3) ans = 162
which is the same as C(2,3).
mtimes uses the following Basic Linear Algebra Subroutines (BLAS):
DDOT
DGEMV
DGEMM
DSYRK
DSYRZK
For inputs of type single, mtimes using corresponding routines that begin with "S" instead of "D".
![]() | msgbox | mu2lin | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |