- Code: Select all
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. Unfortunately I'm getting gibberish results. What am I doing wrong?
Thanks.

