Mentions légales du service

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

Optimize TransformHelperPoly::multiply(MatSparse) (Faust factor not created to...

Optimize TransformHelperPoly::multiply(MatSparse) (Faust factor not created to compute the multiplication).
parent d8bdcab1
No related branches found
No related tags found
No related merge requests found
...@@ -129,6 +129,7 @@ namespace Faust ...@@ -129,6 +129,7 @@ namespace Faust
void basisChebyshev_all(); void basisChebyshev_all();
void create_rR(const MatSparse<FPP,Cpu>* L); void create_rR(const MatSparse<FPP,Cpu>* L);
~TransformHelperPoly(); ~TransformHelperPoly();
friend TransformHelper<FPP,Cpu>* basisChebyshev<>(MatSparse<FPP,Cpu>* L, int32_t K, MatSparse<FPP, Cpu>* T0, BasisLaziness lazy_instantiation); friend TransformHelper<FPP,Cpu>* basisChebyshev<>(MatSparse<FPP,Cpu>* L, int32_t K, MatSparse<FPP, Cpu>* T0, BasisLaziness lazy_instantiation);
}; };
......
...@@ -224,13 +224,23 @@ namespace Faust ...@@ -224,13 +224,23 @@ namespace Faust
template<typename FPP> template<typename FPP>
MatDense<FPP, Cpu> TransformHelperPoly<FPP>::multiply(const MatSparse<FPP,Cpu> &A, const bool transpose/*=false*/, const bool conjugate/*=false*/) MatDense<FPP, Cpu> TransformHelperPoly<FPP>::multiply(const MatSparse<FPP,Cpu> &A, const bool transpose/*=false*/, const bool conjugate/*=false*/)
{ {
//TODO: optimize, could specialize the mul as it has been done for Vect/MatDense MatDense<FPP, Cpu> M(this->getNbRow(), A.getNbCol());
auto this_ = const_cast<TransformHelperPoly<FPP>*>(this); M.setZeros();
this_->basisChebyshev_fact_all(); vector<int> col_ids;
auto ret = TransformHelper<FPP, Cpu>::multiply(A); for(int i=0;i<A.getNonZeros();i++)
if(this_->laziness == INSTANTIATE_COMPUTE_AND_FREE) {
this_->basisChebyshev_free_fact_all(); auto id = A.getColInd()[i];
return ret; if(std::find(std::begin(col_ids), std::end(col_ids), id) == std::end(col_ids))
col_ids.push_back(id);
}
#pragma omp parallel for
for(auto i=col_ids.begin(); i < col_ids.end();i++)
{
auto id = *i;
auto vect = A.get_col(id);
this->multiply(vect.getData(), M.getData()+M.getNbRow()*id, transpose, conjugate);
}
return M;
} }
template<typename FPP> template<typename FPP>
...@@ -612,8 +622,8 @@ namespace Faust ...@@ -612,8 +622,8 @@ namespace Faust
else else
{ {
nnz += this->L->getNonZeros(); nnz += this->L->getNonZeros();
if(rid < this->size()-1) if(rid < this->size()-2)
nnz += (this->size()-rid-2)*L->getNbRow(); nnz += (this->size()-rid-1)*L->getNbRow();
} }
return nnz; return nnz;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment