Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*
0002 [begin_description]
0003 Modification of the implicit Euler method, works with the MTL4 matrix library only. 
0004 [end_description]
0005 
0006 Copyright 2012-2013 Andreas Angelopoulos
0007 Copyright 2012-2013 Karsten Ahnert
0008 Copyright 2012-2013 Mario Mulansky
0009 
0010 Distributed under the Boost Software License, Version 1.0.
0011 (See accompanying file LICENSE_1_0.txt or
0012 copy at http://www.boost.org/LICENSE_1_0.txt)
0013 */
0014 
0015 
0016 #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED
0017 #define BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED
0018 
0019 #include <boost/numeric/odeint/util/is_resizeable.hpp>
0020 #include <boost/numeric/odeint/util/resize.hpp>
0021 #include <boost/numeric/odeint/util/same_size.hpp>
0022 
0023 #include <boost/numeric/mtl/vector/dense_vector.hpp>
0024 #include <boost/numeric/mtl/matrix/dense2D.hpp>
0025 #include <boost/numeric/mtl/matrix/compressed2D.hpp>
0026 
0027 
0028 namespace boost {
0029 namespace numeric {
0030 namespace odeint {
0031 
0032 
0033 template< class Value , class Parameters >
0034 struct is_resizeable< mtl::dense_vector< Value , Parameters > >
0035 { 
0036     typedef boost::true_type type;
0037     const static bool value = type::value;
0038 };
0039 
0040 template< class Value , class Parameters >
0041 struct is_resizeable< mtl::dense2D< Value , Parameters > >
0042 {
0043     typedef boost::true_type type;
0044     const static bool value = type::value;
0045 };
0046 
0047 template< class Value , class Parameters >
0048 struct is_resizeable< mtl::compressed2D< Value , Parameters > >
0049 {
0050     typedef boost::true_type type;
0051     const static bool value = type::value;
0052 };
0053 
0054 
0055 
0056 
0057 template< class Value , class Parameters >
0058 struct same_size_impl< mtl::dense_vector< Value , Parameters > , mtl::dense_vector< Value , Parameters > >
0059 {
0060     static bool same_size( const mtl::dense_vector< Value , Parameters > &v1 ,
0061                            const mtl::dense_vector< Value , Parameters > &v2 )
0062     {
0063         return mtl::size( v1 ) == mtl::size( v2 );
0064     }
0065 };
0066 
0067 template< class Value , class Parameters >
0068 struct resize_impl< mtl::dense_vector< Value , Parameters > , mtl::dense_vector< Value , Parameters > >
0069 {
0070     static void resize( mtl::dense_vector< Value , Parameters > &v1 ,
0071                         const mtl::dense_vector< Value , Parameters > &v2 )
0072     {
0073         v1.change_dim( mtl::size( v2 ) );
0074     }
0075 };
0076 
0077 
0078 
0079 template< class Value , class MatrixParameters , class VectorParameters >
0080 struct same_size_impl< mtl::dense2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
0081 {
0082     static bool same_size( const mtl::dense2D< Value , MatrixParameters > &m , 
0083                            const mtl::dense_vector< Value , VectorParameters > &v )
0084     {
0085         return ( ( mtl::size( v ) == m.num_cols() ) && ( mtl::size( v ) == m.num_rows() ) );
0086     }
0087 };
0088 
0089 template< class Value , class MatrixParameters , class VectorParameters >
0090 struct resize_impl< mtl::dense2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
0091 {
0092     static void resize( mtl::dense2D< Value , MatrixParameters > &m , 
0093                         const mtl::dense_vector< Value , VectorParameters > &v )
0094     {
0095         m.change_dim( mtl::size( v ) , mtl::size( v ) , false );
0096     }
0097 };
0098 
0099 
0100 
0101 
0102 template< class Value , class MatrixParameters , class VectorParameters >
0103 struct same_size_impl< mtl::compressed2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
0104 {
0105     static bool same_size( const mtl::compressed2D< Value , MatrixParameters > &m , 
0106                            const mtl::dense_vector< Value , VectorParameters > &v )
0107     {
0108         return ( ( mtl::size( v ) == m.num_cols() ) && ( mtl::size( v ) == m.num_rows() ) );
0109     }
0110 };
0111 
0112 template< class Value , class MatrixParameters , class VectorParameters >
0113 struct resize_impl< mtl::compressed2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
0114 {
0115     static void resize( mtl::compressed2D< Value , MatrixParameters > &m , 
0116                         const mtl::dense_vector< Value , VectorParameters > &v )
0117     {
0118         m.change_dim( mtl::size( v ) , mtl::size( v ) );
0119     }
0120 };
0121 
0122 
0123 
0124 
0125 
0126 
0127 
0128 
0129 } // namespace odeint
0130 } // namespace numeric
0131 } // namespace boost
0132 
0133 #endif // BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED