kusano 7d535a
kusano 7d535a
/*! @file csp_blas3.c
kusano 7d535a
 * \brief Sparse BLAS3, using some dense BLAS3 operations
kusano 7d535a
 *
kusano 7d535a
 * 
kusano 7d535a
 * -- SuperLU routine (version 2.0) --
kusano 7d535a
 * Univ. of California Berkeley, Xerox Palo Alto Research Center,
kusano 7d535a
 * and Lawrence Berkeley National Lab.
kusano 7d535a
 * November 15, 1997
kusano 7d535a
 * 
kusano 7d535a
 */
kusano 7d535a
/*
kusano 7d535a
 * File name:		sp_blas3.c
kusano 7d535a
 * Purpose:		Sparse BLAS3, using some dense BLAS3 operations.
kusano 7d535a
 */
kusano 7d535a
kusano 7d535a
#include "slu_cdefs.h"
kusano 7d535a
kusano 7d535a
/*! \brief
kusano 7d535a
 *
kusano 7d535a
 * 
kusano 7d535a
 * Purpose   
kusano 7d535a
 *   =======   
kusano 7d535a
 * 
kusano 7d535a
 *   sp_c performs one of the matrix-matrix operations   
kusano 7d535a
 * 
kusano 7d535a
 *      C := alpha*op( A )*op( B ) + beta*C,   
kusano 7d535a
 * 
kusano 7d535a
 *   where  op( X ) is one of 
kusano 7d535a
 * 
kusano 7d535a
 *      op( X ) = X   or   op( X ) = X'   or   op( X ) = conjg( X' ),
kusano 7d535a
 * 
kusano 7d535a
 *   alpha and beta are scalars, and A, B and C are matrices, with op( A ) 
kusano 7d535a
 *   an m by k matrix,  op( B )  a  k by n matrix and  C an m by n matrix. 
kusano 7d535a
 *   
kusano 7d535a
 * 
kusano 7d535a
 *   Parameters   
kusano 7d535a
 *   ==========   
kusano 7d535a
 * 
kusano 7d535a
 *   TRANSA - (input) char*
kusano 7d535a
 *            On entry, TRANSA specifies the form of op( A ) to be used in 
kusano 7d535a
 *            the matrix multiplication as follows:   
kusano 7d535a
 *               TRANSA = 'N' or 'n',  op( A ) = A.   
kusano 7d535a
 *               TRANSA = 'T' or 't',  op( A ) = A'.   
kusano 7d535a
 *               TRANSA = 'C' or 'c',  op( A ) = conjg( A' ).   
kusano 7d535a
 *            Unchanged on exit.   
kusano 7d535a
 * 
kusano 7d535a
 *   TRANSB - (input) char*
kusano 7d535a
 *            On entry, TRANSB specifies the form of op( B ) to be used in 
kusano 7d535a
 *            the matrix multiplication as follows:   
kusano 7d535a
 *               TRANSB = 'N' or 'n',  op( B ) = B.   
kusano 7d535a
 *               TRANSB = 'T' or 't',  op( B ) = B'.   
kusano 7d535a
 *               TRANSB = 'C' or 'c',  op( B ) = conjg( B' ).   
kusano 7d535a
 *            Unchanged on exit.   
kusano 7d535a
 * 
kusano 7d535a
 *   M      - (input) int   
kusano 7d535a
 *            On entry,  M  specifies  the number of rows of the matrix 
kusano 7d535a
 *	     op( A ) and of the matrix C.  M must be at least zero. 
kusano 7d535a
 *	     Unchanged on exit.   
kusano 7d535a
 * 
kusano 7d535a
 *   N      - (input) int
kusano 7d535a
 *            On entry,  N specifies the number of columns of the matrix 
kusano 7d535a
 *	     op( B ) and the number of columns of the matrix C. N must be 
kusano 7d535a
 *	     at least zero.
kusano 7d535a
 *	     Unchanged on exit.   
kusano 7d535a
 * 
kusano 7d535a
 *   K      - (input) int
kusano 7d535a
 *            On entry, K specifies the number of columns of the matrix 
kusano 7d535a
 *	     op( A ) and the number of rows of the matrix op( B ). K must 
kusano 7d535a
 *	     be at least  zero.   
kusano 7d535a
 *           Unchanged on exit.
kusano 7d535a
 *      
kusano 7d535a
 *   ALPHA  - (input) complex
kusano 7d535a
 *            On entry, ALPHA specifies the scalar alpha.   
kusano 7d535a
 * 
kusano 7d535a
 *   A      - (input) SuperMatrix*
kusano 7d535a
 *            Matrix A with a sparse format, of dimension (A->nrow, A->ncol).
kusano 7d535a
 *            Currently, the type of A can be:
kusano 7d535a
 *                Stype = NC or NCP; Dtype = SLU_C; Mtype = GE. 
kusano 7d535a
 *            In the future, more general A can be handled.
kusano 7d535a
 * 
kusano 7d535a
 *   B      - COMPLEX PRECISION array of DIMENSION ( LDB, kb ), where kb is 
kusano 7d535a
 *            n when TRANSB = 'N' or 'n',  and is  k otherwise.   
kusano 7d535a
 *            Before entry with  TRANSB = 'N' or 'n',  the leading k by n 
kusano 7d535a
 *            part of the array B must contain the matrix B, otherwise 
kusano 7d535a
 *            the leading n by k part of the array B must contain the 
kusano 7d535a
 *            matrix B.   
kusano 7d535a
 *            Unchanged on exit.   
kusano 7d535a
 * 
kusano 7d535a
 *   LDB    - (input) int
kusano 7d535a
 *            On entry, LDB specifies the first dimension of B as declared 
kusano 7d535a
 *            in the calling (sub) program. LDB must be at least max( 1, n ).  
kusano 7d535a
 *            Unchanged on exit.   
kusano 7d535a
 * 
kusano 7d535a
 *   BETA   - (input) complex
kusano 7d535a
 *            On entry, BETA specifies the scalar beta. When BETA is   
kusano 7d535a
 *            supplied as zero then C need not be set on input.   
kusano 7d535a
 *  
kusano 7d535a
 *   C      - COMPLEX PRECISION array of DIMENSION ( LDC, n ).   
kusano 7d535a
 *            Before entry, the leading m by n part of the array C must 
kusano 7d535a
 *            contain the matrix C,  except when beta is zero, in which 
kusano 7d535a
 *            case C need not be set on entry.   
kusano 7d535a
 *            On exit, the array C is overwritten by the m by n matrix 
kusano 7d535a
 *	     ( alpha*op( A )*B + beta*C ).   
kusano 7d535a
 *  
kusano 7d535a
 *   LDC    - (input) int
kusano 7d535a
 *            On entry, LDC specifies the first dimension of C as declared 
kusano 7d535a
 *            in the calling (sub)program. LDC must be at least max(1,m).   
kusano 7d535a
 *            Unchanged on exit.   
kusano 7d535a
 *  
kusano 7d535a
 *   ==== Sparse Level 3 Blas routine.   
kusano 7d535a
 * 
kusano 7d535a
 */
kusano 7d535a
kusano 7d535a
int
kusano 7d535a
sp_cgemm(char *transa, char *transb, int m, int n, int k, 
kusano 7d535a
         complex alpha, SuperMatrix *A, complex *b, int ldb, 
kusano 7d535a
         complex beta, complex *c, int ldc)
kusano 7d535a
{
kusano 7d535a
    int    incx = 1, incy = 1;
kusano 7d535a
    int    j;
kusano 7d535a
kusano 7d535a
    for (j = 0; j < n; ++j) {
kusano 7d535a
	sp_cgemv(transa, alpha, A, &b[ldb*j], incx, beta, &c[ldc*j], incy);
kusano 7d535a
    }
kusano 7d535a
    return 0;    
kusano 7d535a
}