A STL-type const-iterator for vector elements. Elements can be accessed, but cannot be manipulated. VERY SLOW!!
More...
Detailed Description
template<class SCALARTYPE, unsigned int ALIGNMENT>
class viennacl::const_vector_iterator< SCALARTYPE, ALIGNMENT >
A STL-type const-iterator for vector elements. Elements can be accessed, but cannot be 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 } Note that you may obtain inconsistent data if entries of gpu_vector are manipulated elsewhere in the meanwhile.
- Template Parameters:
-
| SCALARTYPE | The underlying floating point type (either float or double) |
| ALIGNMENT | Alignment of the underlying vector, |
- See also:
- vector
Member Typedef Documentation
Constructor & Destructor Documentation
Constructor.
- Parameters:
-
| vec | The vector over which to iterate |
| index | The starting index of the iterator |
Member Function Documentation
std::size_t index |
( |
|
) |
const [inline] |
bool operator!= |
( |
self_type const & |
other |
) |
const [inline] |
bool operator== |
( |
self_type const & |
other |
) |
const [inline] |
Field Documentation
The index of the entry the iterator is currently pointing to.
std::size_t index_ [protected] |
The documentation for this class was generated from the following file:
- /data/development/ViennaCL/dev/viennacl/vector.hpp