mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-15 02:05:37 +00:00
count converged eigenvalues not assuming candidates are sorted
This commit is contained in:
parent
dc6f637e70
commit
fbe1209f7e
@ -166,6 +166,7 @@ until convergence
|
|||||||
std::vector<std::vector<ComplexD>> lmd2(Nu,std::vector<ComplexD>(Nm,0.0));
|
std::vector<std::vector<ComplexD>> lmd2(Nu,std::vector<ComplexD>(Nm,0.0));
|
||||||
std::vector<std::vector<ComplexD>> lme2(Nu,std::vector<ComplexD>(Nm,0.0));
|
std::vector<std::vector<ComplexD>> lme2(Nu,std::vector<ComplexD>(Nm,0.0));
|
||||||
std::vector<RealD> eval2(Nm);
|
std::vector<RealD> eval2(Nm);
|
||||||
|
std::vector<RealD> resid(Nk);
|
||||||
|
|
||||||
Eigen::MatrixXcd Qt = Eigen::MatrixXcd::Zero(Nm,Nm);
|
Eigen::MatrixXcd Qt = Eigen::MatrixXcd::Zero(Nm,Nm);
|
||||||
Eigen::MatrixXcd Q = Eigen::MatrixXcd::Zero(Nm,Nm);
|
Eigen::MatrixXcd Q = Eigen::MatrixXcd::Zero(Nm,Nm);
|
||||||
@ -267,6 +268,7 @@ until convergence
|
|||||||
eval2[i] = vnum/vden;
|
eval2[i] = vnum/vden;
|
||||||
v -= eval2[i]*B[i];
|
v -= eval2[i]*B[i];
|
||||||
RealD vv = norm2(v);
|
RealD vv = norm2(v);
|
||||||
|
resid[i] = vv;
|
||||||
|
|
||||||
std::cout.precision(13);
|
std::cout.precision(13);
|
||||||
clog << "[" << std::setw(3)<< std::setiosflags(std::ios_base::right) <<i<<"] ";
|
clog << "[" << std::setw(3)<< std::setiosflags(std::ios_base::right) <<i<<"] ";
|
||||||
@ -274,7 +276,8 @@ until convergence
|
|||||||
std::cout << " |H B[i] - eval[i]B[i]|^2 "<< std::setw(25)<< std::setiosflags(std::ios_base::right)<< vv<< std::endl;
|
std::cout << " |H B[i] - eval[i]B[i]|^2 "<< std::setw(25)<< std::setiosflags(std::ios_base::right)<< vv<< std::endl;
|
||||||
|
|
||||||
// change the criteria as evals are supposed to be sorted, all evals smaller(larger) than Nstop should have converged
|
// change the criteria as evals are supposed to be sorted, all evals smaller(larger) than Nstop should have converged
|
||||||
if( (vv<eresid*eresid) && (i == Nconv) ){
|
//if( (vv<eresid*eresid) && (i == Nconv) ){
|
||||||
|
if (vv<eresid*eresid) {
|
||||||
Iconv[Nconv] = i;
|
Iconv[Nconv] = i;
|
||||||
++Nconv;
|
++Nconv;
|
||||||
}
|
}
|
||||||
@ -287,6 +290,13 @@ until convergence
|
|||||||
goto converged;
|
goto converged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(int i=0; i<Nconv; ++i){
|
||||||
|
std::cout.precision(13);
|
||||||
|
clog << "[" << std::setw(3)<< std::setiosflags(std::ios_base::right) <<Iconv[i]<<"] ";
|
||||||
|
std::cout << "eval_conv = "<<std::setw(25)<< std::setiosflags(std::ios_base::left)<< eval2[Iconv[i]];
|
||||||
|
std::cout << " |H B[i] - eval_conv[i]B[i]|^2 "<< std::setw(25)<< std::setiosflags(std::ios_base::right)<< resid[Iconv[i]]<< std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
if ( iter < MaxIter-1 ) {
|
if ( iter < MaxIter-1 ) {
|
||||||
if ( Nu == 1 ) {
|
if ( Nu == 1 ) {
|
||||||
// reconstruct initial vector for additional pole space
|
// reconstruct initial vector for additional pole space
|
||||||
|
Loading…
Reference in New Issue
Block a user