Files
externals/linux/include/ActivBoost/numeric/odeint/external/compute/compute_algebra.hpp
T
2023-12-15 13:15:08 -05:00

66 lines
2.1 KiB
C++

/*
[auto_generated]
ActivBoost/numeric/odeint/external/compute/compute_algebra.hpp
[begin_description]
An algebra for Boost.Compute vectors.
[end_description]
Copyright 2009-2011 Karsten Ahnert
Copyright 2009-2011 Mario Mulansky
Distributed under 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 ACTIV_BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_ALGEBRA_HPP_DEFINED
#define ACTIV_BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_ALGEBRA_HPP_DEFINED
#include <ActivBoost/preprocessor/repetition.hpp>
#include <ActivBoost/compute.hpp>
namespace Boost {
namespace numeric {
namespace odeint {
struct compute_algebra
{
#define ACTIV_BOOST_ODEINT_COMPUTE_STATE_PARAM(z, n, unused) \
StateType ## n &s ## n,
#define ACTIV_BOOST_ODEINT_COMPUTE_ALGEBRA(z, n, unused) \
template< ACTIV_BOOST_PP_ENUM_PARAMS(n, class StateType), class Operation > \
static void for_each ## n( \
ACTIV_BOOST_PP_REPEAT(n, ACTIV_BOOST_ODEINT_COMPUTE_STATE_PARAM, ~) \
Operation op \
) \
{ \
op( ACTIV_BOOST_PP_ENUM_PARAMS(n, s) ); \
}
ACTIV_BOOST_PP_REPEAT_FROM_TO(3, 9, ACTIV_BOOST_ODEINT_COMPUTE_ALGEBRA, ~)
#undef ACTIV_BOOST_ODEINT_COMPUTE_ALGEBRA
#undef ACTIV_BOOST_ODEINT_COMPUTE_STATE_PARAM
template < class S >
static typename S::value_type norm_inf( const S &s ) {
typedef typename S::value_type value_type;
ACTIV_BOOST_COMPUTE_FUNCTION(value_type, max_abs, (value_type, value_type),
{
return max(_1, fabs(_2));
});
return Boost::compute::accumulate(s.begin(), s.end(), value_type(), max_abs);
}
};
} // odeint
} // numeric
} // boost
#endif