Using the Basic Linear Algebra Subprograms (BLAS)

Four Basic Linear Algebra Subprograms (BLAS) functions are shipped with XL Fortran in the libxlopt library. The functions consist of the following:

Note:
Some error-handling code has been removed from the BLAS functions in libxlopt, and no error messages are emitted for calls to the these functions.

BLAS function syntax describes the interfaces for the XL Fortran BLAS functions, which are similar to those of the equivalent BLAS functions shipped in IBM's Engineering and Scientific Subroutine Library (ESSL); for more detailed information and examples of usage of these functions, you may wish to consult the Engineering and Scientific Subroutine Library Guide and Reference, available at http://publib.boulder.ibm.com/clresctr/windows/public/esslbooks.html .

Linking the libxlopt library describes how to link to the XL Fortran libxlopt library if you are also using a third-party BLAS library.

BLAS function syntax

The interfaces for the SGEMV and DGEMV functions are as follows:

CALL SGEMV(trans, m, n, alpha,
					a, lda, x, incx,
					beta, y, incy)
CALL DGEMV(trans, m, n, alpha,
					a, lda, x, incx,
				   beta, y, incy)

The parameters are as follows:

trans
is a single character indicating the form of the input matrix a, where:
m
represents: The number of rows must be greater than or equal to zero, and less than the leading dimension of the matrix a (specified in lda)
n
represents: The number of columns must be greater than or equal to zero.
alpha
is the scaling constant
a
is the input matrix of single-precision (for SGEMV) or double-precision (for DGEMV) real values
lda
is the leading dimension of the array specified by a. The leading dimension must be greater than zero. The leading dimension must be greater than or equal to 1 and greater than or equal to the value specified in m.
x
is the input vector of single-precision (for SGEMV) or double-precision (for DGEMV) real values.
incx
is the stride for vector x. It can have any value.
beta
is the scaling constant
y
is the output vector of single-precision (for SGEMV) or double-precision (for DGEMV) real values.
incy
is the stride for vector y. It must not be zero.
Note:
Vector y must have no common elements with matrix a or vector x; otherwise, the results are unpredictable.

The prototypes for the SGEMM and DGEMM functions are as follows:

CALL SGEMM(transa, transb, l, n, m, alpha, 
           a, lda, b, ldb, beta, c, ldc)
CALL DGEMM(transa, transb, l, n, m, alpha, 
           a, lda, b, ldb, beta, c, ldc)

The parameters are as follows:

transa
is a single character indicating the form of the input matrix a, where:
transb
is a single character indicating the form of the input matrix b, where:
l
represents the number of rows in output matrix c. The number of rows must be greater than or equal to zero, and less than the leading dimension of c.
n
represents the number of columns in output matrix c. The number of columns must be greater than or equal to zero.
m
represents: and: m must be greater than or equal to zero.
alpha
is the scaling constant
a
is the input matrix a of single-precision (for SGEMM) or double-precision (for DGEMM) real values
lda
is the leading dimension of the array specified by a. The leading dimension must be greater than zero. If transa is specified as 'N' or 'n', the leading dimension must be greater than or equal to 1. If transa is specified as 'T' or 't', the leading dimension must be greater than or equal to the value specified in m.
b
is the input matrix b of single-precision (for SGEMM) or double-precision (for DGEMM) real values.
ldb
is the leading dimension of the array specified by b. The leading dimension must be greater than zero. If transb is specified as 'N' or 'n', the leading dimension must be greater than or equal to the value specified in m. If transa is specified as 'T' or 't', the leading dimension must be greater than or equal to the value specified in n.
beta
is the scaling constant
c
is the output matrix c of single-precision (for SGEMM) or double-precision (for DGEMM) real values.
ldc
is the leading dimension of the array specified by c. The leading dimension must be greater than zero. If transb is specified as 'N' or 'n', the leading dimension must be greater than or equal to 0 and greater than or equal to the value specified in l.
Note:
Matrix c must have no common elements with matrices a or b; otherwise, the results are unpredictable.

By default, the libxlopt library is linked with any application you compile with XL Fortran. However, if you are using a third-party BLAS library, but want to use the BLAS routines shipped with libxlopt, you must specify the libxlopt library before any other BLAS library on the command line at link time. For example, if your other BLAS library is called libblas, you would compile your code with the following command:

xlf app.f -lxlopt -lblas

The compiler will call the SGEMV, DGEMV, SGEMM, and DGEMM functions from the libxlopt library, and all other BLAS functions in the libblas library.