XL Fortran for AIX 8.1

Language Reference


Performs a matrix multiplication.

is an array with a rank of one or two and a numeric or logical data type.

is an array with a rank of one or two and a numeric or logical data type. It can be a different numeric type than MATRIX_A, but you cannot use one numeric matrix and one logical matrix.

+-------------------------------IBM Extension--------------------------------+

MINDIM (optional)
is an integer that determines whether to do the matrix multiplication using the Winograd variation of the Strassen algorithm, which may be faster for large matrices. The algorithm recursively splits the operand matrices into four roughly equal parts, until any submatrix extent is less than MINDIM.
Strassen's method is not stable for certain row or column scalings of the input matrices. Therefore, for MATRIX_A and MATRIX_B with divergent exponent values, Strassen's method may give inaccurate results.

The significance of the value of MINDIM is:

does not use the Strassen algorithm at all. This is the default.

is reserved for future use.

recursively applies the Strassen algorithm as long as the smallest extent of all dimensions in the argument arrays is greater than or equal to this value. To achieve optimal performance you should experiment with the value of MINDIM as the optimal value depends on your machine configuration, available memory, and the size, type, and kind type of the arrays.

By default, MATMUL employs the conventional O(N**3) method of matrix multiplication.

If you link the libxlf90_r.a library, a parallel implementation of matrix multiplication is employed, which improves performance on SMP machines.

If you link the libxlf90.a or libxlf90_t.a library, the Winograd variation of the O(N**2.81) Strassen method is employed under these conditions:

  1. MATRIX_A and MATRIX_B are both integer or both complex and have the same kind type.
  2. The program can allocate the needed temporary storage, enough to hold approximately (2/3)*(N**2) elements for square matrices of extent N.
  3. The MINDIM argument is less than or equal to the smallest of all extents of MATRIX_A and MATRIX_B.

+----------------------------End of IBM Extension----------------------------+

At least one of the arguments must be of rank two. The size of the first or only dimension of MATRIX_B must be equal to the last or only dimension of MATRIX_A.


Transformational function

Result Value

The result is an array. If one of the arguments is of rank one, the result has a rank of one. If both arguments are of rank two, the result has a rank of two.

The data type of the result depends on the data type of the arguments, according to the rules in Table 3 and Table 4.

If MATRIX_A and MATRIX_B have a numeric data type, the array elements of the result are:

Value of Element (i,j) = SUM( (row i of MATRIX_A) * (column j of MATRIX_B) )

If MATRIX_A and MATRIX_B are of type logical, the array elements of the result are:

Value of Element (i,j) = ANY( (row i of MATRIX_A) .AND. (column j of MATRIX_B) )


! A is the array  | 1 2 3 |, B is the array | 7 10 |
!                 | 4 5 6 |                 | 8 11 |
!                                           | 9 12 |
! The result is |  50   68 |
!               | 122  167 |

+-------------------------------IBM Extension--------------------------------+

 ! HUGE_ARRAY and GIGANTIC_ARRAY in this example are
! large arrays of real or complex type, so the operation
! might be faster with the Strassen algorithm.

+----------------------------End of IBM Extension----------------------------+

+-------------------------------IBM Extension--------------------------------+

Related Information

The compiler will try to use the ESSL library instead of the Fortran run-time library if the -qessl compiler option is used. See User's Guide for more information.

The numerical stability of Strassen's method for matrix multiplication is discussed in:

"Exploiting Fast Matrix Multiplication Within the Level 3 BLAS", Nicholas J. Higham, ACM Transactions on Mathematical Software, Vol. 16, No. 4, December 1990.
"GEMMW: A portable level 3 BLAS Winograd variant of Strassen's matrix-matrix multiply algorithm", Douglas, C. C., Heroux, M., Slishman, G., and Smith, R. M., Journal of Computational Physics, Vol. 110, No. 1, January 1994, pages 1-10.

+----------------------------End of IBM Extension----------------------------+

[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]