Olumide
unread,Apr 5, 2011, 7:43:35 PM4/5/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to matrixprogramming
I'm trying to call the Matrix-Matrix computation subroutine DGEMM from
C++ as follows:
double* dgemm( int _numRowA , int _numColA , double* _A , int
_numRowB , int _numColB , double* _B , int& _numRowC , int& _numColC )
{
if( _numColA != _numRowB )
{
std::cout << "number of columns of Matrix A is NOT equal to num of
rows of Matrix B" << std::endl;
return NULL;
}
_numRowC = _numRowA;
_numColC = _numColB;
char trans = 'N';
double alpha = 1.0 , beta = 1.0;
double *C = new double [ _numRowC * _numColC ];
int lda = ( _numRowA >= _numColA ) ? _numRowA : _numColA;
int ldb = ( _numRowB >= _numColB ) ? _numRowB : _numColB;
int ldc = ( _numRowC >= _numColC ) ? _numRowC : _numColC;
DGEMM( &trans , &trans , &_numRowA , &_numColB , &_numColA , &alpha ,
_A , &lda , _B , &ldb , &beta , C , &ldc );
return C;
}
where _A and _B are the matrices I'd like to multiply, and _dim* are
their dimensions. Unfortunately I'm getting gibberish results. What am
I doing wrong?
Thanks.