diff options
| -rw-r--r-- | log-fourier_integrator.cpp | 28 | 
1 files changed, 7 insertions, 21 deletions
| diff --git a/log-fourier_integrator.cpp b/log-fourier_integrator.cpp index cf26fea..44f3b86 100644 --- a/log-fourier_integrator.cpp +++ b/log-fourier_integrator.cpp @@ -92,7 +92,6 @@ int main(int argc, char* argv[]) {      while (true) {        Real ΔC = 100;        Real ΔC₀ = 100; -      unsigned it = 0;        while (ΔC > ε) {          std::vector<Real> dfC(N);          std::vector<Real> RddfC(N); @@ -131,16 +130,9 @@ int main(int argc, char* argv[]) {          if (ΔC < ΔC₀) {            ΔC₀ = ΔC; -          it = 0;            γ = std::min(1.001 * γ, 1.0);          } else { -          it++; -        } - -        if (it > 100) {            γ = std::max(0.5 * γ, 1e-3); -          it = 0; -          ΔC₀ = ΔC;          }          std::cerr << β << " " << μ << " " << ΔC << " " << γ; @@ -150,20 +142,15 @@ int main(int argc, char* argv[]) {          break;        }        if (μ₁ == 0 || μ₂ == 0) { -        if (Cₜ[0] > 1) { -          if (μ₁ == 0) { -            /* We found a lower bound */ -            μ₁ = μ; -          } -          μ *= 1.01; +        if (Cₜ[0] > 1 && μ₁ == 0) { +          /* We found a lower bound */ +          μ₁ = μ;          } -        if (Cₜ[0] < 1) { -          if (μ₂ == 0) { -            /* We found an upper bound */ -            μ₂ = μ; -          } -          μ /= 1.01; +        if (Cₜ[0] < 1 && μ₂ == 0) { +          /* We found an upper bound */ +          μ₂ = μ;          } +        μ *= Cₜ[0];        } else {          /* Once the bounds are set, we can use bisection */          if (Cₜ[0] > 1) { @@ -193,7 +180,6 @@ int main(int argc, char* argv[]) {      std::cerr << β << " " << μ << " " << Ĉₜ[0].real() << " " << E << " " << γ << std::endl;      β += Δβ; -    μ += Δβ;    }    for (unsigned i = 0; i < N; i++) { | 
