Boost logo

Boost-Commit :

From: john_at_[hidden]
Date: 2007-12-19 13:50:39


Author: johnmaddock
Date: 2007-12-19 13:50:39 EST (Wed, 19 Dec 2007)
New Revision: 42173
URL: http://svn.boost.org/trac/boost/changeset/42173

Log:
Added testing-hooks to other libraries (Fortran ones mainly).
Updated docs accordingly.
Text files modified:
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/expint.qbk | 11 +++++++++
   sandbox/math_toolkit/libs/math/test/test_beta_hooks.hpp | 41 ++++++++++++++++++++++++++++++++++++++++
   sandbox/math_toolkit/libs/math/test/test_expint_hooks.hpp | 31 ++++++++++++++++++++++++++++++
   3 files changed, 82 insertions(+), 1 deletions(-)

Modified: sandbox/math_toolkit/libs/math/doc/sf_and_dist/expint.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/sf_and_dist/expint.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/expint.qbk 2007-12-19 13:50:39 EST (Wed, 19 Dec 2007)
@@ -139,7 +139,7 @@
 
 The following table shows the peak errors (in units of epsilon)
 found on various platforms with various floating point types,
-along with comparisons to the __gsl library.
+along with comparisons to Cody's SPECFUN implementation and the __gsl library.
 Unless otherwise specified any floating point type that is narrower
 than the one shown will have __zero_error.
 
@@ -148,12 +148,21 @@
 [[53] [Win32, Visual C++ 8] [Peak=2.4 Mean=0.6
 
 GSL Peak=8.9 Mean=0.7
+
+SPECFUN (Cody) Peak=2.5 Mean=0.6
 ]]
 [[64] [RedHat Linux IA_EM64, gcc-4.1] [Peak=5.1 Mean=0.8]]
 [[64] [Redhat Linux IA64, gcc-4.1] [Peak=5.0 Mean=0.8] ]
 [[113] [HPUX IA64, aCC A.06.06] [Peak=1.9 Mean=0.63]]
 ]
 
+It should be noted that all three libraries tested above
+offer sub-epsilon precision over most of their range.
+
+GSL has the greatest difficulty near the positive root of En, while
+Cody's SPECFUN along with this implementation increase their
+error rates very slightly over the range \[4,6\].
+
 [h4 Testing]
 
 The tests for these functions come in two parts:

Modified: sandbox/math_toolkit/libs/math/test/test_beta_hooks.hpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_beta_hooks.hpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_beta_hooks.hpp 2007-12-19 13:50:39 EST (Wed, 19 Dec 2007)
@@ -68,6 +68,47 @@
 #define TEST_OTHER
 #endif
 
+#ifdef TEST_BRATIO
+namespace other{
+extern "C" int bratio_(double*a, double*b, double*x, double*y, double*w, double*w1, int*ierr);
+
+inline float ibeta(float a, float b, float x)
+{
+ double a_ = a;
+ double b_ = b;
+ double x_ = x;
+ double y_ = 1-x_;
+ double w, w1;
+ int ierr = 0;
+ bratio_(&a_, &b_, &x_, &y_, &w, &w1, &ierr);
+ return w;
+}
+inline double ibeta(double a, double b, double x)
+{
+ double a_ = a;
+ double b_ = b;
+ double x_ = x;
+ double y_ = 1-x_;
+ double w, w1;
+ int ierr = 0;
+ bratio_(&a_, &b_, &x_, &y_, &w, &w1, &ierr);
+ return w;
+}
+inline long double ibeta(long double a, long double b, long double x)
+{
+ double a_ = a;
+ double b_ = b;
+ double x_ = x;
+ double y_ = 1-x_;
+ double w, w1;
+ int ierr = 0;
+ bratio_(&a_, &b_, &x_, &y_, &w, &w1, &ierr);
+ return w;
+}
+}
+#define TEST_OTHER
+#endif
+
 #ifdef TEST_OTHER
 namespace other{
    boost::math::concepts::real_concept beta(boost::math::concepts::real_concept, boost::math::concepts::real_concept){ return 0; }

Modified: sandbox/math_toolkit/libs/math/test/test_expint_hooks.hpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_expint_hooks.hpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_expint_hooks.hpp 2007-12-19 13:50:39 EST (Wed, 19 Dec 2007)
@@ -50,6 +50,37 @@
 #define TEST_OTHER
 #endif
 
+#ifdef TEST_SPECFUN
+namespace other{
+extern "C" int calcei_(double *arg, double *result, int*);
+inline float expint(float a)
+{
+ double r, a_(a);
+ int v = 1;
+ calcei_(&a_, &r, &v);
+ return (float)r;
+}
+inline double expint(double a)
+{
+ double r, a_(a);
+ int v = 1;
+ calcei_(&a_, &r, &v);
+ return r;
+}
+inline long double expint(long double a)
+{
+ double r, a_(a);
+ int v = 1;
+ calcei_(&a_, &r, &v);
+ return r;
+}
+// En is not supported:
+template <class T>
+inline T expint(unsigned, T){ return 0; }
+}
+#define TEST_OTHER
+#endif
+
 #ifdef TEST_OTHER
 namespace other{
    boost::math::concepts::real_concept expint(unsigned, boost::math::concepts::real_concept){ return 0; }


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