Blender V2.61 - r43446

ssp_blas3.c

Go to the documentation of this file.
00001 
00006 /*
00007  * -- SuperLU routine (version 2.0) --
00008  * Univ. of California Berkeley, Xerox Palo Alto Research Center,
00009  * and Lawrence Berkeley National Lab.
00010  * November 15, 1997
00011  *
00012  */
00013 /*
00014  * File name:       sp_blas3.c
00015  * Purpose:     Sparse BLAS3, using some dense BLAS3 operations.
00016  */
00017 
00018 #include "ssp_defs.h"
00019 #include "util.h"
00020 
00021 int
00022 sp_sgemm(char *transa, int n, 
00023          float alpha, SuperMatrix *A, float *b, int ldb, 
00024          float beta, float *c, int ldc)
00025 {
00026 /*  Purpose   
00027     =======   
00028 
00029     sp_s performs one of the matrix-matrix operations   
00030 
00031        C := alpha*op( A )*op( B ) + beta*C,   
00032 
00033     where  op( X ) is one of 
00034 
00035        op( X ) = X   or   op( X ) = X'   or   op( X ) = conjg( X' ),
00036 
00037     alpha and beta are scalars, and A, B and C are matrices, with op( A ) 
00038     an m by k matrix,  op( B )  a  k by n matrix and  C an m by n matrix. 
00039   
00040 
00041     Parameters   
00042     ==========   
00043 
00044     TRANSA - (input) char*
00045              On entry, TRANSA specifies the form of op( A ) to be used in 
00046              the matrix multiplication as follows:   
00047                 TRANSA = 'N' or 'n',  op( A ) = A.   
00048                 TRANSA = 'T' or 't',  op( A ) = A'.   
00049                 TRANSA = 'C' or 'c',  op( A ) = conjg( A' ).   
00050              Unchanged on exit.   
00051 
00052     TRANSB - (input) char*
00053              On entry, TRANSB specifies the form of op( B ) to be used in 
00054              the matrix multiplication as follows:   
00055                 TRANSB = 'N' or 'n',  op( B ) = B.   
00056                 TRANSB = 'T' or 't',  op( B ) = B'.   
00057                 TRANSB = 'C' or 'c',  op( B ) = conjg( B' ).   
00058              Unchanged on exit.   
00059 
00060     M      - (input) int   
00061              On entry,  M  specifies  the number of rows of the matrix 
00062          op( A ) and of the matrix C.  M must be at least zero. 
00063          Unchanged on exit.   
00064 
00065     N      - (input) int
00066              On entry,  N specifies the number of columns of the matrix 
00067          op( B ) and the number of columns of the matrix C. N must be 
00068          at least zero.
00069          Unchanged on exit.   
00070 
00071     K      - (input) int
00072              On entry, K specifies the number of columns of the matrix 
00073          op( A ) and the number of rows of the matrix op( B ). K must 
00074          be at least  zero.   
00075              Unchanged on exit.
00076          
00077     ALPHA  - (input) float
00078              On entry, ALPHA specifies the scalar alpha.   
00079 
00080     A      - (input) SuperMatrix*
00081              Matrix A with a sparse format, of dimension (A->nrow, A->ncol).
00082              Currently, the type of A can be:
00083                  Stype = NC or NCP; Dtype = SLU_S; Mtype = GE. 
00084              In the future, more general A can be handled.
00085 
00086     B      - FLOAT PRECISION array of DIMENSION ( LDB, kb ), where kb is 
00087              n when TRANSB = 'N' or 'n',  and is  k otherwise.   
00088              Before entry with  TRANSB = 'N' or 'n',  the leading k by n 
00089              part of the array B must contain the matrix B, otherwise 
00090              the leading n by k part of the array B must contain the 
00091              matrix B.   
00092              Unchanged on exit.   
00093 
00094     LDB    - (input) int
00095              On entry, LDB specifies the first dimension of B as declared 
00096              in the calling (sub) program. LDB must be at least max( 1, n ).  
00097              Unchanged on exit.   
00098 
00099     BETA   - (input) float
00100              On entry, BETA specifies the scalar beta. When BETA is   
00101              supplied as zero then C need not be set on input.   
00102 
00103     C      - FLOAT PRECISION array of DIMENSION ( LDC, n ).   
00104              Before entry, the leading m by n part of the array C must 
00105              contain the matrix C,  except when beta is zero, in which 
00106              case C need not be set on entry.   
00107              On exit, the array C is overwritten by the m by n matrix 
00108          ( alpha*op( A )*B + beta*C ).   
00109 
00110     LDC    - (input) int
00111              On entry, LDC specifies the first dimension of C as declared 
00112              in the calling (sub)program. LDC must be at least max(1,m).   
00113              Unchanged on exit.   
00114 
00115     ==== Sparse Level 3 Blas routine.   
00116 */
00117     int    incx = 1, incy = 1;
00118     int    j;
00119 
00120     for (j = 0; j < n; ++j) {
00121     sp_sgemv(transa, alpha, A, &b[ldb*j], incx, beta, &c[ldc*j], incy);
00122     }
00123     return 0;    
00124 }