void BLASInterface::Mul(const dMatrix& A,const dMatrix& B,dMatrix& X) { X.resize(A.m,B.n); X.setZero(); if(X.isRowMajor()) std::swap(X.istride,X.jstride); Madd(A,B,X); }
void Madd(const dMatrix& A,const dVector& x,dVector& y,double alpha,double beta,bool transpose) { if(A.isRowMajor()) { Assert(A.jstride == 1); transpose = !transpose; } else { Assert(A.istride == 1); //Assert(IsCompliant(A)); } //Assert(IsCompliant(A)); Assert(x.n == A.n); Assert(y.n == A.m); integer m=A.m; integer n=A.n; integer lda=A.m; integer xinc=x.stride; integer yinc=y.stride; char trans = (transpose?'T':'N'); dgemv_(&trans,&m,&n,&alpha,A.getStart(),&lda,x.getStart(),&xinc,&beta,y.getStart(),&yinc); }
bool IsCompliant(const dMatrix& A) { return (!A.isRowMajor() && A.istride == 1); }