BLAS function syntax

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 input matrix a, where:
  • 'N' or 'n' indicates that a is to be used in computation
  • 'T' or 't' indicates that the transpose of a is to be used in 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
The number of rows must be greater than or equal to zero, and less than the leading dimension of matrix a (specified in lda)
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 must be greater than or equal to zero.
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 input matrix a, where:
  • 'N' or 'n' indicates that a is to be used in computation
  • 'T' or 't' indicates that the transpose of a is to be used in computation
transb
is a single character indicating the form of input matrix b, where:
  • 'N' or 'n' indicates that b is to be used in computation
  • 'T' or 't' indicates that the transpose of b is to be used in 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
and:
  • 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.
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.


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us