Fortran Wiki


Performs a matrix multiplication on numeric or logical arguments.


Fortran 95 and later


Transformational function


result = matmul(matrix_a, matrix_b)


  • matrix_a - An array of integer, real, complex, or logical type, with a rank of one or two.
  • matrix_b - An array of integer, real, or complex type if matrix_a is of a numeric type; otherwise, an array of logical type. The rank shall be one or two, and the first (or only) dimension of matrix_b shall be equal to the last (or only) dimension of matrix_a. matrix_a and matrix_b shall not both be rank one arrays.

Return value

The matrix product of matrix_a and matrix_b. The type and kind of the result follow the usual type and kind promotion rules, as for the * or .and. operators.

category: intrinsics