Mentions légales du service

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

Add new function GivensFGFT::compute_fourier() to return the fourier matrix approximate.

parent d7987512
No related branches found
No related tags found
No related merge requests found
......@@ -67,8 +67,19 @@ int main()
Faust::MatDense<FPP,Cpu> full_D = Faust::MatDense<FPP,Cpu>(D);
cout << "D fro norm:" << D.norm() << endl;
Faust::MatDense<FPP,Cpu> fourier_diag2 = algo.compute_fourier();
Faust::MatDense<FPP,Cpu> ordered_fourier_diag2 = algo.compute_fourier(true);
Faust::MatDense<FPP,Cpu> * ordered_fourier_diag = fourier_diag.get_cols(algo.get_ord_indices());
fourier_diag2 -= fourier_diag;
ordered_fourier_diag2 -= *ordered_fourier_diag;
cout << "norm(fourier_diag2-fourier_diag): " << fourier_diag2.norm() << endl;
cout << "norm(ordered_fourier_diag2-ordered_fourier_diag): " << ordered_fourier_diag2.norm() << endl;
//verify approx. fourier is properly computed (when ordered or not)
assert(fourier_diag2.norm()==0);
assert(ordered_fourier_diag2.norm()==0);
Faust::MatDense<FPP,Cpu> ordered_D(algo.get_D(true));
......@@ -82,7 +93,7 @@ int main()
cout << ordered_D.getData()[i*ordered_D.getNbRow()+i] << " " << full_D(i,i) << endl;
}
cout << "orderded fourier_diag fro norm: " << ordered_fourier_diag->norm() << endl;
cout << "ordered fourier_diag fro norm: " << ordered_fourier_diag->norm() << endl;
cout << "Lap fro norm: " << Lap.norm() << endl;
Faust::MatDense<FPP,Cpu> tmp = *ordered_fourier_diag;
......
......@@ -123,6 +123,12 @@ namespace Faust {
*/
const MatSparse<FPP,DEVICE> get_D(const bool ord=false);
/**
*
*
*/
const MatDense<FPP,DEVICE> compute_fourier(const bool ord=false);
/**
*
*/
......
......@@ -334,6 +334,26 @@ const Faust::MatSparse<FPP,DEVICE> GivensFGFT<FPP,DEVICE,FPP2>::get_D(const bool
return D;
}
template<typename FPP, Device DEVICE, typename FPP2>
const Faust::MatDense<FPP,DEVICE> GivensFGFT<FPP,DEVICE,FPP2>::compute_fourier(const bool ord /* default to false */)
{
Faust::MatDense<FPP,Cpu> fourier(Lap.getNbRow(), Lap.getNbCol());
Faust::MatDense<FPP,Cpu>* ord_fourier;
fourier.setEyes();
for(int i=facts.size()-1;i>=0;i--)
facts[i].multiply(fourier, 'N');
if(ord)
{
if(!is_D_ordered)
order_D();
ord_fourier = fourier.get_cols(ord_indices);
fourier = *ord_fourier;
delete ord_fourier;
}
return fourier;
}
template<typename FPP, Device DEVICE, typename FPP2>
const MatDense<FPP,DEVICE>& GivensFGFT<FPP,DEVICE,FPP2>::get_L() const
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment