23 #include <cusp/detail/config.h>
25 #include <thrust/distance.h>
26 #include <thrust/functional.h>
28 #include <thrust/iterator/counting_iterator.h>
29 #include <thrust/iterator/permutation_iterator.h>
30 #include <thrust/iterator/transform_iterator.h>
77 template <
typename RandomAccessIterator>
83 typedef typename thrust::iterator_value<RandomAccessIterator>::type value_type;
84 typedef typename thrust::iterator_system<RandomAccessIterator>::type memory_space;
85 typedef typename thrust::iterator_pointer<RandomAccessIterator>::type pointer;
86 typedef typename thrust::iterator_reference<RandomAccessIterator>::type reference;
87 typedef typename thrust::iterator_difference<RandomAccessIterator>::type difference_type;
88 typedef typename thrust::iterator_difference<RandomAccessIterator>::type size_type;
91 typedef typename thrust::counting_iterator<difference_type> CountingIterator;
92 typedef typename thrust::transform_iterator<StrideFunctor, CountingIterator> TransformIterator;
93 typedef typename thrust::permutation_iterator<RandomAccessIterator,TransformIterator> PermutationIterator;
96 typedef PermutationIterator iterator;
109 strided_iterator(RandomAccessIterator first, RandomAccessIterator last, difference_type stride)
110 : first(first), last(last), stride(stride) {}
118 return PermutationIterator(first, TransformIterator(CountingIterator(0), StrideFunctor(stride)));
127 return begin() + (thrust::distance(first,last) + (stride - 1)) / stride;
140 return *(
begin() + n);
146 RandomAccessIterator first;
147 RandomAccessIterator last;
148 difference_type stride;
iterator end(void) const
This method returns an iterator pointing to one element past the last of this strided sequence of ent...
strided_iterator(void)
Null constructor initializes this strided_iterator's stride to zero.
iterator begin(void) const
This method returns an iterator pointing to the beginning of this strided sequence of entries...
multiplies_value is a function object that computes the multiply of a given element by a constant val...
strided_iterator(RandomAccessIterator first, RandomAccessIterator last, difference_type stride)
This constructor builds a strided_iterator from a range.
reference operator[](size_type n) const
Subscript access to the data contained in this iterator.
RandomAccessIterator for strided access to array entries.
Defines templated convenience functors analogous to what is found in thrust's functional.