00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef MTL_ITERATOR_ADAPTOR_1D_INCLUDE
00013 #define MTL_ITERATOR_ADAPTOR_1D_INCLUDE
00014
00015 #include <boost/numeric/mtl/utility/range_generator.hpp>
00016 #include <boost/numeric/mtl/utility/glas_tag.hpp>
00017 #include <boost/numeric/mtl/utility/iterator_adaptor.hpp>
00018
00019 namespace mtl { namespace traits {
00020
00021
00022
00023
00024 template <typename Matrix>
00025 struct range_generator<tag::const_iter::nz, Matrix>
00026 {
00027 typedef typename traits::const_value<Matrix>::type map_type;
00028 typedef typename glas::tag::nz cursor_tag;
00029 typedef range_generator<cursor_tag, Matrix> cursor_range;
00030 typedef typename cursor_range::type cursor_type;
00031 typedef typename Matrix::value_type value_type;
00032 typedef typename cursor_range::complexity complexity;
00033 static int const level = cursor_range::level;
00034
00035
00036 typedef utilities::const_iterator_adaptor<map_type, cursor_type, value_type> type;
00037
00038 type begin(const Matrix& matrix) const
00039 {
00040 return type(map_type(matrix), cursor_range().begin(matrix));
00041 }
00042
00043 type end(const Matrix& matrix) const
00044 {
00045 return type(map_type(matrix), cursor_range().end(matrix));
00046 }
00047 };
00048
00049
00050 #if 0
00051 template <typename Matrix>
00052 struct range_generator<tag::iter::nz, Matrix>
00053 {
00054 typedef typename traits::value<Matrix>::type map_type;
00055 typedef typename glas::tag::nz cursor_tag;
00056 typedef typename range_generator<cursor_tag, Matrix>::type cursor_type;
00057 typedef typename Matrix::value_type value_type;
00058 typedef typename range_generator<cursor_tag, Matrix>::complexity complexity;
00059 static int const level = range_generator<cursor_tag, Matrix>::level;
00060
00061
00062 typedef utilities::const_iterator_adaptor<map_type, cursor_type, value_type> type;
00063
00064 type begin(const Matrix& matrix) const
00065 {
00066 map_type map(matrix);
00067 return type(map, begin<cursor_tag>(matrix));
00068 }
00069
00070 type end(const Matrix& matrix) const
00071 {
00072 map_type map(matrix);
00073 return type(map, end<cursor_tag>(matrix));
00074 }
00075 };
00076
00077
00078 template <typename Matrix>
00079 struct range_generator<tag::const_iter::all, Matrix>
00080 {
00081 typedef typename traits::const_value<Matrix>::type map_type;
00082 typedef typename glas::tag::all cursor_tag;
00083 typedef typename range_generator<cursor_tag, Matrix>::type cursor_type;
00084 typedef typename Matrix::value_type value_type;
00085 typedef typename range_generator<cursor_tag, Matrix>::complexity complexity;
00086 static int const level = range_generator<cursor_tag, Matrix>::level;
00087
00088
00089 typedef utilities::const_iterator_adaptor<map_type, cursor_type, value_type> type;
00090
00091 type begin(const Matrix& matrix) const
00092 {
00093 return type(map_type(matrix), begin<cursor_tag>(matrix));
00094 }
00095
00096 type end(const Matrix& matrix) const
00097 {
00098 return type(map_type(matrix), end<cursor_tag>(matrix));
00099 }
00100 };
00101
00102 template <typename Matrix>
00103 struct range_generator<tag::iter::all, Matrix>
00104 {
00105 typedef typename traits::value<Matrix>::type map_type;
00106 typedef typename glas::tag::all cursor_tag;
00107 typedef typename range_generator<cursor_tag, Matrix>::type cursor_type;
00108 typedef typename Matrix::value_type value_type;
00109 typedef typename range_generator<cursor_tag, Matrix>::complexity complexity;
00110 static int const level = range_generator<cursor_tag, Matrix>::level;
00111
00112
00113 typedef utilities::const_iterator_adaptor<map_type, cursor_type, value_type> type;
00114
00115 type begin(const Matrix& matrix) const
00116 {
00117 map_type map(matrix);
00118 return type(map, begin<cursor_tag>(matrix));
00119 }
00120
00121 type end(const Matrix& matrix) const
00122 {
00123 map_type map(matrix);
00124 return type(map, end<cursor_tag>(matrix));
00125 }
00126 };
00127
00128
00129 #endif
00130
00131
00132
00133
00134
00135
00136 #if 0
00137 template <typename Matrix>
00138 struct morton_dense_row_const_iterator
00139 : utilities::const_iterator_adaptor<typename traits::const_value<Matrix>::type, morton_dense_row_cursor<Matrix::mask>,
00140 typename Matrix::value_type>
00141 {
00142 static const unsigned long mask= Matrix::mask;
00143 typedef morton_dense_row_cursor<mask> cursor_type;
00144 typedef typename traits::const_value<Matrix>::type map_type;
00145 typedef typename Matrix::value_type value_type;
00146 typedef typename Matrix::size_type size_type;
00147 typedef utilities::iterator_adaptor<map_type, cursor_type, value_type> base;
00148
00149 morton_dense_row_const_iterator(const Matrix& matrix, size_type row, size_type col)
00150 : base(map_type(matrix), cursor_type(row, col))
00151 {}
00152 };
00153
00154 utilities::const_iterator_adaptor<typename traits::const_value<Matrix>::type, morton_dense_row_cursor<Matrix::mask>,
00155 typename Matrix::value_type>
00156 #endif
00157
00158 }}
00159
00160 #endif // MTL_ITERATOR_ADAPTOR_1D_INCLUDE