|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r50050 - trunk/boost/math/tools
From: john_at_[hidden]
Date: 2008-12-01 05:34:57
Author: johnmaddock
Date: 2008-12-01 05:34:56 EST (Mon, 01 Dec 2008)
New Revision: 50050
URL: http://svn.boost.org/trac/boost/changeset/50050
Log:
Added extra instrumentation.
Text files modified:
trunk/boost/math/tools/roots.hpp | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
Modified: trunk/boost/math/tools/roots.hpp
==============================================================================
--- trunk/boost/math/tools/roots.hpp (original)
+++ trunk/boost/math/tools/roots.hpp 2008-12-01 05:34:56 EST (Mon, 01 Dec 2008)
@@ -297,6 +297,11 @@
delta2 = delta1;
delta1 = delta;
std::tr1::tie(f0, f1, f2) = f(result);
+
+ BOOST_MATH_INSTRUMENT_VARIABLE(f0);
+ BOOST_MATH_INSTRUMENT_VARIABLE(f1);
+ BOOST_MATH_INSTRUMENT_VARIABLE(f2);
+
if(0 == f0)
break;
if((f1 == 0) && (f2 == 0))
@@ -313,6 +318,10 @@
{
T denom = 2 * f0;
T num = 2 * f1 - f0 * (f2 / f1);
+
+ BOOST_MATH_INSTRUMENT_VARIABLE(denom);
+ BOOST_MATH_INSTRUMENT_VARIABLE(num);
+
if((fabs(num) < 1) && (fabs(denom) >= fabs(num) * tools::max_value<T>()))
{
// possible overflow, use Newton step:
@@ -340,9 +349,11 @@
// reset delta2 so that this branch will *not* be taken on the
// next iteration:
delta2 = delta * 3;
+ BOOST_MATH_INSTRUMENT_VARIABLE(delta);
}
guess = result;
result -= delta;
+ BOOST_MATH_INSTRUMENT_VARIABLE(result);
// check for out of bounds step:
if(result < min)
@@ -398,13 +409,6 @@
#ifdef BOOST_MATH_INSTRUMENT
std::cout << "Halley iteration, final count = " << max_iter << std::endl;
-
- static boost::uintmax_t max_count = 0;
- if(max_iter > max_count)
- {
- max_count = max_iter;
- std::cout << "Maximum iterations: " << max_iter << std::endl;
- }
#endif
return result;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk