mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
Namespace, indent
This commit is contained in:
parent
2cceebbf12
commit
0da64dea90
@ -1,4 +1,4 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
@ -23,234 +23,236 @@ Author: Christopher Kelly <ckelly@phys.columbia.edu>
|
|||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#ifndef GRID_CONJUGATE_GRADIENT_RELIABLE_UPDATE_H
|
#ifndef GRID_CONJUGATE_GRADIENT_RELIABLE_UPDATE_H
|
||||||
#define GRID_CONJUGATE_GRADIENT_RELIABLE_UPDATE_H
|
#define GRID_CONJUGATE_GRADIENT_RELIABLE_UPDATE_H
|
||||||
|
|
||||||
namespace Grid {
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
|
||||||
template<class FieldD,class FieldF, typename std::enable_if< getPrecision<FieldD>::value == 2, int>::type = 0,typename std::enable_if< getPrecision<FieldF>::value == 1, int>::type = 0>
|
template<class FieldD,class FieldF,
|
||||||
class ConjugateGradientReliableUpdate : public LinearFunction<FieldD> {
|
typename std::enable_if< getPrecision<FieldD>::value == 2, int>::type = 0,
|
||||||
public:
|
typename std::enable_if< getPrecision<FieldF>::value == 1, int>::type = 0>
|
||||||
bool ErrorOnNoConverge; // throw an assert when the CG fails to converge.
|
class ConjugateGradientReliableUpdate : public LinearFunction<FieldD> {
|
||||||
// Defaults true.
|
public:
|
||||||
RealD Tolerance;
|
bool ErrorOnNoConverge; // throw an assert when the CG fails to converge.
|
||||||
Integer MaxIterations;
|
// Defaults true.
|
||||||
Integer IterationsToComplete; //Number of iterations the CG took to finish. Filled in upon completion
|
RealD Tolerance;
|
||||||
Integer ReliableUpdatesPerformed;
|
Integer MaxIterations;
|
||||||
|
Integer IterationsToComplete; //Number of iterations the CG took to finish. Filled in upon completion
|
||||||
|
Integer ReliableUpdatesPerformed;
|
||||||
|
|
||||||
bool DoFinalCleanup; //Final DP cleanup, defaults to true
|
bool DoFinalCleanup; //Final DP cleanup, defaults to true
|
||||||
Integer IterationsToCleanup; //Final DP cleanup step iterations
|
Integer IterationsToCleanup; //Final DP cleanup step iterations
|
||||||
|
|
||||||
LinearOperatorBase<FieldF> &Linop_f;
|
LinearOperatorBase<FieldF> &Linop_f;
|
||||||
LinearOperatorBase<FieldD> &Linop_d;
|
LinearOperatorBase<FieldD> &Linop_d;
|
||||||
GridBase* SinglePrecGrid;
|
GridBase* SinglePrecGrid;
|
||||||
RealD Delta; //reliable update parameter
|
RealD Delta; //reliable update parameter
|
||||||
|
|
||||||
//Optional ability to switch to a different linear operator once the tolerance reaches a certain point. Useful for single/half -> single/single
|
//Optional ability to switch to a different linear operator once the tolerance reaches a certain point. Useful for single/half -> single/single
|
||||||
LinearOperatorBase<FieldF> *Linop_fallback;
|
LinearOperatorBase<FieldF> *Linop_fallback;
|
||||||
RealD fallback_transition_tol;
|
RealD fallback_transition_tol;
|
||||||
|
|
||||||
|
|
||||||
ConjugateGradientReliableUpdate(RealD tol, Integer maxit, RealD _delta, GridBase* _sp_grid, LinearOperatorBase<FieldF> &_Linop_f, LinearOperatorBase<FieldD> &_Linop_d, bool err_on_no_conv = true)
|
ConjugateGradientReliableUpdate(RealD tol, Integer maxit, RealD _delta, GridBase* _sp_grid, LinearOperatorBase<FieldF> &_Linop_f, LinearOperatorBase<FieldD> &_Linop_d, bool err_on_no_conv = true)
|
||||||
: Tolerance(tol),
|
: Tolerance(tol),
|
||||||
MaxIterations(maxit),
|
MaxIterations(maxit),
|
||||||
Delta(_delta),
|
Delta(_delta),
|
||||||
Linop_f(_Linop_f),
|
Linop_f(_Linop_f),
|
||||||
Linop_d(_Linop_d),
|
Linop_d(_Linop_d),
|
||||||
SinglePrecGrid(_sp_grid),
|
SinglePrecGrid(_sp_grid),
|
||||||
ErrorOnNoConverge(err_on_no_conv),
|
ErrorOnNoConverge(err_on_no_conv),
|
||||||
DoFinalCleanup(true),
|
DoFinalCleanup(true),
|
||||||
Linop_fallback(NULL)
|
Linop_fallback(NULL)
|
||||||
{};
|
{};
|
||||||
|
|
||||||
void setFallbackLinop(LinearOperatorBase<FieldF> &_Linop_fallback, const RealD _fallback_transition_tol){
|
void setFallbackLinop(LinearOperatorBase<FieldF> &_Linop_fallback, const RealD _fallback_transition_tol){
|
||||||
Linop_fallback = &_Linop_fallback;
|
Linop_fallback = &_Linop_fallback;
|
||||||
fallback_transition_tol = _fallback_transition_tol;
|
fallback_transition_tol = _fallback_transition_tol;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(const FieldD &src, FieldD &psi) {
|
void operator()(const FieldD &src, FieldD &psi) {
|
||||||
LinearOperatorBase<FieldF> *Linop_f_use = &Linop_f;
|
LinearOperatorBase<FieldF> *Linop_f_use = &Linop_f;
|
||||||
bool using_fallback = false;
|
bool using_fallback = false;
|
||||||
|
|
||||||
psi.checkerboard = src.checkerboard;
|
psi.checkerboard = src.checkerboard;
|
||||||
conformable(psi, src);
|
conformable(psi, src);
|
||||||
|
|
||||||
RealD cp, c, a, d, b, ssq, qq, b_pred;
|
RealD cp, c, a, d, b, ssq, qq, b_pred;
|
||||||
|
|
||||||
FieldD p(src);
|
FieldD p(src);
|
||||||
FieldD mmp(src);
|
FieldD mmp(src);
|
||||||
FieldD r(src);
|
FieldD r(src);
|
||||||
|
|
||||||
// Initial residual computation & set up
|
// Initial residual computation & set up
|
||||||
RealD guess = norm2(psi);
|
RealD guess = norm2(psi);
|
||||||
assert(std::isnan(guess) == 0);
|
assert(std::isnan(guess) == 0);
|
||||||
|
|
||||||
Linop_d.HermOpAndNorm(psi, mmp, d, b);
|
Linop_d.HermOpAndNorm(psi, mmp, d, b);
|
||||||
|
|
||||||
r = src - mmp;
|
r = src - mmp;
|
||||||
p = r;
|
p = r;
|
||||||
|
|
||||||
a = norm2(p);
|
a = norm2(p);
|
||||||
cp = a;
|
cp = a;
|
||||||
ssq = norm2(src);
|
ssq = norm2(src);
|
||||||
|
|
||||||
std::cout << GridLogIterative << std::setprecision(4) << "ConjugateGradientReliableUpdate: guess " << guess << std::endl;
|
std::cout << GridLogIterative << std::setprecision(4) << "ConjugateGradientReliableUpdate: guess " << guess << std::endl;
|
||||||
std::cout << GridLogIterative << std::setprecision(4) << "ConjugateGradientReliableUpdate: src " << ssq << std::endl;
|
std::cout << GridLogIterative << std::setprecision(4) << "ConjugateGradientReliableUpdate: src " << ssq << std::endl;
|
||||||
std::cout << GridLogIterative << std::setprecision(4) << "ConjugateGradientReliableUpdate: mp " << d << std::endl;
|
std::cout << GridLogIterative << std::setprecision(4) << "ConjugateGradientReliableUpdate: mp " << d << std::endl;
|
||||||
std::cout << GridLogIterative << std::setprecision(4) << "ConjugateGradientReliableUpdate: mmp " << b << std::endl;
|
std::cout << GridLogIterative << std::setprecision(4) << "ConjugateGradientReliableUpdate: mmp " << b << std::endl;
|
||||||
std::cout << GridLogIterative << std::setprecision(4) << "ConjugateGradientReliableUpdate: cp,r " << cp << std::endl;
|
std::cout << GridLogIterative << std::setprecision(4) << "ConjugateGradientReliableUpdate: cp,r " << cp << std::endl;
|
||||||
std::cout << GridLogIterative << std::setprecision(4) << "ConjugateGradientReliableUpdate: p " << a << std::endl;
|
std::cout << GridLogIterative << std::setprecision(4) << "ConjugateGradientReliableUpdate: p " << a << std::endl;
|
||||||
|
|
||||||
RealD rsq = Tolerance * Tolerance * ssq;
|
RealD rsq = Tolerance * Tolerance * ssq;
|
||||||
|
|
||||||
// Check if guess is really REALLY good :)
|
// Check if guess is really REALLY good :)
|
||||||
|
if (cp <= rsq) {
|
||||||
|
std::cout << GridLogMessage << "ConjugateGradientReliableUpdate guess was REALLY good\n";
|
||||||
|
std::cout << GridLogMessage << "\tComputed residual " << sqrt(cp / ssq)<<std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Single prec initialization
|
||||||
|
FieldF r_f(SinglePrecGrid);
|
||||||
|
r_f.checkerboard = r.checkerboard;
|
||||||
|
precisionChange(r_f, r);
|
||||||
|
|
||||||
|
FieldF psi_f(r_f);
|
||||||
|
psi_f = zero;
|
||||||
|
|
||||||
|
FieldF p_f(r_f);
|
||||||
|
FieldF mmp_f(r_f);
|
||||||
|
|
||||||
|
RealD MaxResidSinceLastRelUp = cp; //initial residual
|
||||||
|
|
||||||
|
std::cout << GridLogIterative << std::setprecision(4)
|
||||||
|
<< "ConjugateGradient: k=0 residual " << cp << " target " << rsq << std::endl;
|
||||||
|
|
||||||
|
GridStopWatch LinalgTimer;
|
||||||
|
GridStopWatch MatrixTimer;
|
||||||
|
GridStopWatch SolverTimer;
|
||||||
|
|
||||||
|
SolverTimer.Start();
|
||||||
|
int k = 0;
|
||||||
|
int l = 0;
|
||||||
|
|
||||||
|
for (k = 1; k <= MaxIterations; k++) {
|
||||||
|
c = cp;
|
||||||
|
|
||||||
|
MatrixTimer.Start();
|
||||||
|
Linop_f_use->HermOpAndNorm(p_f, mmp_f, d, qq);
|
||||||
|
MatrixTimer.Stop();
|
||||||
|
|
||||||
|
LinalgTimer.Start();
|
||||||
|
|
||||||
|
a = c / d;
|
||||||
|
b_pred = a * (a * qq - d) / c;
|
||||||
|
|
||||||
|
cp = axpy_norm(r_f, -a, mmp_f, r_f);
|
||||||
|
b = cp / c;
|
||||||
|
|
||||||
|
// Fuse these loops ; should be really easy
|
||||||
|
psi_f = a * p_f + psi_f;
|
||||||
|
//p_f = p_f * b + r_f;
|
||||||
|
|
||||||
|
LinalgTimer.Stop();
|
||||||
|
|
||||||
|
std::cout << GridLogIterative << "ConjugateGradientReliableUpdate: Iteration " << k
|
||||||
|
<< " residual " << cp << " target " << rsq << std::endl;
|
||||||
|
std::cout << GridLogDebug << "a = "<< a << " b_pred = "<< b_pred << " b = "<< b << std::endl;
|
||||||
|
std::cout << GridLogDebug << "qq = "<< qq << " d = "<< d << " c = "<< c << std::endl;
|
||||||
|
|
||||||
|
if(cp > MaxResidSinceLastRelUp){
|
||||||
|
std::cout << GridLogIterative << "ConjugateGradientReliableUpdate: updating MaxResidSinceLastRelUp : " << MaxResidSinceLastRelUp << " -> " << cp << std::endl;
|
||||||
|
MaxResidSinceLastRelUp = cp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stopping condition
|
||||||
if (cp <= rsq) {
|
if (cp <= rsq) {
|
||||||
std::cout << GridLogMessage << "ConjugateGradientReliableUpdate guess was REALLY good\n";
|
//Although not written in the paper, I assume that I have to add on the final solution
|
||||||
|
precisionChange(mmp, psi_f);
|
||||||
|
psi = psi + mmp;
|
||||||
|
|
||||||
|
|
||||||
|
SolverTimer.Stop();
|
||||||
|
Linop_d.HermOpAndNorm(psi, mmp, d, qq);
|
||||||
|
p = mmp - src;
|
||||||
|
|
||||||
|
RealD srcnorm = sqrt(norm2(src));
|
||||||
|
RealD resnorm = sqrt(norm2(p));
|
||||||
|
RealD true_residual = resnorm / srcnorm;
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "ConjugateGradientReliableUpdate Converged on iteration " << k << " after " << l << " reliable updates" << std::endl;
|
||||||
std::cout << GridLogMessage << "\tComputed residual " << sqrt(cp / ssq)<<std::endl;
|
std::cout << GridLogMessage << "\tComputed residual " << sqrt(cp / ssq)<<std::endl;
|
||||||
|
std::cout << GridLogMessage << "\tTrue residual " << true_residual<<std::endl;
|
||||||
|
std::cout << GridLogMessage << "\tTarget " << Tolerance << std::endl;
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "Time breakdown "<<std::endl;
|
||||||
|
std::cout << GridLogMessage << "\tElapsed " << SolverTimer.Elapsed() <<std::endl;
|
||||||
|
std::cout << GridLogMessage << "\tMatrix " << MatrixTimer.Elapsed() <<std::endl;
|
||||||
|
std::cout << GridLogMessage << "\tLinalg " << LinalgTimer.Elapsed() <<std::endl;
|
||||||
|
|
||||||
|
IterationsToComplete = k;
|
||||||
|
ReliableUpdatesPerformed = l;
|
||||||
|
|
||||||
|
if(DoFinalCleanup){
|
||||||
|
//Do a final CG to cleanup
|
||||||
|
std::cout << GridLogMessage << "ConjugateGradientReliableUpdate performing final cleanup.\n";
|
||||||
|
ConjugateGradient<FieldD> CG(Tolerance,MaxIterations);
|
||||||
|
CG.ErrorOnNoConverge = ErrorOnNoConverge;
|
||||||
|
CG(Linop_d,src,psi);
|
||||||
|
IterationsToCleanup = CG.IterationsToComplete;
|
||||||
|
}
|
||||||
|
else if (ErrorOnNoConverge) assert(true_residual / Tolerance < 10000.0);
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "ConjugateGradientReliableUpdate complete.\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if(cp < Delta * MaxResidSinceLastRelUp) { //reliable update
|
||||||
|
std::cout << GridLogMessage << "ConjugateGradientReliableUpdate "
|
||||||
|
<< cp << "(residual) < " << Delta << "(Delta) * " << MaxResidSinceLastRelUp << "(MaxResidSinceLastRelUp) on iteration " << k << " : performing reliable update\n";
|
||||||
|
precisionChange(mmp, psi_f);
|
||||||
|
psi = psi + mmp;
|
||||||
|
|
||||||
//Single prec initialization
|
Linop_d.HermOpAndNorm(psi, mmp, d, qq);
|
||||||
FieldF r_f(SinglePrecGrid);
|
r = src - mmp;
|
||||||
r_f.checkerboard = r.checkerboard;
|
|
||||||
precisionChange(r_f, r);
|
|
||||||
|
|
||||||
FieldF psi_f(r_f);
|
psi_f = zero;
|
||||||
psi_f = zero;
|
precisionChange(r_f, r);
|
||||||
|
cp = norm2(r);
|
||||||
|
MaxResidSinceLastRelUp = cp;
|
||||||
|
|
||||||
FieldF p_f(r_f);
|
b = cp/c;
|
||||||
FieldF mmp_f(r_f);
|
|
||||||
|
|
||||||
RealD MaxResidSinceLastRelUp = cp; //initial residual
|
|
||||||
|
|
||||||
std::cout << GridLogIterative << std::setprecision(4)
|
|
||||||
<< "ConjugateGradient: k=0 residual " << cp << " target " << rsq << std::endl;
|
|
||||||
|
|
||||||
GridStopWatch LinalgTimer;
|
|
||||||
GridStopWatch MatrixTimer;
|
|
||||||
GridStopWatch SolverTimer;
|
|
||||||
|
|
||||||
SolverTimer.Start();
|
|
||||||
int k = 0;
|
|
||||||
int l = 0;
|
|
||||||
|
|
||||||
for (k = 1; k <= MaxIterations; k++) {
|
|
||||||
c = cp;
|
|
||||||
|
|
||||||
MatrixTimer.Start();
|
|
||||||
Linop_f_use->HermOpAndNorm(p_f, mmp_f, d, qq);
|
|
||||||
MatrixTimer.Stop();
|
|
||||||
|
|
||||||
LinalgTimer.Start();
|
|
||||||
|
|
||||||
a = c / d;
|
|
||||||
b_pred = a * (a * qq - d) / c;
|
|
||||||
|
|
||||||
cp = axpy_norm(r_f, -a, mmp_f, r_f);
|
|
||||||
b = cp / c;
|
|
||||||
|
|
||||||
// Fuse these loops ; should be really easy
|
|
||||||
psi_f = a * p_f + psi_f;
|
|
||||||
//p_f = p_f * b + r_f;
|
|
||||||
|
|
||||||
LinalgTimer.Stop();
|
|
||||||
|
|
||||||
std::cout << GridLogIterative << "ConjugateGradientReliableUpdate: Iteration " << k
|
|
||||||
<< " residual " << cp << " target " << rsq << std::endl;
|
|
||||||
std::cout << GridLogDebug << "a = "<< a << " b_pred = "<< b_pred << " b = "<< b << std::endl;
|
|
||||||
std::cout << GridLogDebug << "qq = "<< qq << " d = "<< d << " c = "<< c << std::endl;
|
|
||||||
|
|
||||||
if(cp > MaxResidSinceLastRelUp){
|
|
||||||
std::cout << GridLogIterative << "ConjugateGradientReliableUpdate: updating MaxResidSinceLastRelUp : " << MaxResidSinceLastRelUp << " -> " << cp << std::endl;
|
|
||||||
MaxResidSinceLastRelUp = cp;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stopping condition
|
std::cout << GridLogMessage << "ConjugateGradientReliableUpdate new residual " << cp << std::endl;
|
||||||
if (cp <= rsq) {
|
|
||||||
//Although not written in the paper, I assume that I have to add on the final solution
|
|
||||||
precisionChange(mmp, psi_f);
|
|
||||||
psi = psi + mmp;
|
|
||||||
|
|
||||||
|
|
||||||
SolverTimer.Stop();
|
|
||||||
Linop_d.HermOpAndNorm(psi, mmp, d, qq);
|
|
||||||
p = mmp - src;
|
|
||||||
|
|
||||||
RealD srcnorm = sqrt(norm2(src));
|
|
||||||
RealD resnorm = sqrt(norm2(p));
|
|
||||||
RealD true_residual = resnorm / srcnorm;
|
|
||||||
|
|
||||||
std::cout << GridLogMessage << "ConjugateGradientReliableUpdate Converged on iteration " << k << " after " << l << " reliable updates" << std::endl;
|
|
||||||
std::cout << GridLogMessage << "\tComputed residual " << sqrt(cp / ssq)<<std::endl;
|
|
||||||
std::cout << GridLogMessage << "\tTrue residual " << true_residual<<std::endl;
|
|
||||||
std::cout << GridLogMessage << "\tTarget " << Tolerance << std::endl;
|
|
||||||
|
|
||||||
std::cout << GridLogMessage << "Time breakdown "<<std::endl;
|
|
||||||
std::cout << GridLogMessage << "\tElapsed " << SolverTimer.Elapsed() <<std::endl;
|
|
||||||
std::cout << GridLogMessage << "\tMatrix " << MatrixTimer.Elapsed() <<std::endl;
|
|
||||||
std::cout << GridLogMessage << "\tLinalg " << LinalgTimer.Elapsed() <<std::endl;
|
|
||||||
|
|
||||||
IterationsToComplete = k;
|
|
||||||
ReliableUpdatesPerformed = l;
|
|
||||||
|
|
||||||
if(DoFinalCleanup){
|
l = l+1;
|
||||||
//Do a final CG to cleanup
|
|
||||||
std::cout << GridLogMessage << "ConjugateGradientReliableUpdate performing final cleanup.\n";
|
|
||||||
ConjugateGradient<FieldD> CG(Tolerance,MaxIterations);
|
|
||||||
CG.ErrorOnNoConverge = ErrorOnNoConverge;
|
|
||||||
CG(Linop_d,src,psi);
|
|
||||||
IterationsToCleanup = CG.IterationsToComplete;
|
|
||||||
}
|
|
||||||
else if (ErrorOnNoConverge) assert(true_residual / Tolerance < 10000.0);
|
|
||||||
|
|
||||||
std::cout << GridLogMessage << "ConjugateGradientReliableUpdate complete.\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if(cp < Delta * MaxResidSinceLastRelUp) { //reliable update
|
|
||||||
std::cout << GridLogMessage << "ConjugateGradientReliableUpdate "
|
|
||||||
<< cp << "(residual) < " << Delta << "(Delta) * " << MaxResidSinceLastRelUp << "(MaxResidSinceLastRelUp) on iteration " << k << " : performing reliable update\n";
|
|
||||||
precisionChange(mmp, psi_f);
|
|
||||||
psi = psi + mmp;
|
|
||||||
|
|
||||||
Linop_d.HermOpAndNorm(psi, mmp, d, qq);
|
|
||||||
r = src - mmp;
|
|
||||||
|
|
||||||
psi_f = zero;
|
|
||||||
precisionChange(r_f, r);
|
|
||||||
cp = norm2(r);
|
|
||||||
MaxResidSinceLastRelUp = cp;
|
|
||||||
|
|
||||||
b = cp/c;
|
|
||||||
|
|
||||||
std::cout << GridLogMessage << "ConjugateGradientReliableUpdate new residual " << cp << std::endl;
|
|
||||||
|
|
||||||
l = l+1;
|
|
||||||
}
|
|
||||||
|
|
||||||
p_f = p_f * b + r_f; //update search vector after reliable update appears to help convergence
|
|
||||||
|
|
||||||
if(!using_fallback && Linop_fallback != NULL && cp < fallback_transition_tol){
|
|
||||||
std::cout << GridLogMessage << "ConjugateGradientReliableUpdate switching to fallback linear operator on iteration " << k << " at residual " << cp << std::endl;
|
|
||||||
Linop_f_use = Linop_fallback;
|
|
||||||
using_fallback = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
std::cout << GridLogMessage << "ConjugateGradientReliableUpdate did NOT converge"
|
|
||||||
<< std::endl;
|
p_f = p_f * b + r_f; //update search vector after reliable update appears to help convergence
|
||||||
|
|
||||||
|
if(!using_fallback && Linop_fallback != NULL && cp < fallback_transition_tol){
|
||||||
|
std::cout << GridLogMessage << "ConjugateGradientReliableUpdate switching to fallback linear operator on iteration " << k << " at residual " << cp << std::endl;
|
||||||
|
Linop_f_use = Linop_fallback;
|
||||||
|
using_fallback = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
std::cout << GridLogMessage << "ConjugateGradientReliableUpdate did NOT converge"
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
if (ErrorOnNoConverge) assert(0);
|
if (ErrorOnNoConverge) assert(0);
|
||||||
IterationsToComplete = k;
|
IterationsToComplete = k;
|
||||||
ReliableUpdatesPerformed = l;
|
ReliableUpdatesPerformed = l;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
NAMESPACE_END(Grid);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user