lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] odd/brent 083aae0 05/11: Remove an obsolete idea


From: Greg Chicares
Subject: [lmi-commits] [lmi] odd/brent 083aae0 05/11: Remove an obsolete idea
Date: Tue, 22 Jun 2021 16:54:05 -0400 (EDT)

branch: odd/brent
commit 083aae05b060349907d5e460c359abeffb371c4c
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Remove an obsolete idea
    
    Removed code to experiment with a particular idea: Brent's method, but
    if IQI would be accepted by Brent's criterion but not Chandrupatla's,
    then use secant (rather than bisection).
    
    In Kahan's terms, when IQI is rejected, the algorithm is flailing, and
    resorting to bisection seems to be the best simple strategy.
---
 zero.hpp  | 20 ++------------------
 zero2.hpp |  4 ++--
 zero3.hpp |  4 ++--
 3 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/zero.hpp b/zero.hpp
index f31d624..a89ba57 100644
--- a/zero.hpp
+++ b/zero.hpp
@@ -49,7 +49,6 @@ enum interpolation_technique
     {interpolate_initialization
     ,interpolate_bisection0
     ,interpolate_linear
-    ,interpolate_linear2
     ,interpolate_inverse_quadratic
     ,interpolate_bisection1 // bisection when quadratic rejected
     };
@@ -84,7 +83,7 @@ inline void expatiate
         {
         os_trace
             << "iteration " << n_iter
-            << " "          << "IBLcQb"[technique]
+            << " "          << "IBLQb"[technique]
             << " "          << cond_0 << cond_b << cond_c
             << " iterand "  << x
             << " value "    << fx
@@ -381,21 +380,6 @@ root_type decimal_root
                 double r = fb / fc;
                 p = s * (2.0 * m * q * (q - r) - (b - a) * (r - 1.0));
                 q = (q - 1.0) * (r - 1.0) * (s - 1.0);
-#if 0
-                double Xi = (b - a) / (c - a);
-                double Phi = (fb - fa) / (fc - fa);
-                cond_c =
-                       (Phi * Phi) < Xi
-                    && ((1.0 - Phi) * (1.0 - Phi)) < (1.0 - Xi)
-                    ;
-                if(!cond_c) // interpolate linearly instead?
-                    {
-os_trace << " chandrupatla..." << std::endl;
-                    technique = interpolate_linear2;
-                    p = 2.0 * m * s;
-                    q = 1.0 - s;
-                    }
-#endif // 0
                 }
             if(0.0 < p)
                 {
@@ -646,7 +630,7 @@ int j = 0;
             {
             b -= tol;
             }
-std::cout << ++j << " ze " << "IBLcQb"[technique] << ' ' << b << std::endl;
+std::cout << ++j << " ze " << "IBLQb"[technique] << ' ' << b << std::endl;
         fb = f(b);
         }
 }
diff --git a/zero2.hpp b/zero2.hpp
index eb0171a..cd21477 100644
--- a/zero2.hpp
+++ b/zero2.hpp
@@ -178,8 +178,8 @@ int j = 0;
             b += tol * signum(m);
             }
         fb = f(b);
-//std::cout << ++j << " br " << ' ' << a << ' ' << b << ' ' << c << ' ' << 
"IBLcQb"[technique] << std::endl;
-std::cout << ++j << " br " << "IBLcQb"[technique] << ' ' << b << std::endl;
+//std::cout << ++j << " br " << ' ' << a << ' ' << b << ' ' << c << ' ' << 
"IBLQb"[technique] << std::endl;
+std::cout << ++j << " br " << "IBLQb"[technique] << ' ' << b << std::endl;
 #if 0 // RECTIFIED
         // Brent does this at the top
         if((0.0 < fb) == (0.0 < fc))
diff --git a/zero3.hpp b/zero3.hpp
index 278ed3a..9e11b1c 100644
--- a/zero3.hpp
+++ b/zero3.hpp
@@ -65,8 +65,8 @@ int j = 0;
         // 't' is coefficient for interpolating (linearly) by any technique
         double x = a + t * (b - a);
         double fx = f(x);
-//std::cout << ++j << " ch " << "IBLcQb"[technique] << ' ' << x << std::endl;
-std::cout << ++j << " ch " << "IBLcQb"[technique] << ' ' << t << ' ' << x << ' 
' << fx << ' ' << a << ' ' << b << ' ' << c << std::endl;
+//std::cout << ++j << " ch " << "IBLQb"[technique] << ' ' << x << std::endl;
+std::cout << ++j << " ch " << "IBLQb"[technique] << ' ' << t << ' ' << x << ' 
' << fx << ' ' << a << ' ' << b << ' ' << c << std::endl;
         if(signum(fx) == signum(fa))
             {
             c = a;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]