Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53592 - in sandbox/numeric_adaptor/libs/numeric_adaptor/test: . perf
From: bruno.lalande_at_[hidden]
Date: 2009-06-03 05:54:57


Author: bruno.lalande
Date: 2009-06-03 05:54:56 EDT (Wed, 03 Jun 2009)
New Revision: 53592
URL: http://svn.boost.org/trac/boost/changeset/53592

Log:
Moved perf test in a separate directory.
Added:
   sandbox/numeric_adaptor/libs/numeric_adaptor/test/perf/
   sandbox/numeric_adaptor/libs/numeric_adaptor/test/perf/Jamroot (contents, props changed)
   sandbox/numeric_adaptor/libs/numeric_adaptor/test/perf/perf.cpp (props changed)
      - copied unchanged from r53591, /sandbox/numeric_adaptor/libs/numeric_adaptor/test/perf.cpp
Removed:
   sandbox/numeric_adaptor/libs/numeric_adaptor/test/perf.cpp

Deleted: sandbox/numeric_adaptor/libs/numeric_adaptor/test/perf.cpp
==============================================================================
--- sandbox/numeric_adaptor/libs/numeric_adaptor/test/perf.cpp 2009-06-03 05:54:56 EDT (Wed, 03 Jun 2009)
+++ (empty file)
@@ -1,118 +0,0 @@
-// Numeric Adaptor Library testing suite
-//
-// Copyright Barend Gehrels 2009, Geodan Holding B.V. Amsterdam, the Netherlands.
-// Copyright Bruno Lalande 2009
-// Use, modification and distribution is 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)
-
-
-#include <boost/numeric_adaptor/numeric_adaptor.hpp>
-#include <boost/numeric_adaptor/ieee_policy.hpp>
-
-#if defined(HAVE_GMP)
-# include <boost/numeric_adaptor/gmp_policy.hpp>
-#endif
-
-#if defined(HAVE_CLN)
-# include <boost/numeric_adaptor/cln_policy.hpp>
-#endif
-
-
-#include <boost/timer.hpp>
-
-
-using namespace boost::numeric_adaptor;
-
-
-template <typename T, typename Policy>
-inline T heron(T const& ta, T const& tb, T const& tc)
-{
- typedef numeric_adaptor<Policy> num;
-
- num a(ta);
- num b(tb);
- num c(tc);
- num s = (a + b + c) / num(2.0);
- return T(num::sqrt(s * (s - a) * (s - b) * (s - c)));
-}
-
-
-template <typename T>
-inline T heron_direct(T const& a, T const& b, T const& c)
-{
- T s = (a + b + c) / 2.0;
- return sqrt(s * (s - a) * (s - b) * (s - c));
-}
-
-
-int main()
-{
- //long long int n = 1000000000;
- long long int n = 1000000;
- try
- {
- {
- boost::timer t;
-
- double s = 0;
- for (long long int i = 0; i < n; i++)
- {
- s += heron<double, ieee_policy<double> >(31622.77662, 0.000023, 31622.77661);
- }
- std::cout << "using policy, sum: " << s << " time: " << t.elapsed() << std::endl;
- }
-
- {
- boost::timer t;
-
- double s = 0;
- for (long long int i = 0; i < n; i++)
- {
- s += heron_direct<double>(31622.77662, 0.000023, 31622.77661);
- }
- std::cout << "using direct, sum: " << s << " time: " << t.elapsed() << std::endl;
- }
-
-
-
-
-#if defined(HAVE_CLN)
- {
- boost::timer t;
-
- double s = 0;
- for (long long int i = 0; i < n; i++)
- {
- s += heron<double, cln_policy>(31622.77662, 0.000023, 31622.77661);
- }
- std::cout << "using CLN, sum: " << s << " time: " << t.elapsed() << std::endl;
- }
-#endif
-
-#if defined(HAVE_GMP)
- {
- boost::timer t;
-
- double s = 0;
- for (long long int i = 0; i < n; i++)
- {
- //s += heron<double, gmp_policy>(31622.77662, 0.000023, 31622.77661);
- }
- std::cout << "using GMP, sum: " << s << " time: " << t.elapsed() << std::endl;
- }
-#endif
-
-
- }
- catch(std::exception const& e)
- {
- std::cout << "Exception: " << e.what() << std::endl;
- }
- catch(...)
- {
- std::cout << "Exception, unknown" << std::endl;
- }
-
- return 0;
-};

Added: sandbox/numeric_adaptor/libs/numeric_adaptor/test/perf/Jamroot
==============================================================================
--- (empty file)
+++ sandbox/numeric_adaptor/libs/numeric_adaptor/test/perf/Jamroot 2009-06-03 05:54:56 EDT (Wed, 03 Jun 2009)
@@ -0,0 +1,19 @@
+# Boost Numeric Adaptor testing suite
+#
+# Copyright Bruno Lalande 2009
+# Copyright Barend Gehrels 2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+# Use, modification and distribution is 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)
+
+
+lib gmp : : <name>gmp ;
+lib cln : : <name>cln ;
+
+project : requirements
+ <include>../../../..
+ <library>gmp <define>HAVE_GMP
+ <library>cln <define>HAVE_CLN
+;
+
+exe perf : perf.cpp ;


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