template<class ArrayT>
Definition at line 73 of file MatMul.h. References DGEMM, ILOG_ERROR, ILOG_VAR, MatE(), MatNrCol(), MatNrRow(), and MatTranspose(). Referenced by MatNorm2DistInternal(), MatNorm2DistSSE(), MatPInv(), MatPseudoInverse(), and MatReplicateMatrixOneRow(). 00074 { 00075 ArrayT* res; 00076 ILOG_VAR(Core.Matrix.MatMul); 00077 00078 if (MatNrCol(m) != MatNrRow(a)) 00079 { 00080 ILOG_ERROR("nonconformant MatMul operands."); 00081 return 0; 00082 } 00083 res = MatCreate<ArrayT>(MatNrRow(m), MatNrCol(a)); 00084 00085 #ifdef BASE_CBLAS 00086 Mat* aa = MatTranspose(a); 00087 for (int i=0 ; i<MatNrRow(m) ; i++) 00088 { 00089 double* rowM = MatE(m, i, 0); 00090 for (int j=0 ; j<MatNrCol(a) ; j++) 00091 { 00092 double* rowAA = MatE(aa, j, 0); 00093 MatStorType sum = 0; 00094 for (int k=0 ; k<MatNrCol(m) ; k++) 00095 { 00096 sum += rowM[k] * rowAA[k]; 00097 } 00098 *MatE(res, i, j) = sum; 00099 } 00100 } 00101 delete aa; 00102 #else 00103 DGEMM(CblasNoTrans, CblasNoTrans, 00104 MatNrRow(m), MatNrCol(a), MatNrRow(a), 00105 1.0, m->PB(), MatNrCol(m), 00106 a->PB(), MatNrCol(a), 00107 0.0, res->PB(), MatNrCol(res)); 00108 #endif 00109 00110 return res; 00111 }
Here is the call graph for this function:
|