File indexing completed on 2025-01-18 09:42:50
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_MULTI_ARRAY_ALGEBRA_HPP_DEFINED
0019 #define BOOST_NUMERIC_ODEINT_ALGEBRA_MULTI_ARRAY_ALGEBRA_HPP_DEFINED
0020
0021
0022 #include <boost/multi_array.hpp>
0023
0024 #include <boost/numeric/odeint/algebra/detail/for_each.hpp>
0025 #include <boost/numeric/odeint/algebra/detail/norm_inf.hpp>
0026 #include <boost/numeric/odeint/algebra/norm_result_type.hpp>
0027 #include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
0028
0029
0030 namespace boost {
0031 namespace numeric {
0032 namespace odeint {
0033
0034
0035 struct multi_array_algebra
0036 {
0037 template< class S1 , class Op >
0038 static void for_each1( S1 &s1 , Op op )
0039 {
0040 detail::for_each1( s1.data() , s1.data() + s1.num_elements() , op );
0041 }
0042
0043 template< class S1 , class S2 , class Op >
0044 static void for_each2( S1 &s1 , S2 &s2 , Op op )
0045 {
0046 detail::for_each2( s1.data() , s1.data() + s1.num_elements() , s2.data() , op );
0047 }
0048
0049 template< class S1 , class S2 , class S3 , class Op >
0050 static void for_each3( S1 &s1 , S2 &s2 , S3 &s3 , Op op )
0051 {
0052 detail::for_each3( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , op );
0053 }
0054
0055 template< class S1 , class S2 , class S3 , class S4 , class Op >
0056 static void for_each4( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , Op op )
0057 {
0058 detail::for_each4( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , op );
0059 }
0060
0061 template< class S1 , class S2 , class S3 , class S4 , class S5 , class Op >
0062 static void for_each5( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , Op op )
0063 {
0064 detail::for_each5( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , op );
0065 }
0066
0067 template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class Op >
0068 static void for_each6( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , Op op )
0069 {
0070 detail::for_each6( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , op );
0071 }
0072
0073 template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class Op >
0074 static void for_each7( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , Op op )
0075 {
0076 detail::for_each7( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , op );
0077 }
0078
0079 template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class Op >
0080 static void for_each8( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , Op op )
0081 {
0082 detail::for_each8( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , s8.data() , op );
0083 }
0084
0085 template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class Op >
0086 static void for_each9( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , Op op )
0087 {
0088 detail::for_each9( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , s8.data() , s9.data() , op );
0089 }
0090
0091 template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class Op >
0092 static void for_each10( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , Op op )
0093 {
0094 detail::for_each10( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , s8.data() , s9.data() , s10.data() , op );
0095 }
0096
0097 template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class Op >
0098 static void for_each11( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , Op op )
0099 {
0100 detail::for_each11( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , s8.data() , s9.data() , s10.data() , s11.data() , op );
0101 }
0102
0103 template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class Op >
0104 static void for_each12( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , Op op )
0105 {
0106 detail::for_each12( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , s8.data() , s9.data() , s10.data() , s11.data() , s12.data() , op );
0107 }
0108
0109 template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class Op >
0110 static void for_each13( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , Op op )
0111 {
0112 detail::for_each13( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , s8.data() , s9.data() , s10.data() , s11.data() , s12.data() , s13.data() , op );
0113 }
0114
0115 template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class Op >
0116 static void for_each14( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , Op op )
0117 {
0118 detail::for_each14( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , s8.data() , s9.data() , s10.data() , s11.data() , s12.data() , s13.data() , s14.data() , op );
0119 }
0120
0121 template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class S15 , class Op >
0122 static void for_each15( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , S15 &s15 , Op op )
0123 {
0124 detail::for_each15( s1.data() , s1.data() + s1.num_elements() , s2.data() , s3.data() , s4.data() , s5.data() , s6.data() , s7.data() , s8.data() , s9.data() , s10.data() , s11.data() , s12.data() , s13.data() , s14.data() , s15.data() , op );
0125 }
0126
0127 template< typename S >
0128 static typename norm_result_type<S>::type norm_inf( const S &s )
0129 {
0130 return detail::norm_inf( s.data() , s.data() + s.num_elements() , static_cast< typename norm_result_type<S>::type >( 0 ) );
0131 }
0132 };
0133
0134 template< class T , size_t N >
0135 struct algebra_dispatcher< boost::multi_array< T , N > >
0136 {
0137 typedef multi_array_algebra algebra_type;
0138 };
0139
0140
0141 }
0142 }
0143 }
0144
0145
0146 #endif