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

`sgemv`(single-precision) and`dgemv`(double-precision), which compute the matrix-vector product for a general matrix or its transpose`sgemm`(single-precision) and`dgemm`(double-precision), which perform combined matrix multiplication and addition for general matrices or their transposes

Because the BLAS routines are written in Fortran, all parameters are passed to them by reference, and all arrays are stored in column-major order.

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 prototypes and parameters for the XL C/C++ BLAS functions. The interfaces for these functions 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 C/C++ `libxlopt` library if you are also using a third-party BLAS library.

The prototypes for the `sgemv` and `dgemv` functions
are as follows:

void sgemv(const char *trans, int *m, int *n, float *alpha, void *a, int *lda, void *x, int *incx, float *beta, void *y, int *incy);

void dgemv(const char *trans, int *m, int *n, double *alpha, void *a, int *lda, void *x, int *incx, double *beta, void *y, int *incy);

The parameters are as follows:

`trans`- is a single character indicating the form of the input matrix
`a`, where:`'N'`or`'n'`indicates that`a`is to be used in the computation`'T'`or`'t'`indicates that the transpose of`a`is to be used in the computation

`m`- represents:
- the number of rows in input matrix
`a` - the length of vector
`y`, if`'N'`or`'n'`is used for the`trans`parameter - the length of vector
`x`, if`'T'`or`'t'`is used for the`trans`parameter

`lda`) - the number of rows in input matrix
`n`- represents:
- the number of columns in input matrix
`a` - the length of vector
`x`, if`'N'`or`'n'`is used for the`trans`parameter - the length of vector
`y`, if`'T'`or`'t'`is used for the`trans`parameter

- the number of columns in input matrix
`alpha`- is the scaling constant for matrix
`a` `a`- is the input matrix of
`float`(for`sgemv`) or`double`(for`dgemv`) 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
`float`(for`sgemv`) or`double`(for`dgemv`) values. `incx`- is the stride for vector
`x`. It can have any value. `beta`- is the scaling constant for vector
`y` `y`- is the output vector of
`float`(for`sgemv`) or`double`(for`dgemv`) 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:

void sgemm(const char *transa, const char *transb, int *l, int *n, int *m, float *alpha, const void *a, int *lda, void *b, int *ldb, float *beta, void *c, int *ldc);

void dgemm(const char *transa, const char *transb, int *l, int *n, int *m, double *alpha, const void *a, int *lda, void *b, int *ldb, double *beta, void *c, int *ldc);

The parameters are as follows:

`transa`- is a single character indicating the form of the input matrix
`a`, where:`'N'`or`'n'`indicates that`a`is to be used in the computation`'T'`or`'t'`indicates that the transpose of`a`is to be used in the computation

`transb`- is a single character indicating the form of the input matrix
`b`, where:`'N'`or`'n'`indicates that`b`is to be used in the computation`'T'`or`'t'`indicates that the transpose of`b`is to be used in the computation

`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:
- the number of columns in matrix
`a`, if`'N'`or`'n'`is used for the`transa`parameter - the number of rows in matrix
`a`, if`'T'`or`'t'`is used for the`transa`parameter

- the number of rows in matrix
`b`, if`'N'`or`'n'`is used for the`transb`parameter - the number of columns in matrix
`b`, if`'T'`or`'t'`is used for the`transb`parameter

`m`must be greater than or equal to zero. - the number of columns in matrix
`alpha`- is the scaling constant for matrix
`a` `a`- is the input matrix
`a`of`float`(for`sgemm`) or`double`(for`dgemm`) 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`float`(for`sgemm`) or`double`(for`dgemm`) 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 for matrix
`c` `c`- is the output matrix
`c`of`float`(for`sgemm`) or`double`(for`dgemm`) 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 C/C++. 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:

xlc app.c -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.