Mentions légales du service

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

Fix variable length arrays on stack by using arrays on heap (issue #173)

parent a3fe9b6a
No related merge requests found
......@@ -222,10 +222,11 @@ void doit(HierarchicalFact<FPP,Cpu,FPP2>* hierFact, int argc, FPP expectedLambda
//relativeError 2
Faust::MatDense<FPP,Cpu> lapProduct, lapErr;
const Faust::MatDense<FPP,Cpu>& D(hierFactFFT->get_D());
FPP testD[Lap.getNbRow()];
FPP *testD = new FPP[Lap.getNbRow()];
hierFactFFT->get_D(testD);
for(int i=0;i<Lap.getNbRow();i++)
assert(testD[i] == D(i,i));
delete[] testD;
lapErr = hierFactCore.get_product();
lapProduct = hierFactCore.get_product();
lapProduct.transpose();
......
......@@ -55,10 +55,11 @@ int main()
diagMat.conjugate();
display_all_elts(diagMat);
cout << "vec mul.:" << endl;
FPP vec_data[diagMat.getNbCol()];
FPP *vec_data = new FPP[diagMat.getNbCol()];
for(int i=0;i<diagMat.getNbCol();i++)
vec_data[i] = FPP(i);
const Faust::Vect<FPP,Cpu> v(diagMat.getNbCol(), vec_data);
delete[] vec_data;
Faust::Vect<FPP,Cpu> vr = diagMat.multiply(v);
vr.Display();
cout << "mat. mul.:" << endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment