Mentions légales du service

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

Fix a bug in Faust::Transform constructor: the first factor must be cloned...

Fix a bug in Faust::Transform constructor: the first factor must be cloned when a lambda scalar is passed even if cloning_fact is false.
parent 60edffa4
Branches
Tags
No related merge requests found
...@@ -192,18 +192,27 @@ Faust::Transform<FPP,Cpu>::Transform(const std::vector<Faust::MatGeneric<FPP,Cpu ...@@ -192,18 +192,27 @@ Faust::Transform<FPP,Cpu>::Transform(const std::vector<Faust::MatGeneric<FPP,Cpu
totalNonZeros(0) totalNonZeros(0)
{ {
data.resize(facts.size()); data.resize(facts.size());
for (int i=0 ; i<data.size() ; i++) if(data.size() > 0) {
{ if(cloning_fact || lambda_ != FPP(1.0))
if(cloning_fact) {
data[i]=facts[i]->Clone(optimizedCopy); data[0] = facts[0]->Clone(optimizedCopy);
}
else else
data[i] = facts[i]; data[0] = facts[0];
totalNonZeros += data[i]->getNonZeros(); totalNonZeros += data[0]->getNonZeros();
} for (int i=1 ; i<data.size() ; i++)
{
if(cloning_fact)
data[i]=facts[i]->Clone(optimizedCopy);
else
data[i] = facts[i];
totalNonZeros += data[i]->getNonZeros();
}
if(lambda_ != FPP(1.0) && data.size()>0) if(lambda_ != FPP(1.0))
(*data[0]) *= lambda_; (*data[0]) *= lambda_;
}
#ifdef __COMPILE_TIMERS__ #ifdef __COMPILE_TIMERS__
this->t_multiply_vector.resize(data.size()); this->t_multiply_vector.resize(data.size());
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment