[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master e93ca8f 17/23: Demonstration, for immediate r
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master e93ca8f 17/23: Demonstration, for immediate reversion |
Date: |
Tue, 27 Jul 2021 21:59:53 -0400 (EDT) |
branch: master
commit e93ca8fb1dfbfce2d2588b087efb0c7bbf534caf
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Demonstration, for immediate reversion
* zero.hpp: Demonstrate a way to regain the solve performance of
commit d6bd8029e without intruding a rounding function directly
into lmi_root(). Doing that in this sneaky way, by altering an
internal lmi_root() variable through a reference, resurrects the
problem that was to be avoided: binary64 interpolation won't work
with bounds like [0,1e9], whose (binary) midpoint would round to
zero.
* zero_test.cpp: Suppress every test that would fail.
---
zero.hpp | 3 ++-
zero_test.cpp | 10 +++++-----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/zero.hpp b/zero.hpp
index 1b89b0f..eaf527f 100644
--- a/zero.hpp
+++ b/zero.hpp
@@ -613,9 +613,10 @@ root_type decimal_root
std::unordered_map<double,double> m;
- auto fr = [&](double x) // f(), rounded
+ auto fr = [&](double& x) // f(), rounded
{
double const r = round_dec(x);
+ x = r; // Change the reference argument--demonstration only
auto const i = m.find(r);
if(m.end() != i)
{
diff --git a/zero_test.cpp b/zero_test.cpp
index 28696cc..962f879 100644
--- a/zero_test.cpp
+++ b/zero_test.cpp
@@ -204,7 +204,7 @@ void test_a_decimal_function
#if defined LMI_X86_64 && defined LMI_POSIX
if(0 != n_eval)
{
- INVOKE_LMI_TEST_EQUAL(n_eval, r.n_eval, file, line);
+//// INVOKE_LMI_TEST_EQUAL(n_eval, r.n_eval, file, line);
}
#endif // defined LMI_X86_64 && defined LMI_POSIX
stifle_warning_for_unused_variable(n_eval);
@@ -767,7 +767,7 @@ void test_celebrated_equation()
return value: +2.09455148154232650981 (rounded)
)--cut-here--";
- LMI_TEST_EQUAL(verified, oss.str());
+////LMI_TEST_EQUAL(verified, oss.str());
#endif // defined LMI_X86_64 && defined LMI_POSIX
}
@@ -933,7 +933,7 @@ void test_hodgepodge()
// succeed, because floating-point behavior is determinate;
// but small variations betoken no catastrophe.
LMI_TEST_RELATION(159,<=,r.n_eval); // weak
- LMI_TEST_RELATION(r.n_eval,<=,166); // weak
+////LMI_TEST_RELATION(r.n_eval,<=,166); // weak
d = brent_zero(eq_2_1, -100.0, 100.0, 0.5);
zeta = -100.0;
@@ -946,7 +946,7 @@ void test_hodgepodge()
LMI_TEST(10 == max_n_eval_bolzano(-100.0, 100.0, 0.5, -100.0));
LMI_TEST(98 == max_n_eval_brent (-100.0, 100.0, 0.5, -100.0));
LMI_TEST(r.n_eval <= 98);
- LMI_TEST_EQUAL(11, r.n_eval); // weak
+////LMI_TEST_EQUAL(11, r.n_eval); // weak
// Number of evaluations required:
// 23 for brent_zero() [above]
// 20 for decimal_root()
@@ -972,7 +972,7 @@ void test_hodgepodge()
LMI_TEST( 53 == max_n_eval_bolzano(-100.0, 100.0, 0.0, -100.0));
LMI_TEST(2807 == max_n_eval_brent (-100.0, 100.0, 0.0, -100.0));
LMI_TEST(r.n_eval <= 2807);
- LMI_TEST_EQUAL(67, r.n_eval); // weak
+////LMI_TEST_EQUAL(67, r.n_eval); // weak
r = decimal_root(signum_offset, -1.0, 1.0, bias_none, 13);
LMI_TEST(root_is_valid == r.validity);
- [lmi-commits] [lmi] master 8f2f355 19/23: Augment unit tests; record some observations, (continued)
- [lmi-commits] [lmi] master 8f2f355 19/23: Augment unit tests; record some observations, Greg Chicares, 2021/07/27
- [lmi-commits] [lmi] master a259cb6 05/23: Calculate maximum possible number of iterations, Greg Chicares, 2021/07/27
- [lmi-commits] [lmi] master d0a65c2 04/23: Demonstrate that Brent's δ can be almost arbitrarily small, Greg Chicares, 2021/07/27
- [lmi-commits] [lmi] master 548f9ab 06/23: Document known shortcomings of a unit-testing helper, Greg Chicares, 2021/07/27
- [lmi-commits] [lmi] master 19a4a3a 03/23: For now at least, trace solves in regression test, Greg Chicares, 2021/07/27
- [lmi-commits] [lmi] master 04c58eb 09/23: Count iterations and evaluations separately, Greg Chicares, 2021/07/27
- [lmi-commits] [lmi] master bbf2517 10/23: Use signum() where a signum function is wanted, Greg Chicares, 2021/07/27
- [lmi-commits] [lmi] master e08be34 12/23: Improve a unit test, Greg Chicares, 2021/07/27
- [lmi-commits] [lmi] master 02dde17 13/23: Avoid catastrophic cancellation, Greg Chicares, 2021/07/27
- [lmi-commits] [lmi] master d2dcbf8 15/23: Reduce complexity, Greg Chicares, 2021/07/27
- [lmi-commits] [lmi] master e93ca8f 17/23: Demonstration, for immediate reversion,
Greg Chicares <=
- [lmi-commits] [lmi] master 4500338 22/23: Simplify, Greg Chicares, 2021/07/27
- [lmi-commits] [lmi] master 2ad4944 20/23: Record some more observations--no files changed, Greg Chicares, 2021/07/27
- [lmi-commits] [lmi] master 028b454 23/23: Find any root with only 64 function evaluations, Greg Chicares, 2021/07/27