ublas_banded.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_UBLAS_BANDED_H
00015 #define BOOST_NUMERIC_BINDINGS_TRAITS_UBLAS_BANDED_H
00016
00017 #include <boost/numeric/bindings/traits/traits.hpp>
00018
00019 #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS
00020
00021 #ifndef BOOST_UBLAS_HAVE_BINDINGS
00022 # include <boost/numeric/ublas/banded.hpp>
00023 #endif
00024 #include <boost/numeric/bindings/traits/detail/ublas_ordering.hpp>
00025
00026 #if defined (BOOST_NUMERIC_BINDINGS_FORTRAN) || !defined (BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK)
00027 # include <boost/static_assert.hpp>
00028 # include <boost/type_traits/same_traits.hpp>
00029 #endif
00030
00031
00032 namespace boost { namespace numeric { namespace bindings { namespace traits {
00033
00034
00035
00036
00037
00038
00039
00040
00041 template <typename T, typename F, typename ArrT, typename M>
00042 struct matrix_detail_traits< boost::numeric::ublas::banded_matrix<T, F, ArrT>, M >
00043 {
00044 #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK
00045 BOOST_STATIC_ASSERT( (boost::is_same<boost::numeric::ublas::banded_matrix<T, F, ArrT>, typename boost::remove_const<M>::type>::value) );
00046 #endif
00047 #ifdef BOOST_NUMERIC_BINDINGS_FORTRAN
00048 BOOST_STATIC_ASSERT((boost::is_same<
00049 typename F::orientation_category,
00050 boost::numeric::ublas::row_major_tag
00051 >::value));
00052 #endif
00053
00054 typedef boost::numeric::ublas::banded_matrix<T, F, ArrT> identifier_type ;
00055 typedef M matrix_type;
00056 typedef banded_t matrix_structure;
00057 typedef typename detail::ublas_ordering<
00058 typename F::orientation_category
00059 >::type ordering_type;
00060
00061 typedef T value_type;
00062 typedef typename detail::generate_const<M,T>::type* pointer;
00063
00064 static pointer storage (matrix_type& m) {
00065 typedef typename detail::generate_const<M,ArrT>::type array_type ;
00066 return vector_traits<array_type>::storage (m.data());
00067 }
00068 static int size1 (matrix_type& m) { return m.size1(); }
00069 static int size2 (matrix_type& m) { return m.size2(); }
00070 static int lower_bandwidth (matrix_type& m) { return m.lower() ; }
00071 static int upper_bandwidth (matrix_type& m) { return m.upper() ; }
00072 static int storage_size (matrix_type& m) { return size1 (m) * size2 (m); }
00073 static int leading_dimension (matrix_type& m) {
00074 typedef typename identifier_type::orientation_category orientation_category;
00075 return detail::ublas_banded_ordering<orientation_category>::leading_dimension(m) ;
00076 }
00077
00078
00079 static int stride1 (matrix_type& m) {
00080 typedef typename identifier_type::orientation_category orientation_category;
00081 return detail::ublas_banded_ordering<orientation_category>::stride1(m) ;
00082 }
00083
00084 static int stride2 (matrix_type& m) {
00085 typedef typename identifier_type::orientation_category orientation_category;
00086 return detail::ublas_banded_ordering<orientation_category>::stride2(m) ;
00087 }
00088 };
00089
00090
00091 }}}}
00092
00093 #endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS
00094
00095 #endif // BOOST_NUMERIC_BINDINGS_TRAITS_UBLAS_BANDED_H