Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76252 - in sandbox/big_number: boost/multiprecision boost/multiprecision/detail libs/multiprecision/performance
From: john_at_[hidden]
Date: 2012-01-01 06:37:47


Author: johnmaddock
Date: 2012-01-01 06:37:46 EST (Sun, 01 Jan 2012)
New Revision: 76252
URL: http://svn.boost.org/trac/boost/changeset/76252

Log:
Update special functions performance test and add generic lanczos support to floating point types.
Added:
   sandbox/big_number/boost/multiprecision/detail/big_lanczos.hpp (contents, props changed)
   sandbox/big_number/libs/multiprecision/performance/sf_performance-msvc-10.log (contents, props changed)
Text files modified:
   sandbox/big_number/boost/multiprecision/cpp_float.hpp | 1
   sandbox/big_number/boost/multiprecision/gmp.hpp | 1
   sandbox/big_number/boost/multiprecision/mpfr.hpp | 25 -------------
   sandbox/big_number/libs/multiprecision/performance/sf_performance.cpp | 73 ++++++++++++++++++++++++++++++++++++++++
   4 files changed, 76 insertions(+), 24 deletions(-)

Modified: sandbox/big_number/boost/multiprecision/cpp_float.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/cpp_float.hpp (original)
+++ sandbox/big_number/boost/multiprecision/cpp_float.hpp 2012-01-01 06:37:46 EST (Sun, 01 Jan 2012)
@@ -15,6 +15,7 @@
 #include <boost/cstdint.hpp>
 #include <boost/array.hpp>
 #include <boost/multiprecision/mp_number.hpp>
+#include <boost/multiprecision/detail/big_lanczos.hpp>
 
 //
 // Headers required for Boost.Math integration:

Added: sandbox/big_number/boost/multiprecision/detail/big_lanczos.hpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/boost/multiprecision/detail/big_lanczos.hpp 2012-01-01 06:37:46 EST (Sun, 01 Jan 2012)
@@ -0,0 +1,46 @@
+
+// Copyright (c) 2011 John Maddock
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_MP_BIG_LANCZOS
+#define BOOST_MP_BIG_LANCZOS
+
+#include <boost/math/bindings/detail/big_lanczos.hpp>
+
+namespace boost{ namespace math{
+
+namespace lanczos{
+
+template <class T, class Policy>
+struct lanczos;
+
+template<class Backend, class Policy>
+struct lanczos<multiprecision::mp_number<Backend>, Policy>
+{
+ typedef typename boost::math::policies::precision<multiprecision::mp_number<Backend>, Policy>::type precision_type;
+ typedef typename mpl::if_c<
+ precision_type::value <= 73,
+ lanczos13UDT,
+ typename mpl::if_c<
+ precision_type::value <= 122,
+ lanczos22UDT,
+ typename mpl::if_c<
+ precision_type::value <= 172,
+ lanczos31UDT,
+ typename mpl::if_c<
+ precision_type::value <= 372,
+ lanczos61UDT,
+ undefined_lanczos
+ >::type
+ >::type
+ >::type
+ >::type type;
+};
+
+} // namespace lanczos
+
+}} // namespaces
+
+#endif

Modified: sandbox/big_number/boost/multiprecision/gmp.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/gmp.hpp (original)
+++ sandbox/big_number/boost/multiprecision/gmp.hpp 2012-01-01 06:37:46 EST (Sun, 01 Jan 2012)
@@ -7,6 +7,7 @@
 #define BOOST_MATH_ER_GMP_BACKEND_HPP
 
 #include <boost/multiprecision/mp_number.hpp>
+#include <boost/multiprecision/detail/big_lanczos.hpp>
 #include <boost/math/special_functions/fpclassify.hpp>
 #include <boost/cstdint.hpp>
 #include <boost/lexical_cast.hpp>

Modified: sandbox/big_number/boost/multiprecision/mpfr.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/mpfr.hpp (original)
+++ sandbox/big_number/boost/multiprecision/mpfr.hpp 2012-01-01 06:37:46 EST (Sun, 01 Jan 2012)
@@ -11,7 +11,7 @@
 #include <boost/math/special_functions/fpclassify.hpp>
 #include <boost/cstdint.hpp>
 #include <boost/lexical_cast.hpp>
-#include <boost/math/bindings/detail/big_lanczos.hpp>
+#include <boost/multiprecision/detail/big_lanczos.hpp>
 #include <mpfr.h>
 #include <cmath>
 #include <algorithm>
@@ -1008,29 +1008,6 @@
 
 }
 
-namespace lanczos{
-
-template<unsigned Digits10, class Policy>
-struct lanczos<multiprecision::mp_number<multiprecision::mpfr_float_backend<Digits10> >, Policy>
-{
- typedef typename mpl::if_c<
- Digits10 <= 36,
- lanczos22UDT,
- typename mpl::if_c<
- Digits10 <= 50,
- lanczos31UDT,
- typename mpl::if_c<
- Digits10 <= 110,
- lanczos61UDT,
- undefined_lanczos
- >::type
- >::type
- >::type type;
-};
-
-} // namespace lanczos
-
-
 }} // namespaces
 
 namespace std{

Added: sandbox/big_number/libs/multiprecision/performance/sf_performance-msvc-10.log
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance-msvc-10.log 2012-01-01 06:37:46 EST (Sun, 01 Jan 2012)
@@ -0,0 +1,69 @@
+0
+11
+24
+3
+13
+27
+Testing Bessel Functions.....
+Time for mpfr_float_50 = 6.2742 seconds
+Total allocations for mpfr_float_50 = 2684348
+Time for mpf_float_50 = 11.2255 seconds
+Total allocations for mpf_float_50 = 2601366
+Time for cpp_float_50 = 19.5712 seconds
+Total allocations for cpp_float_50 = 0
+Time for mpfr_class (50 digits) = 6.11757 seconds
+Total allocations for mpfr_class (50 digits) = 3946031
+Time for mpreal (50 digits) = 9.38756 seconds
+Total allocations for mpreal (50 digits) = 13223017
+Time for mpfr_float_100 = 9.61944 seconds
+Total allocations for mpfr_float_50 = 3671485
+Time for mpf_float_100 = 8.29211 seconds
+Total allocations for mpf_float_100 = 3593669
+Time for cpp_float_100 = 20.4485 seconds
+Total allocations for cpp_float_100 = 0
+Time for mpfr_class (100 digits) = 9.88427 seconds
+Total allocations for mpfr_class (100 digits) = 5447348
+Time for mpreal (100 digits) = 13.7811 seconds
+Total allocations for mpreal (100 digits) = 16671065
+Testing Polynomial Evaluation.....
+Time for mpfr_float_50 = 0.00839464 seconds
+Total allocations for mpfr_float_50 = 2996
+Time for mpf_float_50 = 0.0042138 seconds
+Total allocations for mpf_float_50 = 2996
+Time for cpp_float_50 = 0.0046054 seconds
+Total allocations for cpp_float_50 = 0
+Time for mpfr_class (50 digits) = 0.00990538 seconds
+Total allocations for mpfr_class (50 digits) = 12976
+Time for mpreal (50 digits) = 0.0152955 seconds
+Total allocations for mpreal (50 digits = 27947
+Time for mpfr_float_100 = 0.00957098 seconds
+Total allocations for mpfr_float_100 = 2996
+Time for mpf_float_100 = 0.00418726 seconds
+Total allocations for mpf_float_100 = 2996
+Time for cpp_float_100 = 0.0090742 seconds
+Total allocations for cpp_float_100 = 0
+Time for mpfr_class (100 digits) = 0.011094 seconds
+Total allocations for mpfr_class (100 digits) = 12976
+Time for mpreal (100 digits) = 0.0172028 seconds
+Total allocations for mpreal (100 digits) = 27947
+Testing Non-Central T.....
+Time for mpfr_float_50 = 260.324 seconds
+Total allocations for mpfr_float_50 = 139149049
+Time for mpf_float_50 = 201.95 seconds
+Total allocations for mpf_float_50 = 134600354
+Time for cpp_float_50 = 340.292 seconds
+Total allocations for cpp_float_50 = 0
+Time for mpfr_class (50 digits) = 269.03 seconds
+Total allocations for mpfr_class (50 digits) = 252401115
+Time for mpreal (50 digits) = 350.758 seconds
+Total allocations for mpreal (50 digits) = 447009420
+Time for mpfr_float_100 = 519.421 seconds
+Total allocations for mpfr_float_100 = 220400854
+Time for mpf_float_100 = 404.593 seconds
+Total allocations for mpf_float_100 = 212307349
+Time for cpp_float_100 = 1118.91 seconds
+Total allocations for cpp_float_100 = 0
+Time for mpfr_class (100 digits) = 541.35 seconds
+Total allocations for mpfr_class (100 digits) = 407154781
+Time for mpreal (100 digits) = 677.265 seconds
+Total allocations for mpreal (100 digits) = 724581024

Modified: sandbox/big_number/libs/multiprecision/performance/sf_performance.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/performance/sf_performance.cpp (original)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance.cpp 2012-01-01 06:37:46 EST (Sun, 01 Jan 2012)
@@ -9,6 +9,8 @@
 #include <boost/math/bindings/mpfr.hpp>
 #include <boost/math/bindings/mpreal.hpp>
 #include <boost/multiprecision/mpfr.hpp>
+#include <boost/multiprecision/gmp.hpp>
+#include <boost/multiprecision/cpp_float.hpp>
 #include <boost/math/special_functions/bessel.hpp>
 #include <boost/math/tools/rational.hpp>
 #include <boost/math/distributions/non_central_t.hpp>
@@ -43,6 +45,7 @@
 Real test_bessel()
 {
 # define T double
+# define SC_(x) x
 # include "libs/math/test/bessel_i_int_data.ipp"
 # include "libs/math/test/bessel_i_data.ipp"
 
@@ -184,6 +187,16 @@
    std::cout << "Time for mpfr_float_50 = " << time << std::endl;
    std::cout << "Total allocations for mpfr_float_50 = " << allocation_count << std::endl;
    allocation_count = 0;
+ test_bessel<boost::multiprecision::mpf_float_50>();
+ time = c.elapsed();
+ std::cout << "Time for mpf_float_50 = " << time << std::endl;
+ std::cout << "Total allocations for mpf_float_50 = " << allocation_count << std::endl;
+ allocation_count = 0;
+ test_bessel<boost::multiprecision::cpp_float_50>();
+ time = c.elapsed();
+ std::cout << "Time for cpp_float_50 = " << time << std::endl;
+ std::cout << "Total allocations for cpp_float_50 = " << allocation_count << std::endl;
+ allocation_count = 0;
    c.reset();
    test_bessel<mpfr_class>();
    time = c.elapsed();
@@ -208,6 +221,18 @@
    std::cout << "Total allocations for mpfr_float_50 = " << allocation_count << std::endl;
    allocation_count = 0;
    c.reset();
+ test_bessel<boost::multiprecision::mpf_float_100>();
+ time = c.elapsed();
+ std::cout << "Time for mpf_float_100 = " << time << std::endl;
+ std::cout << "Total allocations for mpf_float_100 = " << allocation_count << std::endl;
+ allocation_count = 0;
+ c.reset();
+ test_bessel<boost::multiprecision::cpp_float_100>();
+ time = c.elapsed();
+ std::cout << "Time for cpp_float_100 = " << time << std::endl;
+ std::cout << "Total allocations for cpp_float_100 = " << allocation_count << std::endl;
+ allocation_count = 0;
+ c.reset();
    test_bessel<mpfr_class>();
    time = c.elapsed();
    std::cout << "Time for mpfr_class (100 digits) = " << time << std::endl;
@@ -234,6 +259,18 @@
    std::cout << "Total allocations for mpfr_float_50 = " << allocation_count << std::endl;
    allocation_count = 0;
    c.reset();
+ test_polynomial<boost::multiprecision::mpf_float_50>();
+ time = c.elapsed();
+ std::cout << "Time for mpf_float_50 = " << time << std::endl;
+ std::cout << "Total allocations for mpf_float_50 = " << allocation_count << std::endl;
+ allocation_count = 0;
+ c.reset();
+ test_polynomial<boost::multiprecision::cpp_float_50>();
+ time = c.elapsed();
+ std::cout << "Time for cpp_float_50 = " << time << std::endl;
+ std::cout << "Total allocations for cpp_float_50 = " << allocation_count << std::endl;
+ allocation_count = 0;
+ c.reset();
    test_polynomial<mpfr_class>();
    time = c.elapsed();
    std::cout << "Time for mpfr_class (50 digits) = " << time << std::endl;
@@ -257,6 +294,18 @@
    std::cout << "Total allocations for mpfr_float_100 = " << allocation_count << std::endl;
    allocation_count = 0;
    c.reset();
+ test_polynomial<boost::multiprecision::mpf_float_100>();
+ time = c.elapsed();
+ std::cout << "Time for mpf_float_100 = " << time << std::endl;
+ std::cout << "Total allocations for mpf_float_100 = " << allocation_count << std::endl;
+ allocation_count = 0;
+ c.reset();
+ test_polynomial<boost::multiprecision::cpp_float_100>();
+ time = c.elapsed();
+ std::cout << "Time for cpp_float_100 = " << time << std::endl;
+ std::cout << "Total allocations for cpp_float_100 = " << allocation_count << std::endl;
+ allocation_count = 0;
+ c.reset();
    test_polynomial<mpfr_class>();
    time = c.elapsed();
    std::cout << "Time for mpfr_class (100 digits) = " << time << std::endl;
@@ -283,6 +332,18 @@
    std::cout << "Total allocations for mpfr_float_50 = " << allocation_count << std::endl;
    allocation_count = 0;
    c.reset();
+ test_nct<boost::multiprecision::mpf_float_50>();
+ time = c.elapsed();
+ std::cout << "Time for mpf_float_50 = " << time << std::endl;
+ std::cout << "Total allocations for mpf_float_50 = " << allocation_count << std::endl;
+ allocation_count = 0;
+ c.reset();
+ test_nct<boost::multiprecision::cpp_float_50>();
+ time = c.elapsed();
+ std::cout << "Time for cpp_float_50 = " << time << std::endl;
+ std::cout << "Total allocations for cpp_float_50 = " << allocation_count << std::endl;
+ allocation_count = 0;
+ c.reset();
    test_nct<mpfr_class>();
    time = c.elapsed();
    std::cout << "Time for mpfr_class (50 digits) = " << time << std::endl;
@@ -306,6 +367,18 @@
    std::cout << "Total allocations for mpfr_float_100 = " << allocation_count << std::endl;
    allocation_count = 0;
    c.reset();
+ test_nct<boost::multiprecision::mpf_float_100>();
+ time = c.elapsed();
+ std::cout << "Time for mpf_float_100 = " << time << std::endl;
+ std::cout << "Total allocations for mpf_float_100 = " << allocation_count << std::endl;
+ allocation_count = 0;
+ c.reset();
+ test_nct<boost::multiprecision::cpp_float_100>();
+ time = c.elapsed();
+ std::cout << "Time for cpp_float_100 = " << time << std::endl;
+ std::cout << "Total allocations for cpp_float_100 = " << allocation_count << std::endl;
+ allocation_count = 0;
+ c.reset();
    test_nct<mpfr_class>();
    time = c.elapsed();
    std::cout << "Time for mpfr_class (100 digits) = " << time << std::endl;


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