ViennaCL - The Vienna Computing Library
1.5.0
|
A vector class representing a linear memory sequence on the GPU. Inspired by boost::numeric::ublas::vector. More...
#include <vector.hpp>
Public Types | |
typedef base_type::size_type | size_type |
typedef base_type::difference_type | difference_type |
Public Member Functions | |
vector () | |
Default constructor in order to be compatible with various containers. | |
vector (size_type vec_size) | |
An explicit constructor for the vector, allocating the given amount of memory (plus a padding specified by 'ALIGNMENT') | |
vector (size_type vec_size, viennacl::context ctx) | |
vector (SCALARTYPE *ptr_to_mem, viennacl::memory_types mem_type, size_type vec_size, size_type start=0, difference_type stride=1) | |
template<typename LHS , typename RHS , typename OP > | |
vector (vector_expression< const LHS, const RHS, OP > const &proxy) | |
vector (const base_type &v) | |
vector (const self_type &v) | |
vector (unit_vector< SCALARTYPE > const &v) | |
Creates the vector from the supplied unit vector. | |
vector (zero_vector< SCALARTYPE > const &v) | |
Creates the vector from the supplied zero vector. | |
vector (scalar_vector< SCALARTYPE > const &v) | |
Creates the vector from the supplied scalar vector. | |
template<typename T > | |
self_type & | operator= (T const &other) |
void | resize (size_type new_size, bool preserve=true) |
Resizes the allocated memory for the vector. Pads the memory to be a multiple of 'ALIGNMENT'. | |
void | resize (size_type new_size, viennacl::context ctx, bool preserve=true) |
Resizes the allocated memory for the vector. Convenience function for setting an OpenCL context in case reallocation is needed. | |
self_type & | fast_swap (self_type &other) |
Swaps the handles of two vectors by swapping the OpenCL handles only, no data copy. | |
void | switch_memory_context (viennacl::context new_ctx) |
A vector class representing a linear memory sequence on the GPU. Inspired by boost::numeric::ublas::vector.
This is the basic vector type of ViennaCL. It is similar to std::vector and boost::numeric::ublas::vector and supports various linear algebra operations. By default, the internal length of the vector is padded to a multiple of 'ALIGNMENT' in order to speed up several GPU viennacl::ocl::kernels.
SCALARTYPE | The floating point type, either 'float' or 'double' |
ALIGNMENT | The internal memory size is given by (size()/ALIGNMENT + 1) * ALIGNMENT. ALIGNMENT must be a power of two. Best values or usually 4, 8 or 16, higher values are usually a waste of memory. |
Reimplemented from vector_base< SCALARTYPE >.
typedef base_type::size_type size_type |
Reimplemented from vector_base< SCALARTYPE >.
vector | ( | ) | [inline, explicit] |
Default constructor in order to be compatible with various containers.
An explicit constructor for the vector, allocating the given amount of memory (plus a padding specified by 'ALIGNMENT')
vec_size | The length (i.e. size) of the vector. |
vector | ( | size_type | vec_size, |
viennacl::context | ctx | ||
) | [inline, explicit] |
vector | ( | SCALARTYPE * | ptr_to_mem, |
viennacl::memory_types | mem_type, | ||
size_type | vec_size, | ||
size_type | start = 0 , |
||
difference_type | stride = 1 |
||
) | [inline, explicit] |
vector | ( | vector_expression< const LHS, const RHS, OP > const & | proxy | ) | [inline] |
vector | ( | unit_vector< SCALARTYPE > const & | v | ) | [inline] |
Creates the vector from the supplied unit vector.
vector | ( | zero_vector< SCALARTYPE > const & | v | ) | [inline] |
Creates the vector from the supplied zero vector.
vector | ( | scalar_vector< SCALARTYPE > const & | v | ) | [inline] |
Creates the vector from the supplied scalar vector.
Swaps the handles of two vectors by swapping the OpenCL handles only, no data copy.
self_type& operator= | ( | T const & | other | ) | [inline] |
Resizes the allocated memory for the vector. Pads the memory to be a multiple of 'ALIGNMENT'.
new_size | The new size of the vector |
preserve | If true, old entries of the vector are preserved, otherwise eventually discarded. |
Reimplemented from vector_base< SCALARTYPE >.
void resize | ( | size_type | new_size, |
viennacl::context | ctx, | ||
bool | preserve = true |
||
) | [inline] |
Resizes the allocated memory for the vector. Convenience function for setting an OpenCL context in case reallocation is needed.
new_size | The new size of the vector |
ctx | The context within which the new memory should be allocated |
preserve | If true, old entries of the vector are preserved, otherwise eventually discarded. |
Reimplemented from vector_base< SCALARTYPE >.
void switch_memory_context | ( | viennacl::context | new_ctx | ) | [inline] |
Reimplemented from vector_base< SCALARTYPE >.