Mentions légales du service

Skip to content
Snippets Groups Projects
Commit cd0a40ad authored by hhakim's avatar hhakim
Browse files

Implement MatBSR::faust_gemm and fix MatBSR::multiplyRight.

parent f72df61f
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,7 @@ namespace Faust ...@@ -42,7 +42,7 @@ namespace Faust
Vect<FPP,Cpu> multiply(const Vect<FPP,Cpu> &v) const; // from LinearOperator Vect<FPP,Cpu> multiply(const Vect<FPP,Cpu> &v) const; // from LinearOperator
void multiply(MatDense<FPP,Cpu> & M, char opThis) const; void multiply(MatDense<FPP,Cpu> & M, char opThis) const;
void multiply(MatSparse<FPP, Cpu>& M, char opThis) const; void multiply(MatSparse<FPP, Cpu>& M, char opThis) const;
void multiplyRight(MatSparse<FPP, Cpu> const& M) ; void multiplyRight(MatSparse<FPP, Cpu> const& M);
void faust_gemm(const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP & alpha, const FPP & beta, char typeA, char typeB)const; // from LinearOperator void faust_gemm(const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP & alpha, const FPP & beta, char typeA, char typeB)const; // from LinearOperator
void transpose(); void transpose();
void conjugate(const bool eval=true); void conjugate(const bool eval=true);
......
...@@ -146,8 +146,8 @@ namespace Faust ...@@ -146,8 +146,8 @@ namespace Faust
bmat.browptr = new int[2]; bmat.browptr = new int[2];
bmat.browptr[0] = 0; bmat.browptr[0] = 0;
bmat.browptr[1] = 1; bmat.browptr[1] = 1;
bmat.m = dmat.rows(); this->dim1 = bmat.m = dmat.rows();
bmat.n = dmat.cols(); this->dim2 = bmat.n = dmat.cols();
bmat.bnnz = 1; bmat.bnnz = 1;
bmat.bm = dmat.rows(); bmat.bm = dmat.rows();
bmat.bn = dmat.cols(); bmat.bn = dmat.cols();
...@@ -158,7 +158,27 @@ namespace Faust ...@@ -158,7 +158,27 @@ namespace Faust
template <typename FPP> template <typename FPP>
void MatBSR<FPP,Cpu>::faust_gemm(const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP & alpha, const FPP & beta, char typeA, char typeB)const // from LinearOperator void MatBSR<FPP,Cpu>::faust_gemm(const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP & alpha, const FPP & beta, char typeA, char typeB)const // from LinearOperator
{ {
MatBSR<FPP, Cpu> this_copy;
MatDense<FPP, Cpu> B_copy(B);
if(typeB == 'T')
B_copy.transpose();
else if(typeB == 'H')
B_copy.adjoint();
if(B.getNBytes() > this->getNBytes())
{
// B is heavier than this
// do the scalar mul on this
this_copy = *this;
this_copy.bmat.mul(alpha);
this_copy.multiply(B_copy, typeA);
}
else
{
B_copy *= alpha;
multiply(B_copy, typeA);
}
C *= beta;
C.add(B_copy);
} }
template <typename FPP> template <typename FPP>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment