A STL-type iterator for vector elements. Elements can be accessed and manipulated. VERY SLOW!!
More...
|
| vector_iterator (handle_type const &elements, size_type index, size_type start=0, size_type stride=1) |
|
| vector_iterator (vector_base< NumericT > &vec, size_type index, size_type start=0, size_type stride=1) |
| Constructor. More...
|
|
entry_proxy< NumericT > | operator* (void) |
|
difference_type | operator- (self_type const &other) const |
|
self_type | operator+ (difference_type diff) const |
|
handle_type & | handle () |
|
handle_type const & | handle () const |
|
| const_vector_iterator (vector_base< NumericT > const &vec, size_type index, size_type start=0, size_type stride=1) |
| Constructor. More...
|
|
| const_vector_iterator (handle_type const &elements, size_type index, size_type start=0, size_type stride=1) |
| Constructor for vector-like treatment of arbitrary buffers. More...
|
|
value_type | operator* (void) const |
| Dereferences the iterator and returns the value of the element. For convenience only, performance is poor due to OpenCL overhead! More...
|
|
self_type | operator++ (void) |
|
self_type | operator++ (int) |
|
bool | operator== (self_type const &other) const |
|
bool | operator!= (self_type const &other) const |
|
difference_type | operator- (self_type const &other) const |
|
self_type | operator+ (difference_type diff) const |
|
size_type | offset () const |
| Offset of the current element index with respect to the beginning of the buffer. More...
|
|
size_type | stride () const |
| Index increment in the underlying buffer when incrementing the iterator to the next element. More...
|
|
handle_type const & | handle () const |
|
template<class SCALARTYPE, unsigned int ALIGNMENT>
class viennacl::vector_iterator< SCALARTYPE, ALIGNMENT >
A STL-type iterator for vector elements. Elements can be accessed and manipulated. VERY SLOW!!
Every dereference operation initiates a transfer from the GPU to the CPU. The overhead of such a transfer is around 50us, so 20.000 dereferences take one second. This is four orders of magnitude slower than similar dereferences on the CPU. However, increments and comparisons of iterators is as fast as for CPU types. If you need a fast iterator, copy the whole vector to the CPU first and iterate over the CPU object, e.g. std::vector<float> temp; copy(gpu_vector, temp); for (std::vector<float>::const_iterator iter = temp.begin(); iter != temp.end(); ++iter) { //do something } copy(temp, gpu_vector); Note that you may obtain inconsistent data if you manipulate entries of gpu_vector in the meanwhile.
- Template Parameters
-
NumericT | The underlying floating point type (either float or double) |
AlignmentV | Alignment of the underlying vector, |
- See Also
- vector
Definition at line 242 of file forwards.h.