]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/numeric/odeint/include/boost/numeric/odeint/external/mtl4/mtl4_resize.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / numeric / odeint / include / boost / numeric / odeint / external / mtl4 / mtl4_resize.hpp
CommitLineData
7c673cae
FG
1/*
2[begin_description]
3Modification of the implicit Euler method, works with the MTL4 matrix library only.
4[end_description]
5
6Copyright 2012-2013 Andreas Angelopoulos
7Copyright 2012-2013 Karsten Ahnert
8Copyright 2012-2013 Mario Mulansky
9
10Distributed under the Boost Software License, Version 1.0.
11(See accompanying file LICENSE_1_0.txt or
12copy at http://www.boost.org/LICENSE_1_0.txt)
13*/
14
15
16#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED
17#define BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED
18
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>
22
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>
26
27
28namespace boost {
29namespace numeric {
30namespace odeint {
31
32
33template< class Value , class Parameters >
34struct is_resizeable< mtl::dense_vector< Value , Parameters > >
35{
36 typedef boost::true_type type;
37 const static bool value = type::value;
38};
39
40template< class Value , class Parameters >
41struct is_resizeable< mtl::dense2D< Value , Parameters > >
42{
43 typedef boost::true_type type;
44 const static bool value = type::value;
45};
46
47template< class Value , class Parameters >
48struct is_resizeable< mtl::compressed2D< Value , Parameters > >
49{
50 typedef boost::true_type type;
51 const static bool value = type::value;
52};
53
54
55
56
57template< class Value , class Parameters >
58struct same_size_impl< mtl::dense_vector< Value , Parameters > , mtl::dense_vector< Value , Parameters > >
59{
60 static bool same_size( const mtl::dense_vector< Value , Parameters > &v1 ,
61 const mtl::dense_vector< Value , Parameters > &v2 )
62 {
63 return mtl::size( v1 ) == mtl::size( v2 );
64 }
65};
66
67template< class Value , class Parameters >
68struct resize_impl< mtl::dense_vector< Value , Parameters > , mtl::dense_vector< Value , Parameters > >
69{
70 static void resize( mtl::dense_vector< Value , Parameters > &v1 ,
71 const mtl::dense_vector< Value , Parameters > &v2 )
72 {
73 v1.change_dim( mtl::size( v2 ) );
74 }
75};
76
77
78
79template< class Value , class MatrixParameters , class VectorParameters >
80struct same_size_impl< mtl::dense2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
81{
82 static bool same_size( const mtl::dense2D< Value , MatrixParameters > &m ,
83 const mtl::dense_vector< Value , VectorParameters > &v )
84 {
85 return ( ( mtl::size( v ) == m.num_cols() ) && ( mtl::size( v ) == m.num_rows() ) );
86 }
87};
88
89template< class Value , class MatrixParameters , class VectorParameters >
90struct resize_impl< mtl::dense2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
91{
92 static void resize( mtl::dense2D< Value , MatrixParameters > &m ,
93 const mtl::dense_vector< Value , VectorParameters > &v )
94 {
95 m.change_dim( mtl::size( v ) , mtl::size( v ) , false );
96 }
97};
98
99
100
101
102template< class Value , class MatrixParameters , class VectorParameters >
103struct same_size_impl< mtl::compressed2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
104{
105 static bool same_size( const mtl::compressed2D< Value , MatrixParameters > &m ,
106 const mtl::dense_vector< Value , VectorParameters > &v )
107 {
108 return ( ( mtl::size( v ) == m.num_cols() ) && ( mtl::size( v ) == m.num_rows() ) );
109 }
110};
111
112template< class Value , class MatrixParameters , class VectorParameters >
113struct resize_impl< mtl::compressed2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
114{
115 static void resize( mtl::compressed2D< Value , MatrixParameters > &m ,
116 const mtl::dense_vector< Value , VectorParameters > &v )
117 {
118 m.change_dim( mtl::size( v ) , mtl::size( v ) );
119 }
120};
121
122
123
124
125
126
127
128
129} // namespace odeint
130} // namespace numeric
131} // namespace boost
132
133#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED