![]() |
Boost.uBlas 1.49
Linear Algebra in C++: matrices, vectors and numeric algorithms
|
00001 00017 #ifndef BOOST_NUMERIC_UBLAS_TRAITS_C_ARRAY_HPP 00018 #define BOOST_NUMERIC_UBLAS_TRAITS_C_ARRAY_HPP 00019 00020 00021 #include <boost/numeric/ublas/traits.hpp> 00022 #include <boost/numeric/ublas/traits/const_iterator_type.hpp> 00023 #include <boost/numeric/ublas/traits/iterator_type.hpp> 00024 00025 namespace boost { namespace numeric { namespace ublas { 00026 00027 namespace detail { 00028 00029 00030 00031 } 00032 00033 00034 template < class T, int M, int N > 00035 struct matrix_view_traits < T[M][N] > { 00036 typedef T matrix_type[M][N]; 00037 00038 typedef std::size_t size_type; 00039 typedef std::ptrdiff_t difference_type; 00040 00041 typedef row_major_tag orientation_category; 00042 typedef dense_tag storage_category; 00043 00044 typedef T value_type; 00045 typedef const T &const_reference; 00046 typedef const T *const_pointer; 00047 00048 typedef const matrix_reference<const matrix_type> const_closure_type; 00049 00050 typedef T row_type[N]; 00051 00052 typedef const row_type *const_iterator1; 00053 typedef const_pointer const_iterator2; 00054 00055 }; 00056 00057 template < class T, int M, int N > 00058 struct mutable_matrix_traits < T[M][N] > { 00059 typedef T matrix_type[M][N]; 00060 00061 typedef T *reference; 00062 00063 typedef matrix_reference<matrix_type> closure_type; 00064 00065 }; 00066 00067 template < class T, int N > 00068 struct vector_view_traits < T[N] > { 00069 typedef T vector_type[N]; 00070 00071 typedef std::size_t size_type; 00072 typedef std::ptrdiff_t difference_type; 00073 00074 typedef dense_tag storage_category; 00075 00076 typedef T value_type; 00077 typedef const T &const_reference; 00078 typedef const T *const_pointer; 00079 00080 typedef const vector_reference<const vector_type> const_closure_type; 00081 00082 typedef const_pointer const_iterator; 00083 00085 static 00086 const_iterator begin(const vector_type & v) { 00087 return & (v[0]); 00088 } 00090 static 00091 const_iterator end(const vector_type & v) { 00092 return & (v[N]); 00093 } 00094 }; 00095 00096 template < class T, int N > 00097 struct mutable_vector_traits < T[N] > { 00098 00099 typedef T &reference; 00100 typedef T *pointer; 00101 typedef vector_reference< T[N] > closure_type; 00102 00103 }; 00104 00105 00106 00107 00108 }}} // Namespace boost::numeric::ublas 00109 00110 #endif