viennacl_resize.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. [auto_generated]
  3. boost/numeric/odeint/external/viennacl/viennacl_resize.hpp
  4. [begin_description]
  5. Enable resizing for viennacl vector.
  6. [end_description]
  7. Copyright 2012 Denis Demidov
  8. Copyright 2012 Karsten Ahnert
  9. Copyright 2012 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)
  13. */
  14. #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VIENNACL_VIENNACL_RESIZE_HPP_INCLUDED
  15. #define BOOST_NUMERIC_ODEINT_EXTERNAL_VIENNACL_VIENNACL_RESIZE_HPP_INCLUDED
  16. #include <type_traits>
  17. #include <viennacl/vector.hpp>
  18. #include <boost/numeric/odeint/util/is_resizeable.hpp>
  19. #include <boost/numeric/odeint/util/resize.hpp>
  20. #include <boost/numeric/odeint/util/same_size.hpp>
  21. namespace boost {
  22. namespace numeric {
  23. namespace odeint {
  24. /*
  25. * specializations for viennacl::vector< T >
  26. */
  27. template< typename T >
  28. struct is_resizeable< viennacl::vector< T > > : std::true_type { };
  29. template< typename T >
  30. struct resize_impl< viennacl::vector< T > , viennacl::vector< T > >
  31. {
  32. static void resize( viennacl::vector< T > &x1 , const viennacl::vector< T > &x2 )
  33. {
  34. x1.resize( x2.size() , false );
  35. }
  36. };
  37. template< typename T >
  38. struct same_size_impl< viennacl::vector< T > , viennacl::vector< T > >
  39. {
  40. static bool same_size( const viennacl::vector< T > &x1 , const viennacl::vector< T > &x2 )
  41. {
  42. return x1.size() == x2.size();
  43. }
  44. };
  45. } // namespace odeint
  46. } // namespace numeric
  47. } // namespace boost
  48. #endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VIENNACL_VIENNACL_RESIZE_HPP_INCLUDED