]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/numeric/odeint/include/boost/numeric/odeint/external/vexcl/vexcl_norm_inf.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / numeric / odeint / include / boost / numeric / odeint / external / vexcl / vexcl_norm_inf.hpp
1 /*
2 [auto_generated]
3 boost/numeric/odeint/external/vexcl/vexcl_norm_inf.hpp
4
5 [begin_description]
6 vector_space_norm_inf specialization for vexcl
7 [end_description]
8
9 Copyright 2009-2013 Karsten Ahnert
10 Copyright 2009-2013 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_VEXCL_VEXCL_NORM_INF_HPP_DEFINED
19 #define BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_NORM_INF_HPP_DEFINED
20
21 #include <map>
22 #include <algorithm>
23
24 #include <vexcl/vector.hpp>
25 #include <vexcl/multivector.hpp>
26 #include <vexcl/reductor.hpp>
27
28 #include <boost/numeric/odeint/algebra/vector_space_algebra.hpp>
29
30 namespace boost {
31 namespace numeric {
32 namespace odeint {
33
34 // specialization for vexcl vector
35 template <typename T>
36 struct vector_space_norm_inf< vex::vector<T> > {
37 typedef T result_type;
38
39 T operator()( const vex::vector<T> &x ) const {
40 const auto &max = vex::get_reductor<T, vex::MAX>(x.queue_list());
41
42 return max( fabs(x) );
43 }
44 };
45
46 // specialization for vexcl multivector
47 template <typename T, size_t N>
48 struct vector_space_norm_inf< vex::multivector<T, N> > {
49 typedef T result_type;
50
51 T operator()( const vex::multivector<T, N> &x ) const {
52 const auto &max = vex::get_reductor<T, vex::MAX>(x.queue_list());
53
54 // Reducing a multivector results in std::array<T, N>:
55 auto m = max( fabs(x) );
56
57 // We will need to reduce it even further:
58 return *std::max_element(m.begin(), m.end());
59 }
60 };
61
62
63 } // namespace odeint
64 } // namespace numeric
65 } // namespace boost
66
67
68 #endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_NORM_INF_HPP_DEFINED