MATMUL(3I) Last changed: 1-6-98
NAME
MATMUL - Performs matrix multiplication of numeric or logical matrices
SYNOPSIS
MATMUL ([MATRIX_A=]matrix_a, [MATRIX_B=]matrix_b)
IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems
STANDARDS
Fortran 90
DESCRIPTION
The MATMUL intrinsic function performs matrix multiplication
operations on numeric or logical matrices. It accepts the following
arguments:
matrix_a Must be of numeric type (integer, real, or complex) or of
logical type. It must be array valued and of rank one or
two.
matrix_b Must be of numeric type if matrix_a is of numeric type and
of logical type if matrix_a is of logical type. It must be
array valued and of rank one or two. If matrix_a has rank
one, matrix_b must have rank two. If matrix_b has rank one,
matrix_a must have rank two. The size of the first (or
only) dimension of matrix_b must equal the size of the last
(or only) dimension of matrix_a.
MATMUL is a transformational function. The name of this intrinsic
cannot be passed as an argument.
RETURN VALUES
The result type, type parameter, and shape are as follows. If the
arguments are of numeric type, the type and kind type parameter of the
result are determined by the types of the arguments. If the arguments
are of type logical, the result is of type logical with the kind type
parameter of the arguments. The shape of the result depends on the
shapes of the arguments, as follows:
* If matrix_a has shape (n, m) and matrix_b has shape (m, k), the
result has shape (n, k).
* If matrix_a has shape (m) and matrix_b has shape (m, k), the result
has shape (k).
* If matrix_a has shape (n, m) and matrix_b has shape (m), the result
has shape (n).
Element (i, j) of the result has the value
SUM(MATRIX_A(i,:)*MATRIX_B(:,j)) if the arguments are of numeric type
and has the value ANY(MATRIX_A(i,:).AND.MATRIX_B(:,j)) if the
arguments are of logical type.
Element (j) of the result has the value SUM(MATRIX_A(:)*MATRIX_B(:,j))
if the arguments are of numeric type and has the value
ANY(MATRIX_A(:).AND.MATRIX_B(:,j)) if the arguments are of logical
type.
Element (i) of the result has the value SUM(MATRIX_A(i,:)*MATRIX_B(:))
if the arguments are of numeric type and has the value
ANY(MATRIX_A(i,:).AND.MATRIX_B(:)) if the arguments are of logical
type.
EXAMPLES
Let A and B be the matrices
| 1 2 3 |
| 2 3 4 |
and
| 1 2 |
| 2 3 |
| 2 4 |
Let X and Y be the vectors [1, 2] and [1, 2, 3].
* The result of MATMUL(A, B) is the matrix-matrix product AB with the
value
| 11 20 |
| 16 29 |
* The result of MATMUL(X, A) is the vector-matrix product XA with the
value [5, 8, 11].
* The result of MATMUL(A, Y) is the matrix-vector product AY with the
value [14, 20].
SEE ALSO
Intrinsic Procedures Reference Manual, publication SR-2138, for the
printed version of this man page.