1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_NORM_INF_HPP_DEFINED
- #define BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_NORM_INF_HPP_DEFINED
- #include <map>
- #include <algorithm>
- #include <vexcl/vector.hpp>
- #include <vexcl/multivector.hpp>
- #include <vexcl/reductor.hpp>
- #include <boost/numeric/odeint/algebra/vector_space_algebra.hpp>
- namespace boost {
- namespace numeric {
- namespace odeint {
- template <typename T>
- struct vector_space_norm_inf< vex::vector<T> > {
- typedef T result_type;
- T operator()( const vex::vector<T> &x ) const {
- const auto &max = vex::get_reductor<T, vex::MAX>(x.queue_list());
- return max( fabs(x) );
- }
- };
- template <typename T, size_t N>
- struct vector_space_norm_inf< vex::multivector<T, N> > {
- typedef T result_type;
- T operator()( const vex::multivector<T, N> &x ) const {
- const auto &max = vex::get_reductor<T, vex::MAX>(x.queue_list());
-
- auto m = max( fabs(x) );
-
- return *std::max_element(m.begin(), m.end());
- }
- };
- }
- }
- }
- #endif
|