eigen_resize.hpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. [auto_generated]
  3. boost/numeric/odeint/external/eigen/eigen_resize.hpp
  4. [begin_description]
  5. tba.
  6. [end_description]
  7. Copyright 2013 Ankur Sinha
  8. Copyright 2013 Karsten Ahnert
  9. Distributed under the Boost Software License, Version 1.0.
  10. (See accompanying file LICENSE_1_0.txt or
  11. copy at http://www.boost.org/LICENSE_1_0.txt)
  12. */
  13. #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_RESIZE_HPP_DEFINED
  14. #define BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_RESIZE_HPP_DEFINED
  15. #include <boost/numeric/odeint/util/is_resizeable.hpp>
  16. #include <boost/numeric/odeint/util/resize.hpp>
  17. #include <boost/numeric/odeint/util/same_size.hpp>
  18. #include <boost/utility/enable_if.hpp>
  19. #include <boost/type_traits/is_base_of.hpp>
  20. #include <Eigen/Dense>
  21. namespace boost {
  22. namespace numeric {
  23. namespace odeint {
  24. template< class Derived >
  25. struct is_resizeable_sfinae< Derived ,
  26. typename boost::enable_if< typename boost::is_base_of< Eigen::MatrixBase< Derived > , Derived >::type >::type >
  27. {
  28. typedef boost::true_type type;
  29. const static bool value = type::value;
  30. };
  31. template < class Derived >
  32. struct is_resizeable_sfinae< Derived ,
  33. typename boost::enable_if< typename boost::is_base_of< Eigen::ArrayBase< Derived > , Derived >::type >::type >
  34. {
  35. typedef boost::true_type type;
  36. const static bool value = type::value;
  37. };
  38. template< class Derived >
  39. struct same_size_impl_sfinae< Derived , Derived ,
  40. typename boost::enable_if< typename boost::is_base_of< Eigen::MatrixBase< Derived > , Derived >::type >::type >
  41. {
  42. static bool same_size( const Eigen::MatrixBase< Derived > &m1 , const Eigen::MatrixBase< Derived > &m2 )
  43. {
  44. return ( ( m1.innerSize () == m2.innerSize () ) && ( m1.outerSize() == m2.outerSize() ) );
  45. }
  46. };
  47. template< class Derived >
  48. struct same_size_impl_sfinae< Derived , Derived ,
  49. typename boost::enable_if< typename boost::is_base_of< Eigen::ArrayBase< Derived > , Derived >::type >::type >
  50. {
  51. static bool same_size( const Eigen::ArrayBase< Derived > &v1 , const Eigen::ArrayBase< Derived > &v2 )
  52. {
  53. return ( ( v1.innerSize () == v2.innerSize () ) && ( v1.outerSize() == v2.outerSize() ) );
  54. }
  55. };
  56. template< class Derived >
  57. struct resize_impl_sfinae< Derived , Derived ,
  58. typename boost::enable_if< typename boost::is_base_of< Eigen::MatrixBase< Derived > , Derived >::type >::type >
  59. {
  60. static void resize( Eigen::MatrixBase< Derived > &m1 , const Eigen::MatrixBase< Derived > &m2 )
  61. {
  62. m1.derived().resizeLike(m2);
  63. }
  64. };
  65. template< class Derived >
  66. struct resize_impl_sfinae< Derived , Derived ,
  67. typename boost::enable_if< typename boost::is_base_of< Eigen::ArrayBase< Derived > , Derived >::type >::type >
  68. {
  69. static void resize( Eigen::ArrayBase< Derived > &v1 , const Eigen::ArrayBase< Derived > &v2 )
  70. {
  71. v1.derived().resizeLike(v2);
  72. }
  73. };
  74. } // namespace odeint
  75. } // namespace numeric
  76. } // namespace boost
  77. #endif // BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_RESIZE_HPP_DEFINED