2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
6 .. index:: MATMUL, matrix multiplication, product, matrix
10 MATMUL --- matrix multiplication
11 ********************************
13 .. function:: MATMUL(MATRIX_A, MATRIX_B)
15 Performs a matrix multiplication on numeric or logical arguments.
18 An array of ``INTEGER``,
19 ``REAL``, ``COMPLEX``, or ``LOGICAL`` type, with a rank of
23 An array of ``INTEGER``,
24 ``REAL``, or ``COMPLEX`` type if :samp:`{MATRIX_A}` is of a numeric
25 type; otherwise, an array of ``LOGICAL`` type. The rank shall be one
26 or two, and the first (or only) dimension of :samp:`{MATRIX_B}` shall be
27 equal to the last (or only) dimension of :samp:`{MATRIX_A}`.
28 :samp:`{MATRIX_A}` and :samp:`{MATRIX_B}` shall not both be rank one arrays.
31 The matrix product of :samp:`{MATRIX_A}` and :samp:`{MATRIX_B}`. The type and
32 kind of the result follow the usual type and kind promotion rules, as
33 for the ``*`` or ``.AND.`` operators.
39 Transformational function
42 .. code-block:: fortran
44 RESULT = MATMUL(MATRIX_A, MATRIX_B)