33 #ifndef __VMML__TENSOR3_ITERATOR__HPP__
34 #define __VMML__TENSOR3_ITERATOR__HPP__
36 #include <vmmlib/matrix.hpp>
42 template<
typename T >
47 typedef typename T::value_type value_type;
48 typedef typename T::pointer pointer;
49 typedef typename T::reference reference;
50 typedef typename std::forward_iterator_tag iterator_category;
51 typedef size_t difference_type;
55 typedef typename T::front_slice_type slice_type;
64 slice_type& slice_ = _tensor3->get_frontal_slice_fwd( _matrix_index );
66 _matrix_it = slice_.begin();
67 _matrix_it_end = slice_.end();
71 _matrix_index = T::SLICES - 1;
72 slice_type& slice_ = _tensor3->get_frontal_slice_fwd( _matrix_index );
74 _matrix_it = slice_.end();
75 _matrix_it_end = slice_.begin();
79 value_type& operator*()
84 const value_type& operator*()
const
91 return it_._tensor3 == _tensor3
93 && it_._matrix_it == _matrix_it;
99 return ! operator==(it_);
107 VMMLIB_ERROR(
"attempt to increase singular iterator", VMMLIB_HERE );
110 if ( _matrix_it != _matrix_it_end )
113 if ( _matrix_it == _matrix_it_end && _matrix_index + 1 < T::SLICES )
118 _matrix_it = _tensor3->get_frontal_slice_fwd( _matrix_index ).begin();
119 _matrix_it_end = _tensor3->get_frontal_slice_fwd( _matrix_index ).end();
125 matrix_iterator _matrix_it;
126 matrix_iterator _matrix_it_end;
128 size_t _matrix_index;
135 template<
typename T >
140 typedef typename T::value_type value_type;
141 typedef typename T::pointer pointer;
142 typedef typename T::reference reference;
143 typedef typename std::forward_iterator_tag iterator_category;
144 typedef size_t difference_type;
148 typedef typename T::front_slice_type slice_type;
157 const slice_type& slice_ = _tensor3->get_frontal_slice_fwd( _matrix_index );
159 _matrix_it = slice_.begin();
160 _matrix_it_end = slice_.end();
164 _matrix_index = T::SLICES - 1;
165 const slice_type& slice_ = _tensor3->get_frontal_slice_fwd( _matrix_index );
167 _matrix_it = slice_.end();
168 _matrix_it_end = slice_.begin();
172 const value_type& operator*()
const
179 return it_._matrix_it == _matrix_it;
185 return it_._matrix_it != _matrix_it;
193 VMMLIB_ERROR(
"attempt to increase singular iterator", VMMLIB_HERE );
196 if ( _matrix_it != _matrix_it_end )
199 if ( _matrix_it == _matrix_it_end && _matrix_index + 1 < T::SLICES )
204 _matrix_it = _tensor3->get_frontal_slice_fwd( _matrix_index ).begin();
205 _matrix_it_end = _tensor3->get_frontal_slice_fwd( _matrix_index ).end();
211 matrix_iterator _matrix_it;
212 matrix_iterator _matrix_it_end;
214 size_t _matrix_index;