Mentions légales du service

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

Fix and optimize C++ optimize_storage.

- A bad if-condition made impossible to convert any factor to dense.
- The factors were copied even if the format wasn't changed (now just the matrix is shared between the new and old Faust).
parent c7b66531
Branches
Tags 3.5.5
No related merge requests found
Pipeline #834183 skipped
...@@ -411,13 +411,13 @@ namespace Faust ...@@ -411,13 +411,13 @@ namespace Faust
else else
{ // storage size is the main criterion { // storage size is the main criterion
sparse_weight = fac->getNonZeros()*(sizeof(FPP)+sizeof(int))+(fac->getNbRow()+1)*sizeof(int); sparse_weight = fac->getNonZeros()*(sizeof(FPP)+sizeof(int))+(fac->getNbRow()+1)*sizeof(int);
if(sparse_weight <= fac->getNBytes()) if(sparse_weight < fac->getNBytes())
{ {
// choose CSR format // choose CSR format
if(dfac) if(dfac)
opt_factors.push_back(new Faust::MatSparse<FPP, DEV>(*dfac)); opt_factors.push_back(new Faust::MatSparse<FPP, DEV>(*dfac));
else else
opt_factors.push_back(new Faust::MatSparse<FPP, DEV>(*sfac)); opt_factors.push_back(fac);
} }
else else
{ {
...@@ -425,11 +425,11 @@ namespace Faust ...@@ -425,11 +425,11 @@ namespace Faust
if(sfac) if(sfac)
opt_factors.push_back(new Faust::MatDense<FPP, DEV>(*sfac)); opt_factors.push_back(new Faust::MatDense<FPP, DEV>(*sfac));
else else
opt_factors.push_back(new Faust::MatDense<FPP, DEV>(*dfac)); opt_factors.push_back(fac);
} }
} }
} }
TransformHelper<FPP,DEV> *pth = new TransformHelper<FPP,DEV>(opt_factors, 1, false, false, true); TransformHelper<FPP,DEV> *pth = new TransformHelper<FPP,DEV>(opt_factors, FPP(1), false, false, true);
return pth; return pth;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment