sgemm(3S)
SGEMM, DGEMM, CGEMM, ZGEMM - Multiplies a real or complex general matrix by a real or complex general matrix
Showing IRIX 6.5.30 (default release). Added in IRIX 6.5.15.
NAME SGEMM, DGEMM, CGEMM, ZGEMM - Multiplies a real or complex general matrix by a real or complex general matrix SYNOPSIS Single precision Fortran: CALL SGEMM (transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc) C/C++: #include <scsl_blas.h> void sgemm (char *transa, char *transb, int m, int n, int k, float alpha, float *a, int lda, float *b, int ldb, float beta, float *c, int ldc); Double precision Fortran: CALL DGEMM (transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc) C/C++: #include <scsl_blas.h> void dgemm (char *transa, char *transb, int m, int n, int k, double alpha, double *a, int lda, double *b, int ldb, double beta, double *c, int ldc); Single precision complex Fortran: CALL CGEMM (transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc) C/C++: #include <scsl_blas.h> void cgemm (char *transa, char *transb, int m, int n, int k, scsl_complex *alpha, scsl_complex *a, int lda, scsl_complex *b, int ldb, scsl_complex *beta, scsl_complex *c, int ldc); C++ STL: #include <complex.h> #include <scsl_blas.h> void cgemm (char *transa, char *transb, int m, int n, int k, complex<float> *alpha, complex<float> *a, int lda, complex<float> *b, int ldb, complex<float> *beta, complex<float> *c, int ldc); Double precision complex Fortran: CALL ZGEMM (transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc) C/C++: #include <scsl_blas.h> void zgemm (char *transa, char *transb, int m, int n, int k, scsl_zomplex *alpha, scsl_zomplex *a, int lda, scsl_zomplex *b, int ldb, scsl_zomplex *beta, scsl_zomplex *c, int ldc); C++ STL: #include <complex.h> #include <scsl_blas.h> void zgemm (char *transa, char *transb, int m, int n, int k, complex<double> *alpha, complex<double> *a, int lda, complex<double> *b, int ldb, complex<double> *beta, complex<double> *c, int ldc); IMPLEMENTATION These routines are part of the SCSL Scientific Library and can be loaded using either the -lscs or the -lscs_mp option. The -lscs_mp option directs the linker to use the multi-processor version of the library. When linking to SCSL with -lscs or -lscs_mp, the default integer size is 4 bytes (32 bits). Another version of SCSL is available in which integers are 8 bytes (64 bits). This version allows the user access to larger memory sizes and helps when porting legacy Cray codes. It can be loaded by using the -lscs_i8 option or the -lscs_i8_mp option. A program may use only one of the two versions; 4-byte integer and 8-byte integer library calls cannot be mixed. The C and C++ prototypes shown above are appropriate for the 4-byte integer version of SCSL. When using the 8-byte integer version, the variables of type int become long long and the <scsl_blas_i8.h> header file should be included. DESCRIPTION SGEMM and DGEMM multiply a real general matrix by a real general matrix. CGEMM and ZGEMM multiply a complex general matrix by a complex general matrix. These routines perform one of the matrix-matrix operations: C <- alpha op(A) op(B) + beta C where op(X) is one of the following: op(X) = X op(X) = XT op(X) = XH (CGEMM and ZGEMM only) where * alpha and beta are scalars * A, B, and C are matrices * op(A) is an m-by-k matrix * op(B) is a k-by-n matrix * C is an m-by-n matrix. * X T is the transpose of x * XH is the conjugate transpose of X. See the NOTES section of this man page for information about the interpretation of the data types described in the following arguments. These routines have the following arguments: transa Character. (input) Specifies the form of op(A) to be used in the matrix multiplication, as follows: transa = 'N' or 'n': op(A) = A transa = 'T' or 't': op(A) = A T transa = 'C' or 'c': op(A) = A T (SGEMM and DGEMM), or op(A) = AH (CGEMM and ZGEMM) For C/C++, a pointer to this character is passed. transb Character. (input) Specifies the form of op(B) to be used in the matrix multiplication, as follows: transb = 'N' or 'n': op(B) = B transb = 'T' or 't': op(B) = BT transb = 'C' or 'c': op(B) = BT (SGEMM and DGEMM), or op(B) = BH (CGEMM and ZGEMM) For C/C++, a pointer to this character is passed. m Integer. (input) Specifies the number of rows in matrix op(A) and in matrix C. m must be >= 0. n Integer. (input) Specifies the number of columns in matrix op(B) and in matrix C. n must be >= 0. k Integer. (input) Specifies the number of columns of matrix op(A) and the number of rows of matrix op(B). k must be >= 0. alpha First scalar factor. (input) SGEMM: Single precision. DGEMM: Double precision. CGEMM: Single precision complex. ZGEMM: Double precision complex. For C/C++, a pointer to this scalar is passed when alpha is complex; otherwise, alpha is passed by value. a Array of dimension (lda,ka). (input) SGEMM: Single precision array. DGEMM: Double precision array. CGEMM: Single precision complex array. ZGEMM: Double precision complex array. When transa = 'N' or 'n', ka is k; otherwise, it is m. Contains the matrix A. Before entry with transa = 'N' or 'n', the leading m-by-k part of array a must contain matrix A; otherwise, the leading k-by-m part of array a must contain matrix A. lda Integer. (input) Specifies the first dimension of a as declared in the calling program. When transa = 'N' or 'n', lda >= MAX(1,m); otherwise, lda >= MAX(1,k). b Array of dimension (ldb,kb). (input) SGEMM: Single precision array. DGEMM: Double precision array. CGEMM: Single precision complex array. ZGEMM: Double precision complex array. When transb = 'N' or 'n', kb is n; otherwise, it is k. Contains the matrix B. Before entry with transb = 'N' or 'n', the leading k-by-n part of array b must contain matrix B; otherwise, the leading n-by-k part of array b must contain matrix B. ldb Integer. (input) Specifies the first dimension of b as declared in the calling program. When transb = 'N' or 'n', ldb >= MAX(1,k); otherwise, ldb >= MAX(1,n). beta Scalar factor. (input) SGEMM: Single precision. DGEMM: Double precision. CGEMM: Single precision complex. ZGEMM: Double precision complex. When beta is supplied as 0, c need not be set on input. For C/C++, a pointer to this scalar is passed when beta is complex; otherwise, beta is passed by value. c Array of dimension (ldc,n). (input and output) SGEMM: Single precision array. DGEMM: Double precision array. CGEMM: Single precision complex array. ZGEMM: Double precision complex array. Contains the matrix C. Before entry, the leading m-by-n part of array c must contain matrix C, except when beta is 0; in which case, c need not be set. On exit, the m-by-n result matrix overwrites array c. ldc Integer. (input) Specifies the first dimension of c as declared in the calling program. ldc >= MAX(1,m). NOTES These routines are Level 3 Basic Linear Algebra Subprograms (Level 3 BLAS). Data Types The following data types are described in this documentation: Term Used Data type Fortran: Array dimensioned n x(n) Array of dimensions (m,n) x(m,n) Character CHARACTER Integer INTEGER (INTEGER*8 for -lscs_i8[_mp]) Single precision REAL Double precision DOUBLE PRECISION Single precision complex COMPLEX Double precision complex DOUBLE COMPLEX C/C++: Array dimensioned n x[n] Array of dimensions (m,n) x[m*n] Character char Integer int (long long for -lscs_i8[_mp]) Single precision float Double precision double Single precision complex scsl_complex Double precision complex scsl_zomplex C++ STL: Array dimensioned n x[n] Array of dimensions (m,n) x[m*n] Character char Integer int (long long for -lscs_i8[_mp]) Single precision float Double precision double Single precision complex complex<float> Double precision complex complex<double> Note that you can explicitly declare multidimensional C/C++ arrays provided that the array dimensions are swapped with respect to the Fortran declaration (e.g., x[n][m] in C/C++ versus x(m,n) in Fortran). To avoid a compiler type mismatch error in C++ (or a compiler warning message in C), however, the array should be cast to a pointer of the appropriate type when passed as an argument to a SCSL routine. SEE ALSO DGEMMS(3S) to multiply general matrices by using Strassen's algorithm INTRO_SCSL(3S), INTRO_BLAS3(3S) INTRO_CBLAS(3S) for information about using the C interface to Fortran 77 Basic Linear Algebra Subprograms (legacy BLAS) set forth by the Basic Linear Algebra Subprograms Technical Forum.