3 Modification of the implicit Euler method, works with the MTL4 matrix library only.
6 Copyright 2012-2013 Andreas Angelopoulos
7 Copyright 2012-2013 Karsten Ahnert
8 Copyright 2012-2013 Mario Mulansky
10 Distributed under the Boost Software License, Version 1.0.
11 (See accompanying file LICENSE_1_0.txt or
12 copy at http://www.boost.org/LICENSE_1_0.txt)
16 #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED
17 #define BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED
19 #include <boost/numeric/odeint/util/is_resizeable.hpp>
20 #include <boost/numeric/odeint/util/resize.hpp>
21 #include <boost/numeric/odeint/util/same_size.hpp>
23 #include <boost/numeric/mtl/vector/dense_vector.hpp>
24 #include <boost/numeric/mtl/matrix/dense2D.hpp>
25 #include <boost/numeric/mtl/matrix/compressed2D.hpp>
33 template< class Value , class Parameters >
34 struct is_resizeable< mtl::dense_vector< Value , Parameters > >
36 typedef boost::true_type type;
37 const static bool value = type::value;
40 template< class Value , class Parameters >
41 struct is_resizeable< mtl::dense2D< Value , Parameters > >
43 typedef boost::true_type type;
44 const static bool value = type::value;
47 template< class Value , class Parameters >
48 struct is_resizeable< mtl::compressed2D< Value , Parameters > >
50 typedef boost::true_type type;
51 const static bool value = type::value;
57 template< class Value , class Parameters >
58 struct same_size_impl< mtl::dense_vector< Value , Parameters > , mtl::dense_vector< Value , Parameters > >
60 static bool same_size( const mtl::dense_vector< Value , Parameters > &v1 ,
61 const mtl::dense_vector< Value , Parameters > &v2 )
63 return mtl::size( v1 ) == mtl::size( v2 );
67 template< class Value , class Parameters >
68 struct resize_impl< mtl::dense_vector< Value , Parameters > , mtl::dense_vector< Value , Parameters > >
70 static void resize( mtl::dense_vector< Value , Parameters > &v1 ,
71 const mtl::dense_vector< Value , Parameters > &v2 )
73 v1.change_dim( mtl::size( v2 ) );
79 template< class Value , class MatrixParameters , class VectorParameters >
80 struct same_size_impl< mtl::dense2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
82 static bool same_size( const mtl::dense2D< Value , MatrixParameters > &m ,
83 const mtl::dense_vector< Value , VectorParameters > &v )
85 return ( ( mtl::size( v ) == m.num_cols() ) && ( mtl::size( v ) == m.num_rows() ) );
89 template< class Value , class MatrixParameters , class VectorParameters >
90 struct resize_impl< mtl::dense2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
92 static void resize( mtl::dense2D< Value , MatrixParameters > &m ,
93 const mtl::dense_vector< Value , VectorParameters > &v )
95 m.change_dim( mtl::size( v ) , mtl::size( v ) , false );
102 template< class Value , class MatrixParameters , class VectorParameters >
103 struct same_size_impl< mtl::compressed2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
105 static bool same_size( const mtl::compressed2D< Value , MatrixParameters > &m ,
106 const mtl::dense_vector< Value , VectorParameters > &v )
108 return ( ( mtl::size( v ) == m.num_cols() ) && ( mtl::size( v ) == m.num_rows() ) );
112 template< class Value , class MatrixParameters , class VectorParameters >
113 struct resize_impl< mtl::compressed2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
115 static void resize( mtl::compressed2D< Value , MatrixParameters > &m ,
116 const mtl::dense_vector< Value , VectorParameters > &v )
118 m.change_dim( mtl::size( v ) , mtl::size( v ) );
129 } // namespace odeint
130 } // namespace numeric
133 #endif // BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED