Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*
0002  [auto_generated]
0003  boost/numeric/odeint/algebra/default_operations.hpp
0004 
0005  [begin_description]
0006  Default operations. They work with the default numerical types, like float, double, complex< double> ...
0007  [end_description]
0008 
0009  Copyright 2010-2012 Karsten Ahnert
0010  Copyright 2010-2013 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_ALGEBRA_DEFAULT_OPERATIONS_HPP_INCLUDED
0019 #define BOOST_NUMERIC_ODEINT_ALGEBRA_DEFAULT_OPERATIONS_HPP_INCLUDED
0020 
0021 #include <algorithm>
0022 
0023 #include <boost/config.hpp>
0024 #include <boost/array.hpp>
0025 
0026 #include <boost/numeric/odeint/util/unit_helper.hpp>
0027 
0028 
0029 namespace boost {
0030 namespace numeric {
0031 namespace odeint {
0032 
0033 
0034 
0035 /*
0036  * Notes:
0037  *
0038  * * the results structs are needed in order to work with fusion_algebra
0039  */
0040 struct default_operations
0041 {
0042 
0043     template< class Fac1 = double >
0044     struct scale
0045     {
0046         const Fac1 m_alpha1;
0047 
0048         scale( Fac1 alpha1 ) : m_alpha1( alpha1 ) { }
0049 
0050         template< class T1 >
0051         void operator()( T1 &t1 ) const
0052         {
0053             t1 *= m_alpha1;
0054         }
0055 
0056         typedef void result_type;
0057     };
0058 
0059     template< class Fac1 = double >
0060     struct scale_sum1
0061     {
0062         const Fac1 m_alpha1;
0063 
0064         scale_sum1( Fac1 alpha1 ) : m_alpha1( alpha1 ) { }
0065 
0066         template< class T1 , class T2 >
0067         void operator()( T1 &t1 , const T2 &t2 ) const
0068         {
0069             t1 = m_alpha1 * t2;
0070         }
0071 
0072         typedef void result_type;
0073     };
0074 
0075 
0076     template< class Fac1 = double , class Fac2 = Fac1 >
0077     struct scale_sum2
0078     {
0079         const Fac1 m_alpha1;
0080         const Fac2 m_alpha2;
0081 
0082         scale_sum2( Fac1 alpha1 , Fac2 alpha2 ) : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) { }
0083 
0084         template< class T1 , class T2 , class T3 >
0085         void operator()( T1 &t1 , const T2 &t2 , const T3 &t3) const
0086         {
0087             t1 = m_alpha1 * t2 + m_alpha2 * t3;
0088         }
0089 
0090         typedef void result_type;
0091     };
0092 
0093 
0094     template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 >
0095     struct scale_sum3
0096     {
0097         const Fac1 m_alpha1;
0098         const Fac2 m_alpha2;
0099         const Fac3 m_alpha3;
0100 
0101         scale_sum3( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 )
0102         : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) { }
0103 
0104         template< class T1 , class T2 , class T3 , class T4 >
0105         void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 ) const
0106         {
0107             t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4;
0108         }
0109 
0110         typedef void result_type;
0111     };
0112 
0113 
0114     template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 >
0115     struct scale_sum4
0116     {
0117         const Fac1 m_alpha1;
0118         const Fac2 m_alpha2;
0119         const Fac3 m_alpha3;
0120         const Fac4 m_alpha4;
0121 
0122         scale_sum4( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 )
0123         : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) { }
0124 
0125         template< class T1 , class T2 , class T3 , class T4 , class T5 >
0126         void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5) const
0127         {
0128             t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5;
0129         }
0130 
0131         typedef void result_type;
0132     };
0133 
0134 
0135     template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 >
0136     struct scale_sum5
0137     {
0138         const Fac1 m_alpha1;
0139         const Fac2 m_alpha2;
0140         const Fac3 m_alpha3;
0141         const Fac4 m_alpha4;
0142         const Fac5 m_alpha5;
0143 
0144         scale_sum5( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 , Fac5 alpha5 )
0145         : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) { }
0146 
0147         template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 >
0148         void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6) const
0149         {
0150             t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6;
0151         }
0152 
0153         typedef void result_type;
0154     };
0155 
0156 
0157     template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 >
0158     struct scale_sum6
0159     {
0160         const Fac1 m_alpha1;
0161         const Fac2 m_alpha2;
0162         const Fac3 m_alpha3;
0163         const Fac4 m_alpha4;
0164         const Fac5 m_alpha5;
0165         const Fac6 m_alpha6;
0166 
0167         scale_sum6( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 , Fac5 alpha5 , Fac6 alpha6 )
0168         : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ){ }
0169 
0170         template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 >
0171         void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 ,const T7 &t7) const
0172         {
0173             t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7;
0174         }
0175 
0176         typedef void result_type;
0177     };
0178 
0179 
0180     template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 >
0181     struct scale_sum7
0182     {
0183         const Fac1 m_alpha1;
0184         const Fac2 m_alpha2;
0185         const Fac3 m_alpha3;
0186         const Fac4 m_alpha4;
0187         const Fac5 m_alpha5;
0188         const Fac6 m_alpha6;
0189         const Fac7 m_alpha7;
0190 
0191         scale_sum7( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ,
0192                 Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 )
0193         : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) { }
0194 
0195         template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 >
0196         void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 ) const
0197         {
0198             t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8;
0199         }
0200 
0201         typedef void result_type;
0202     };
0203 
0204 
0205     template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 >
0206     struct scale_sum8
0207     {
0208         const Fac1 m_alpha1;
0209         const Fac2 m_alpha2;
0210         const Fac3 m_alpha3;
0211         const Fac4 m_alpha4;
0212         const Fac5 m_alpha5;
0213         const Fac6 m_alpha6;
0214         const Fac7 m_alpha7;
0215         const Fac8 m_alpha8;
0216 
0217         scale_sum8( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ,
0218                 Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 )
0219         : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) { }
0220 
0221         template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 >
0222         void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 ) const
0223         {
0224             t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9;
0225         }
0226 
0227         typedef void result_type;
0228     };
0229 
0230     template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 >
0231     struct scale_sum9
0232     {
0233         const Fac1 m_alpha1;
0234         const Fac2 m_alpha2;
0235         const Fac3 m_alpha3;
0236         const Fac4 m_alpha4;
0237         const Fac5 m_alpha5;
0238         const Fac6 m_alpha6;
0239         const Fac7 m_alpha7;
0240         const Fac8 m_alpha8;
0241         const Fac9 m_alpha9;
0242 
0243         scale_sum9( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ,
0244                 Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 )
0245         : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) { }
0246 
0247         template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 >
0248         void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 ) const
0249         {
0250             t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10;
0251         }
0252 
0253         typedef void result_type;
0254     };
0255 
0256     template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 , class Fac10 = Fac9 >
0257     struct scale_sum10
0258     {
0259         const Fac1 m_alpha1;
0260         const Fac2 m_alpha2;
0261         const Fac3 m_alpha3;
0262         const Fac4 m_alpha4;
0263         const Fac5 m_alpha5;
0264         const Fac6 m_alpha6;
0265         const Fac7 m_alpha7;
0266         const Fac8 m_alpha8;
0267         const Fac9 m_alpha9;
0268         const Fac10 m_alpha10;
0269 
0270         scale_sum10( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ,
0271                 Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 , Fac10 alpha10 )
0272         : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) , m_alpha10( alpha10 ) { }
0273 
0274         template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 >
0275         void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 , const T11 &t11 ) const
0276         {
0277             t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10 + m_alpha10 * t11;
0278         }
0279 
0280         typedef void result_type;
0281     };
0282 
0283 
0284     template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 , class Fac10 = Fac9 , class Fac11 = Fac10 >
0285     struct scale_sum11
0286     {
0287         const Fac1 m_alpha1;
0288         const Fac2 m_alpha2;
0289         const Fac3 m_alpha3;
0290         const Fac4 m_alpha4;
0291         const Fac5 m_alpha5;
0292         const Fac6 m_alpha6;
0293         const Fac7 m_alpha7;
0294         const Fac8 m_alpha8;
0295         const Fac9 m_alpha9;
0296         const Fac10 m_alpha10;
0297         const Fac11 m_alpha11;
0298 
0299         scale_sum11( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ,
0300                 Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 ,
0301                 Fac10 alpha10 , Fac11 alpha11 )
0302         : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) , m_alpha10( alpha10 ) , m_alpha11( alpha11 ) { }
0303 
0304         template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 >
0305         void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 , const T11 &t11 , const T12 &t12 ) const
0306         {
0307             t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10 + m_alpha10 * t11 + m_alpha11 * t12;
0308         }
0309 
0310         typedef void result_type;
0311     };
0312 
0313     template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 , class Fac10 = Fac9 , class Fac11 = Fac10 , class Fac12 = Fac11 >
0314     struct scale_sum12
0315     {
0316         const Fac1 m_alpha1;
0317         const Fac2 m_alpha2;
0318         const Fac3 m_alpha3;
0319         const Fac4 m_alpha4;
0320         const Fac5 m_alpha5;
0321         const Fac6 m_alpha6;
0322         const Fac7 m_alpha7;
0323         const Fac8 m_alpha8;
0324         const Fac9 m_alpha9;
0325         const Fac10 m_alpha10;
0326         const Fac11 m_alpha11;
0327         const Fac12 m_alpha12;
0328 
0329         scale_sum12( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ,
0330                 Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 ,
0331                 Fac10 alpha10 , Fac11 alpha11 , Fac12 alpha12 )
0332         : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) , m_alpha10( alpha10 ) , m_alpha11( alpha11 ) , m_alpha12( alpha12 ) { }
0333 
0334         template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 >
0335         void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 , const T11 &t11 , const T12 &t12 , const T13 &t13 ) const
0336         {
0337             t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10 + m_alpha10 * t11 + m_alpha11 * t12 + m_alpha12 * t13;
0338         }
0339 
0340         typedef void result_type;
0341     };
0342 
0343     template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 , class Fac10 = Fac9 , class Fac11 = Fac10 , class Fac12 = Fac11 , class Fac13 = Fac12 >
0344     struct scale_sum13
0345     {
0346         const Fac1 m_alpha1;
0347         const Fac2 m_alpha2;
0348         const Fac3 m_alpha3;
0349         const Fac4 m_alpha4;
0350         const Fac5 m_alpha5;
0351         const Fac6 m_alpha6;
0352         const Fac7 m_alpha7;
0353         const Fac8 m_alpha8;
0354         const Fac9 m_alpha9;
0355         const Fac10 m_alpha10;
0356         const Fac11 m_alpha11;
0357         const Fac12 m_alpha12;
0358         const Fac13 m_alpha13;
0359 
0360         scale_sum13( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ,
0361                 Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 ,
0362                 Fac10 alpha10 , Fac11 alpha11 , Fac12 alpha12 , Fac13 alpha13 )
0363         : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) , m_alpha10( alpha10 ) , m_alpha11( alpha11 ) , m_alpha12( alpha12 ) , m_alpha13( alpha13 ) { }
0364 
0365         template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 >
0366         void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 , const T11 &t11 , const T12 &t12 , const T13 &t13 , const T14 &t14 ) const
0367         {
0368             t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10 + m_alpha10 * t11 + m_alpha11 * t12 + m_alpha12 * t13 + m_alpha13 * t14;
0369         }
0370 
0371         typedef void result_type;
0372     };
0373 
0374     template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 , class Fac10 = Fac9 , class Fac11 = Fac10 , class Fac12 = Fac11 , class Fac13 = Fac12 , class Fac14 = Fac13 >
0375     struct scale_sum14
0376     {
0377         const Fac1 m_alpha1;
0378         const Fac2 m_alpha2;
0379         const Fac3 m_alpha3;
0380         const Fac4 m_alpha4;
0381         const Fac5 m_alpha5;
0382         const Fac6 m_alpha6;
0383         const Fac7 m_alpha7;
0384         const Fac8 m_alpha8;
0385         const Fac9 m_alpha9;
0386         const Fac10 m_alpha10;
0387         const Fac11 m_alpha11;
0388         const Fac12 m_alpha12;
0389         const Fac13 m_alpha13;
0390         const Fac14 m_alpha14;
0391 
0392         scale_sum14( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ,
0393                 Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 ,
0394                 Fac10 alpha10 , Fac11 alpha11 , Fac12 alpha12 , Fac13 alpha13 , Fac14 alpha14 )
0395         : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) , m_alpha10( alpha10 ) , m_alpha11( alpha11 ) , m_alpha12( alpha12 ) , m_alpha13( alpha13 ) , m_alpha14( alpha14 ) { }
0396 
0397         template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 >
0398         void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 , const T11 &t11 , const T12 &t12 , const T13 &t13 , const T14 &t14 , const T15 &t15 ) const
0399         {
0400             t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10 + m_alpha10 * t11 + m_alpha11 * t12 + m_alpha12 * t13 + m_alpha13 * t14 + m_alpha14 * t15;
0401         }
0402 
0403         typedef void result_type;
0404     };
0405 
0406     template< class Fac1 = double , class Fac2 = Fac1 >
0407     struct scale_sum_swap2
0408     {
0409         const Fac1 m_alpha1;
0410         const Fac2 m_alpha2;
0411 
0412         scale_sum_swap2( Fac1 alpha1 , Fac2 alpha2 ) : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) { }
0413 
0414         template< class T1 , class T2 , class T3 >
0415         void operator()( T1 &t1 , T2 &t2 , const T3 &t3) const
0416         {
0417             const T1 tmp( t1 );
0418             t1 = m_alpha1 * t2 + m_alpha2 * t3;
0419             t2 = tmp;
0420         }
0421 
0422         typedef void result_type;
0423     };
0424 
0425     /*
0426      * for usage in for_each2
0427      *
0428      * Works with boost::units by eliminating the unit
0429      */
0430     template< class Fac1 = double >
0431     struct rel_error
0432     {
0433         const Fac1 m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt;
0434 
0435         rel_error( Fac1 eps_abs , Fac1 eps_rel , Fac1 a_x , Fac1 a_dxdt )
0436         : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) , m_a_x( a_x ) , m_a_dxdt( a_dxdt ) { }
0437 
0438 
0439         template< class T1 , class T2 , class T3 >
0440         void operator()( T3 &t3 , const T1 &t1 , const T2 &t2 ) const
0441         {
0442             using std::abs;
0443             set_unit_value( t3 , abs( get_unit_value( t3 ) ) / ( m_eps_abs + m_eps_rel * ( m_a_x * abs( get_unit_value( t1 ) ) + m_a_dxdt * abs( get_unit_value( t2 ) ) ) ) );
0444         }
0445 
0446         typedef void result_type;
0447     };
0448 
0449 
0450     /*
0451      * for usage in for_each3
0452      *
0453      * used in the controller for the rosenbrock4 method
0454      *
0455      * Works with boost::units by eliminating the unit
0456      */
0457     template< class Fac1 = double >
0458     struct default_rel_error
0459     {
0460         const Fac1 m_eps_abs , m_eps_rel ;
0461 
0462         default_rel_error( Fac1 eps_abs , Fac1 eps_rel )
0463         : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) { }
0464 
0465 
0466         /*
0467          * xerr = xerr / ( eps_abs + eps_rel * max( x , x_old ) )
0468          */
0469         template< class T1 , class T2 , class T3 >
0470         void operator()( T3 &t3 , const T1 &t1 , const T2 &t2 ) const
0471         {
0472             BOOST_USING_STD_MAX();
0473             using std::abs;
0474             Fac1 x1 = abs( get_unit_value( t1 ) ) , x2 = abs( get_unit_value( t2 ) );
0475             set_unit_value( t3 , abs( get_unit_value( t3 ) ) / ( m_eps_abs + m_eps_rel * max BOOST_PREVENT_MACRO_SUBSTITUTION ( x1 , x2 ) ) );
0476         }
0477 
0478         typedef void result_type;
0479     };
0480 
0481 
0482 
0483     /*
0484      * for usage in reduce
0485      */
0486 
0487     template< class Value >
0488     struct maximum
0489     {
0490         template< class Fac1 , class Fac2 >
0491         Value operator()( Fac1 t1 , const Fac2 t2 ) const
0492         {
0493             using std::abs;
0494             Value a1 = abs( get_unit_value( t1 ) ) , a2 = abs( get_unit_value( t2 ) );
0495             return ( a1 < a2 ) ? a2 : a1 ;
0496         }
0497 
0498         typedef Value result_type;
0499     };
0500 
0501 
0502     template< class Fac1 = double >
0503     struct rel_error_max
0504     {
0505         const Fac1 m_eps_abs , m_eps_rel;
0506 
0507         rel_error_max( Fac1 eps_abs , Fac1 eps_rel )
0508         : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel )
0509         { }
0510 
0511         template< class Res , class T1 , class T2 , class T3 >
0512         Res operator()( Res r , const T1 &x_old , const T2 &x , const T3 &x_err )
0513         {
0514             BOOST_USING_STD_MAX();
0515             using std::abs;
0516             Res tmp = abs( get_unit_value( x_err ) ) / ( m_eps_abs + m_eps_rel * max BOOST_PREVENT_MACRO_SUBSTITUTION ( abs( x_old ) , abs( x ) ) );
0517             return max BOOST_PREVENT_MACRO_SUBSTITUTION ( r , tmp );
0518         }
0519     };
0520 
0521 
0522     template< class Fac1 = double >
0523     struct rel_error_max2
0524     {
0525         const Fac1 m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt;
0526 
0527         rel_error_max2( Fac1 eps_abs , Fac1 eps_rel , Fac1 a_x , Fac1 a_dxdt )
0528         : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) , m_a_x( a_x ) , m_a_dxdt( a_dxdt )
0529         { }
0530 
0531         template< class Res , class T1 , class T2 , class T3 , class T4 >
0532         Res operator()( Res r , const T1 &x_old , const T2 &/*x*/ , const T3 &dxdt_old , const T4 &x_err )
0533         {
0534             BOOST_USING_STD_MAX();
0535             using std::abs;
0536             Res tmp = abs( get_unit_value( x_err ) ) /
0537                     ( m_eps_abs + m_eps_rel * ( m_a_x * abs( get_unit_value( x_old ) ) + m_a_dxdt * abs( get_unit_value( dxdt_old ) ) ) );
0538             return max BOOST_PREVENT_MACRO_SUBSTITUTION ( r , tmp );
0539         }
0540     };
0541 
0542 
0543 
0544 
0545     template< class Fac1 = double >
0546     struct rel_error_l2
0547     {
0548         const Fac1 m_eps_abs , m_eps_rel;
0549 
0550         rel_error_l2( Fac1 eps_abs , Fac1 eps_rel )
0551         : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel )
0552         { }
0553 
0554         template< class Res , class T1 , class T2 , class T3 >
0555         Res operator()( Res r , const T1 &x_old , const T2 &x , const T3 &x_err )
0556         {
0557             BOOST_USING_STD_MAX();
0558             using std::abs;
0559             Res tmp = abs( get_unit_value( x_err ) ) / ( m_eps_abs + m_eps_rel * max BOOST_PREVENT_MACRO_SUBSTITUTION ( abs( x_old ) , abs( x ) ) );
0560             return r + tmp * tmp;
0561         }
0562     };
0563 
0564 
0565 
0566 
0567     template< class Fac1 = double >
0568     struct rel_error_l2_2
0569     {
0570         const Fac1 m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt;
0571 
0572         rel_error_l2_2( Fac1 eps_abs , Fac1 eps_rel , Fac1 a_x , Fac1 a_dxdt )
0573         : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) , m_a_x( a_x ) , m_a_dxdt( a_dxdt )
0574         { }
0575 
0576         template< class Res , class T1 , class T2 , class T3 , class T4 >
0577         Res operator()( Res r , const T1 &x_old , const T2 &/*x*/ , const T3 &dxdt_old , const T4 &x_err )
0578         {
0579             using std::abs;
0580             Res tmp = abs( get_unit_value( x_err ) ) /
0581                     ( m_eps_abs + m_eps_rel * ( m_a_x * abs( get_unit_value( x_old ) ) + m_a_dxdt * abs( get_unit_value( dxdt_old ) ) ) );
0582             return r + tmp * tmp;
0583         }
0584     };
0585 
0586 
0587 
0588 
0589 
0590 
0591 };
0592 
0593 
0594 } // odeint
0595 } // numeric
0596 } // boost
0597 
0598 
0599 #endif // BOOST_NUMERIC_ODEINT_ALGEBRA_DEFAULT_OPERATIONS_HPP_INCLUDED