]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/numeric/odeint/include/boost/numeric/odeint/external/compute/compute_algebra.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / numeric / odeint / include / boost / numeric / odeint / external / compute / compute_algebra.hpp
1 /*
2 [auto_generated]
3 boost/numeric/odeint/external/compute/compute_algebra.hpp
4
5 [begin_description]
6 An algebra for Boost.Compute vectors.
7 [end_description]
8
9 Copyright 2009-2011 Karsten Ahnert
10 Copyright 2009-2011 Mario Mulansky
11
12 Distributed under the Boost Software License, Version 1.0.
13 (See accompanying file LICENSE_1_0.txt or
14 copy at http://www.boost.org/LICENSE_1_0.txt)
15 */
16
17
18 #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_ALGEBRA_HPP_DEFINED
19 #define BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_ALGEBRA_HPP_DEFINED
20
21 #include <boost/preprocessor/repetition.hpp>
22 #include <boost/compute.hpp>
23
24 namespace boost {
25 namespace numeric {
26 namespace odeint {
27
28 struct compute_algebra
29 {
30
31 #define BOOST_ODEINT_COMPUTE_STATE_PARAM(z, n, unused) \
32 StateType ## n &s ## n,
33
34 #define BOOST_ODEINT_COMPUTE_ALGEBRA(z, n, unused) \
35 template< BOOST_PP_ENUM_PARAMS(n, class StateType), class Operation > \
36 static void for_each ## n( \
37 BOOST_PP_REPEAT(n, BOOST_ODEINT_COMPUTE_STATE_PARAM, ~) \
38 Operation op \
39 ) \
40 { \
41 op( BOOST_PP_ENUM_PARAMS(n, s) ); \
42 }
43
44 BOOST_PP_REPEAT_FROM_TO(3, 9, BOOST_ODEINT_COMPUTE_ALGEBRA, ~)
45
46 #undef BOOST_ODEINT_COMPUTE_ALGEBRA
47 #undef BOOST_ODEINT_COMPUTE_STATE_PARAM
48
49 template < class S >
50 static typename S::value_type norm_inf( const S &s ) {
51 typedef typename S::value_type value_type;
52
53 BOOST_COMPUTE_FUNCTION(value_type, max_abs, (value_type, value_type),
54 {
55 return max(_1, fabs(_2));
56 });
57
58 return boost::compute::accumulate(s.begin(), s.end(), value_type(), max_abs);
59 }
60 };
61 } // odeint
62 } // numeric
63 } // boost
64
65 #endif