Mentions légales du service

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

Add Faust::transform() constructor for definition by MatSparse factors and fix...

Add Faust::transform() constructor for definition by MatSparse factors and fix bug in scalarMultiply().

Precision about the bug: pointer on matrix was multiplied instead of matrix itself.
parent 0a3386ac
No related branches found
No related tags found
No related merge requests found
......@@ -109,6 +109,7 @@ namespace Faust
/** \brief Constructor
* \param facts : Vector including dense matrix*/
Transform(const std::vector<Faust::MatDense<FPP,Cpu> >&facts, const bool optimizedCopy=false);
Transform(const std::vector<Faust::MatSparse<FPP,Cpu> >&facts, const bool optimizedCopy=false);
//void get_facts(std::vector<Faust::MatSparse<FPP,Cpu> >& sparse_facts)const{sparse_facts = data;}
//void get_facts(std::vector<Faust::MatDense<FPP,Cpu> >& facts)const;
......
......@@ -223,6 +223,18 @@ Faust::Transform<FPP,Cpu>::Transform(const std::vector<Faust::MatDense<FPP,Cpu>
}
template<typename FPP>
Faust::Transform<FPP,Cpu>::Transform(const std::vector<Faust::MatSparse<FPP,Cpu> >& facts, const bool optimizedCopy /*default value = false*/ ): data(std::vector<Faust::MatGeneric<FPP,Cpu>*>()),
totalNonZeros(0)
{
data.resize(facts.size());
for (int i=0 ; i<data.size() ; i++)
{
data[i]=facts[i].Clone(optimizedCopy);
totalNonZeros += data[i]->getNonZeros();
}
}
template<typename FPP>
Faust::Transform<FPP,Cpu>::Transform(const Transform<FPP, Cpu>* A, const bool transpose_A, const bool conj_A, const Transform<FPP, Cpu>* B, const bool transpose_B, const bool conj_B):
data(std::vector<Faust::MatGeneric<FPP,Cpu>*>()), totalNonZeros(0)
......@@ -358,7 +370,7 @@ void Faust::Transform<FPP, Cpu>::save_mat_file(const char* filename, bool transp
void Faust::Transform<FPP,Cpu>::scalarMultiply(const FPP scalar)
{
if (size() > 0)
data[0]*=scalar;
*(data[0])*=scalar;
else
handleError(m_className,"scalarMultiply : empty faust can't be multiplied ");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment