Mentions légales du service

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

Fix a bug in Parallel Truncated Jacobi algorithm (GivensFGFTParallel/Complex).

The bug occured in certain conditions (when the number of Givens rotations per factor -- t -- is at its max or near). An error in the break condition of a while loop provoked an exit before that the factor is full of Givens as expected.
Minor other modifs: change in the debug output/tests.
parent a2fd3aba
Branches
Tags
No related merge requests found
Pipeline #833892 skipped
......@@ -81,8 +81,10 @@ void GivensFGFTParallel<FPP,DEVICE,FPP2>::update_fact_nz_inds()
i++;
}
#ifdef DEBUG_GIVENS
cout << "GivensFGFTParallel::update_fact_nz_inds() after purge: ";
for(auto &p : fact_nz_inds)
cout << "GivensFGFTParallel::update_fact_nz_inds() after purge (" << p.first+1 << "," << p.second+1 << ") :" << endl;
cout << "(" << p.first+1 << "," << p.second+1 << ") :";
cout << endl;
#endif
}
......@@ -110,7 +112,7 @@ template<typename FPP, Device DEVICE, typename FPP2>
void GivensFGFTParallel<FPP,DEVICE,FPP2>::loop_update_fact()
{
fact_nrots = 0;
while(fact_nrots < t && fact_nrots < fact_nz_inds.size())
while(fact_nrots < t && 0 < fact_nz_inds.size())
{
choose_pivot();
update_fact_nz_inds();
......@@ -131,7 +133,7 @@ void GivensFGFTParallel<FPP,DEVICE,FPP2>::choose_pivot()
this->q = max_elt.second;
this->coord_choices.push_back(pair<int,int>(this->p,this->q));
#ifdef DEBUG_GIVENS
cout << "choose_pivot() p: " << this->p+1 << " q:" << this->q+1 << " " << "L(p,q): " << this->L(this->p,this->q) << " nrots: " << fact_nrots << endl;
cout << "choose_pivot() p: " << this->p+1 << " q:" << this->q+1 << " " << "L(p,q): " << (*(this->L))(this->p,this->q) << " nrots: " << fact_nrots << endl;
#endif
}
......
......@@ -112,7 +112,7 @@ template<typename FPP, Device DEVICE, typename FPP2>
void GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::loop_update_fact()
{
fact_nrots = 0;
while(fact_nrots < t && fact_nrots < fact_nz_inds.size())
while(fact_nrots < t && 0 < fact_nz_inds.size())
{
choose_pivot();
update_fact_nz_inds();
......@@ -121,6 +121,7 @@ void GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::loop_update_fact()
fact_nrots++;
}
finish_fact();
#ifdef DEBUG_GIVENS
int n = this->L->getNbRow();
// cout << "n=" << n << endl;
MatSparse<FPP,DEVICE> test1(this->facts[this->ite]);
......@@ -133,7 +134,7 @@ void GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::loop_update_fact()
// cout << "ite=" << this->ite << "S*S'(" << j << "," << j << ")=" << test2(j,j) << endl;
assert(Faust::abs(test2(j,j)-FPP(1,0)) < 1);
}
#endif
}
template<typename FPP, Device DEVICE, typename FPP2>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment