Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:50

0001 /*
0002  [auto_generated]
0003  boost/numeric/odeint/external/compute/compute_algebra.hpp
0004 
0005  [begin_description]
0006  An algebra for Boost.Compute vectors.
0007  [end_description]
0008 
0009  Copyright 2009-2011 Karsten Ahnert
0010  Copyright 2009-2011 Mario Mulansky
0011 
0012  Distributed under the Boost Software License, Version 1.0.
0013  (See accompanying file LICENSE_1_0.txt or
0014  copy at http://www.boost.org/LICENSE_1_0.txt)
0015  */
0016 
0017 
0018 #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_ALGEBRA_HPP_DEFINED
0019 #define BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_ALGEBRA_HPP_DEFINED
0020 
0021 #include <boost/preprocessor/repetition.hpp>
0022 #include <boost/compute.hpp>
0023 
0024 namespace boost {
0025 namespace numeric {
0026 namespace odeint {
0027 
0028 struct compute_algebra
0029 {
0030 
0031 #define BOOST_ODEINT_COMPUTE_STATE_PARAM(z, n, unused)                         \
0032             StateType ## n &s ## n,
0033 
0034 #define BOOST_ODEINT_COMPUTE_ALGEBRA(z, n, unused)                             \
0035     template< BOOST_PP_ENUM_PARAMS(n, class StateType), class Operation >      \
0036     static void for_each ## n(                                                 \
0037             BOOST_PP_REPEAT(n, BOOST_ODEINT_COMPUTE_STATE_PARAM, ~)            \
0038             Operation op                                                       \
0039             )                                                                  \
0040     {                                                                          \
0041         op( BOOST_PP_ENUM_PARAMS(n, s) );                                      \
0042     }
0043 
0044 BOOST_PP_REPEAT_FROM_TO(3, 9, BOOST_ODEINT_COMPUTE_ALGEBRA, ~)
0045 
0046 #undef BOOST_ODEINT_COMPUTE_ALGEBRA
0047 #undef BOOST_ODEINT_COMPUTE_STATE_PARAM
0048 
0049     template < class S >
0050     static typename S::value_type norm_inf( const S &s ) {
0051         typedef typename S::value_type value_type;
0052 
0053         BOOST_COMPUTE_FUNCTION(value_type, max_abs, (value_type, value_type),
0054         {
0055             return max(_1, fabs(_2));
0056         });
0057 
0058         return boost::compute::accumulate(s.begin(), s.end(), value_type(), max_abs);
0059     }
0060 };
0061 } // odeint
0062 } // numeric
0063 } // boost
0064 
0065 #endif