Beispiel #1
0
void d_gemm(SEXP rtransa, SEXP rtransb, SEXP ralpha, SEXP ra, SEXP rlda,
	SEXP rb, SEXP rldb, SEXP rbeta, SEXP rc, SEXP rldc)
{
	char
		transa = getTranspose(rtransa),
		transb = getTranspose(rtransb);
	double
		alpha = asReal(ralpha), beta = asReal(rbeta),
		* a, * b, * c;
	int
		m, n, k,
		rowsa, colsa, lda = asInteger(rlda),
		rowsb, colsb, ldb = asInteger(rldb),
		rowsc, colsc, ldc = asInteger(rldc);	
		
	unpackMatrix(ra, &rowsa, &colsa, &a);
	unpackMatrix(rb, &rowsb, &colsb, &b);
	unpackMatrix(rc, &rowsc, &colsc, &c);
	
	m = rowsa;
	n = colsb;
	k = colsa;
	
	if(isTranspose(transa)) {
		m = colsa;
		k = rowsa;
	}
	
	if(isTranspose(transb))
		n = rowsb;
	
	cublasDgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc);
	checkCublasError("d_gemm");
}
char* RMatrix::correctChar() const
 {
    if(isTranspose())
     {
       return &trans;
     }
    else
     {
       return &notConjTrans;
     }
 }