[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] odd/eraseme_error dec4d54 09/10: Rename operations
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] odd/eraseme_error dec4d54 09/10: Rename operations |
Date: |
Wed, 7 Jul 2021 06:22:14 -0400 (EDT) |
branch: odd/eraseme_error
commit dec4d547e862be0b6615f1b42bf26d8becb05911
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Rename operations
Brent's method has nine enumerated...somethings. They aren't exactly
"decisions" or "activities" on a flowchart, and maybe not "transitions"
on a state diagram; but "operations" seems better than "techniques".
---
zero.hpp | 42 +++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/zero.hpp b/zero.hpp
index 663a6b5..2721920 100644
--- a/zero.hpp
+++ b/zero.hpp
@@ -40,7 +40,7 @@ enum root_bias
,bias_higher // Require 0.0 <= f(z).
};
-enum root_technique // trace:
+enum root_operation // trace:
{evaluate_bounds // i
,force_b_and_c_to_bracket_root // j
,force_b_to_be_best_approximation // k
@@ -252,7 +252,7 @@ root_type lmi_root
constexpr double epsilon {std::numeric_limits<double>::epsilon()};
int n_iter {0};
- root_technique technique {evaluate_bounds};
+ root_operation operation {evaluate_bounds};
os_trace
<< "#eval"
@@ -274,7 +274,7 @@ root_type lmi_root
{
os_trace
<< std::setw(3) << n_iter
- << ' ' << "ijkLQ0123"[technique]
+ << ' ' << "ijkLQ0123"[operation]
<< ' ' << std::setw(12) << a << ' ' << std::setw(12) << fa
<< ' ' << std::setw(12) << b << ' ' << std::setw(12) << fb
<< ' ' << std::setw(12) << c << ' ' << std::setw(12) << fc
@@ -325,7 +325,7 @@ root_type lmi_root
c = a;
fc = fa;
d = e = b - a;
- technique = force_b_and_c_to_bracket_root;
+ operation = force_b_and_c_to_bracket_root;
expatiate();
}
// If 'c' is a closer approximant than 'b', then swap them,
@@ -334,7 +334,7 @@ root_type lmi_root
{
a = b; b = c; c = a;
fa = fb; fb = fc; fc = fa;
- technique = force_b_to_be_best_approximation;
+ operation = force_b_to_be_best_approximation;
expatiate();
}
double tol = 2.0 * epsilon * std::fabs(b) + t;
@@ -360,12 +360,12 @@ root_type lmi_root
}
if(std::fabs(e) < tol)
{
- technique = dithering_near_root;
+ operation = dithering_near_root;
d = e = m;
}
else if(std::fabs(fa) <= std::fabs(fb))
{
- technique = secant_out_of_bounds;
+ operation = secant_out_of_bounds;
d = e = m;
}
else
@@ -374,13 +374,13 @@ root_type lmi_root
double s = fb / fa; // Note 3.
if(a == c)
{
- technique = interpolate_linear;
+ operation = interpolate_linear;
p = 2.0 * m * s;
q = 1.0 - s;
}
else
{
- technique = interpolate_inverse_quadratic;
+ operation = interpolate_inverse_quadratic;
q = fa / fc;
double r = fb / fc;
p = s * (2.0 * m * q * (q - r) - (b - a) * (r - 1.0));
@@ -403,7 +403,7 @@ root_type lmi_root
// "we reject i [i.e., b + p/q] if 2|p| ≥ 3|mq|"
if(3.0 * m * q - std::fabs(tol * q) <= 2.0 * p)
{
- technique = parabola_not_single_valued;
+ operation = parabola_not_single_valued;
d = e = m;
}
// AfMWD says on page 50:
@@ -413,7 +413,7 @@ root_type lmi_root
// "If |e| < δ or |p/q| ≥ ½|e| then we do a bisection"
else if(std::fabs(0.5 * s * q) <= p)
{
- technique = guarantee_linear_convergence;
+ operation = guarantee_linear_convergence;
d = e = m;
}
else
@@ -509,7 +509,7 @@ double brent_zero
// that f(a) and f(b) have different signs.
int n_iter {0};
- root_technique technique {evaluate_bounds};
+ root_operation operation {evaluate_bounds};
os_trace
<< "#eval"
@@ -525,7 +525,7 @@ double brent_zero
{
os_trace
<< std::setw(3) << n_iter
- << ' ' << "ijkLQ0123"[technique]
+ << ' ' << "ijkLQ0123"[operation]
<< ' ' << std::setw(12) << a << ' ' << std::setw(12) << fa
<< ' ' << std::setw(12) << b << ' ' << std::setw(12) << fb
<< ' ' << std::setw(12) << c << ' ' << std::setw(12) << fc
@@ -541,14 +541,14 @@ double brent_zero
expatiate();
interpolate:
c = a; fc = fa; d = e = b - a;
- technique = force_b_and_c_to_bracket_root;
+ operation = force_b_and_c_to_bracket_root;
expatiate();
extrapolate:
if(std::fabs(fc) < std::fabs(fb))
{
a = b; b = c; c = a;
fa = fb; fb = fc; fc = fa;
- technique = force_b_to_be_best_approximation;
+ operation = force_b_to_be_best_approximation;
expatiate();
}
tol = 2.0 * DBL_EPSILON * std::fabs(b) + t;
@@ -558,12 +558,12 @@ double brent_zero
// See if a bisection is forced.
if(std::fabs(e) < tol)
{
- technique = dithering_near_root;
+ operation = dithering_near_root;
d = e = m;
}
else if(std::fabs(fa) <= std::fabs(fb))
{
- technique = secant_out_of_bounds;
+ operation = secant_out_of_bounds;
d = e = m;
}
else
@@ -572,14 +572,14 @@ double brent_zero
if(a == c)
{
// Linear interpolation.
- technique = interpolate_linear;
+ operation = interpolate_linear;
p = 2.0 * m * s;
q = 1.0 - s;
}
else
{
// Inverse quadratic interpolation.
- technique = interpolate_inverse_quadratic;
+ operation = interpolate_inverse_quadratic;
q = fa / fc;
r = fb / fc;
p = s * (2.0 * m * q * (q - r) - (b - a) * (r - 1.0));
@@ -602,7 +602,7 @@ double brent_zero
// "we reject i [i.e., b + p/q] if 2|p| ≥ 3|mq|"
if(3.0 * m * q - std::fabs(tol * q) <= 2.0 * p)
{
- technique = parabola_not_single_valued;
+ operation = parabola_not_single_valued;
d = e = m;
}
// AfMWD says on page 50:
@@ -612,7 +612,7 @@ double brent_zero
// "If |e| < δ or |p/q| ≥ ½|e| then we do a bisection"
else if(std::fabs(0.5 * s * q) <= p)
{
- technique = guarantee_linear_convergence;
+ operation = guarantee_linear_convergence;
d = e = m;
}
else
- [lmi-commits] [lmi] branch odd/eraseme_error created (now 69d06e9), Greg Chicares, 2021/07/07
- [lmi-commits] [lmi] odd/eraseme_error dd8fb62 01/10: Postpone consideration of NaN-valued objective functions, Greg Chicares, 2021/07/07
- [lmi-commits] [lmi] odd/eraseme_error 1dbe0b4 02/10: Refactor, Greg Chicares, 2021/07/07
- [lmi-commits] [lmi] odd/eraseme_error a3f38b5 03/10: Refactor instrumented reference implementation, Greg Chicares, 2021/07/07
- [lmi-commits] [lmi] odd/eraseme_error 4d0358c 04/10: Rename an enumeration, Greg Chicares, 2021/07/07
- [lmi-commits] [lmi] odd/eraseme_error 2870f56 05/10: Reenumerate root-finding techniques, Greg Chicares, 2021/07/07
- [lmi-commits] [lmi] odd/eraseme_error b19754f 06/10: Show shifts in optional trace, Greg Chicares, 2021/07/07
- [lmi-commits] [lmi] odd/eraseme_error dfd50b1 07/10: Find a root that coincides with an input bound, Greg Chicares, 2021/07/07
- [lmi-commits] [lmi] odd/eraseme_error dec4d54 09/10: Rename operations,
Greg Chicares <=
- [lmi-commits] [lmi] odd/eraseme_error 69d06e9 10/10: Attempt to find a problem, Greg Chicares, 2021/07/07
- [lmi-commits] [lmi] odd/eraseme_error b862db3 08/10: Uniformly test two functions in parallel, Greg Chicares, 2021/07/07