A vector class representing a linear memory sequence on the GPU. Inspired by boost::numeric::ublas::vector. More...
#include <vector.hpp>
Public Types | |
| typedef scalar< typename viennacl::tools::CHECK_SCALAR_TEMPLATE_ARGUMENT < SCALARTYPE >::ResultType > | value_type |
| typedef vcl_size_t | size_type |
| typedef vcl_ptrdiff_t | difference_type |
| typedef const_vector_iterator < SCALARTYPE, ALIGNMENT > | const_iterator |
| typedef vector_iterator < SCALARTYPE, ALIGNMENT > | iterator |
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 (cl_mem existing_mem, size_type vec_size) | |
| Create a vector from existing OpenCL memory. | |
| template<typename LHS , typename RHS , typename OP > | |
| vector (vector_expression< LHS, RHS, OP > const &other) | |
| vector (const vector< SCALARTYPE, ALIGNMENT > &vec) | |
| The copy constructor. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator= (const vector< SCALARTYPE, ALIGNMENT > &vec) |
| Assignment operator. This vector is resized if 'vec' is of a different size. | |
| template<typename VectorType > | |
| vector< SCALARTYPE, ALIGNMENT > & | operator= (const vector_expression< VectorType, const scalar< SCALARTYPE >, op_prod > &proxy) |
| Implementation of the operation v1 = alpha * v2, where alpha is a GPU scalar. | |
| template<typename VectorType > | |
| vector< SCALARTYPE, ALIGNMENT > & | operator= (const vector_expression< VectorType, const SCALARTYPE, op_prod > &proxy) |
| Implementation of the operation v1 = alpha * v2, where alpha is a CPU scalar. | |
| template<typename VectorType > | |
| vector< SCALARTYPE, ALIGNMENT > & | operator= (const vector_expression< VectorType, const scalar< SCALARTYPE >, op_div > &proxy) |
| Implementation of the operation v1 = v2 / alpha, where alpha is a GPU scalar. | |
| template<typename VectorType > | |
| vector< SCALARTYPE, ALIGNMENT > & | operator= (const vector_expression< VectorType, const SCALARTYPE, op_div > &proxy) |
| Implementation of the operation v1 = v2 / alpha, where alpha is a CPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator= (const vector_expression< vector< SCALARTYPE, ALIGNMENT >, vector< SCALARTYPE, ALIGNMENT >, op_add > &proxy) |
| Implementation of the operation v1 = v2 + v3. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator= (const vector_expression< vector< SCALARTYPE, ALIGNMENT >, vector< SCALARTYPE, ALIGNMENT >, op_sub > &proxy) |
| Implementation of the operation v1 = v2 - v3. | |
| template<typename F , unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > & | operator= (const vector_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 = A * v2, where v1, v2 are vectors and A is a dense matrix. | |
| template<typename F , unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > & | operator+= (const vector_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 += A * v2, where v1, v2 are vectors and A is a dense matrix. | |
| template<typename F , unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > & | operator-= (const vector_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 -= A * v2, where v1, v2 are vectors and A is a dense matrix. | |
| template<typename F , unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > | operator+ (const vector_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 + A * v2, where v1, v2 are vectors and A is a dense matrix. | |
| template<typename F , unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > | operator- (const vector_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 - A * v2, where v1, v2 are vectors and A is a dense matrix. | |
| template<typename F , unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > & | operator= (const vector_expression< const matrix_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, op_trans >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 = trans(A) * v2, where v1, v2 are vectors and A is a dense matrix. | |
| template<typename F , unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > & | operator+= (const vector_expression< const matrix_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, op_trans >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 += trans(A) * v2, where v1, v2 are vectors and A is a dense matrix. | |
| template<typename F , unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > & | operator-= (const vector_expression< const matrix_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, op_trans >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 -= trans(A) * v2, where v1, v2 are vectors and A is a dense matrix. | |
| template<typename F , unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > | operator+ (const vector_expression< const matrix_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, op_trans >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 + trans(A) * v2, where v1, v2 are vectors and A is a dense matrix. | |
| template<typename F , unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > | operator- (const vector_expression< const matrix_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, op_trans >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 - trans(A) * v2, where v1, v2 are vectors and A is a dense matrix. | |
| template<unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > & | operator= (const vector_expression< const compressed_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 = A * v2, where v1, v2 are vectors and A is a sparse matrix of type compressed_matrix. | |
| template<unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > & | operator+= (const vector_expression< const compressed_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 += A * v2, where v1, v2 are vectors and A is a sparse matrix of type compressed_matrix. | |
| template<unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > & | operator-= (const vector_expression< const compressed_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 -= A * v2, where v1, v2 are vectors and A is a sparse matrix of type compressed_matrix. | |
| template<unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > | operator+ (const vector_expression< const compressed_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 + A * v2, where v1, v2 are vectors and A is a sparse matrix of type compressed_matrix. | |
| template<unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > | operator- (const vector_expression< const compressed_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 - A * v2, where v1, v2 are vectors and A is a sparse matrix of type compressed_matrix. | |
| template<unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > & | operator= (const vector_expression< const coordinate_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 = A * v2, where v1, v2 are vectors and A is a sparse matrix of type coordinate_matrix. | |
| template<unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > & | operator+= (const vector_expression< const coordinate_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 += A * v2, where v1, v2 are vectors and A is a sparse matrix of type coordinate_matrix. | |
| template<unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > & | operator-= (const vector_expression< const coordinate_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 -= A * v2, where v1, v2 are vectors and A is a sparse matrix of type coordinate_matrix. | |
| template<unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > | operator+ (const vector_expression< const coordinate_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 + A * v2, where v1, v2 are vectors and A is a sparse matrix of type coordinate_matrix. | |
| template<unsigned int MAT_ALIGNMENT> | |
| vector< SCALARTYPE, ALIGNMENT > | operator- (const vector_expression< const coordinate_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > &proxy) |
| Operator overload for v1 - A * v2, where v1, v2 are vectors and A is a sparse matrix of type coordinate_matrix. | |
| 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'. | |
| entry_proxy< SCALARTYPE > | operator() (size_type index) |
| Read-write access to a single element of the vector. | |
| entry_proxy< SCALARTYPE > | operator[] (size_type index) |
| Read-write access to a single element of the vector. | |
| scalar< SCALARTYPE > | operator() (size_type index) const |
| Read access to a single element of the vector. | |
| scalar< SCALARTYPE > | operator[] (size_type index) const |
| Read access to a single element of the vector. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator+= (const vector< SCALARTYPE, ALIGNMENT > &vec) |
| Inplace addition of a vector. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator+= (const vector_expression< vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_prod > &proxy) |
| Inplace addition of a scaled vector, i.e. v1 += alpha * v2, where alpha is a GPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator+= (const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_prod > &proxy) |
| Inplace addition of a scaled vector, i.e. v1 += alpha * v2, where alpha is a GPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator+= (const vector_expression< vector< SCALARTYPE, ALIGNMENT >, const SCALARTYPE, op_prod > &proxy) |
| Inplace addition of a scaled vector, i.e. v1 += alpha * v2, where alpha is a CPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator+= (const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const SCALARTYPE, op_prod > &proxy) |
| Inplace addition of a scaled vector, i.e. v1 += alpha * v2, where alpha is a CPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator+= (const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_div > &proxy) |
| Inplace addition of a scaled vector, i.e. v1 += alpha * v2, where alpha is a GPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator-= (const vector< SCALARTYPE, ALIGNMENT > &vec) |
| Inplace subtraction of a vector. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator-= (const vector_expression< vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_prod > &proxy) |
| Inplace subtraction of a scaled vector, i.e. v1 -= alpha * v2, where alpha is a GPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator-= (const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_prod > &proxy) |
| Inplace subtraction of a scaled vector, i.e. v1 -= alpha * v2, where alpha is a GPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator-= (const vector_expression< vector< SCALARTYPE, ALIGNMENT >, const SCALARTYPE, op_prod > &proxy) |
| Inplace subtraction of a scaled vector, i.e. v1 -= alpha * v2, where alpha is a CPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator-= (const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const SCALARTYPE, op_prod > &proxy) |
| Inplace subtraction of a scaled vector, i.e. v1 -= alpha * v2, where alpha is a CPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator-= (const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_div > &proxy) |
| Inplace subtraction of a scaled vector, i.e. v1 -= alpha * v2, where alpha is a CPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator*= (SCALARTYPE val) |
| Scales this vector by a CPU scalar value. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator*= (scalar< SCALARTYPE > const &gpu_val) |
| Scales this vector by a GPU scalar value. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator/= (SCALARTYPE val) |
| Scales this vector by a CPU scalar value. | |
| vector< SCALARTYPE, ALIGNMENT > & | operator/= (scalar< SCALARTYPE > const &gpu_val) |
| Scales this vector by a CPU scalar value. | |
| vector< SCALARTYPE, ALIGNMENT > | operator+ (const vector< SCALARTYPE, ALIGNMENT > &vec) const |
| Adds up two vectors. | |
| vector< SCALARTYPE, ALIGNMENT > | operator+ (const vector_expression< vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_prod > &proxy) const |
| Adds up two vectors, i.e. result = v1 + v2 * alpha, where alpha is a GPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > | operator+ (const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_prod > &proxy) const |
| Adds up two vectors, i.e. result = v1 + v2 * alpha, where alpha is a GPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > | operator+ (const vector_expression< vector< SCALARTYPE, ALIGNMENT >, const SCALARTYPE, op_prod > &proxy) const |
| Adds up two vectors, i.e. result = v1 + v2 * alpha, where alpha is a CPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > | operator+ (const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const SCALARTYPE, op_prod > &proxy) const |
| Adds up two vectors, i.e. result = v1 + v2 * alpha, where alpha is a CPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > | operator- (const vector< SCALARTYPE, ALIGNMENT > &vec) const |
| Implementation of result = v1 - v2. | |
| vector< SCALARTYPE, ALIGNMENT > | operator- (const vector_expression< vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_prod > &proxy) const |
| Adds up two vectors, i.e. result = v1 - v2 * alpha, where alpha is a GPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > | operator- (const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_prod > &proxy) const |
| Adds up two vectors, i.e. result = v1 - v2 * alpha, where alpha is a GPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > | operator- (const vector_expression< vector< SCALARTYPE, ALIGNMENT >, const SCALARTYPE, op_prod > &proxy) const |
| Adds up two vectors, i.e. result = v1 - v2 * alpha, where alpha is a CPU scalar. | |
| vector< SCALARTYPE, ALIGNMENT > | operator- (const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const SCALARTYPE, op_prod > &proxy) const |
| Adds up two vectors, i.e. result = v1 - v2 * alpha, where alpha is a CPU scalar. | |
| vector_expression< const vector< SCALARTYPE, ALIGNMENT > , const SCALARTYPE, op_prod > | operator* (SCALARTYPE value) const |
| Scales the vector by a CPU scalar 'alpha' and returns an expression template. | |
| vector_expression< const vector< SCALARTYPE, ALIGNMENT > , const scalar< SCALARTYPE > , op_prod > | operator* (scalar< SCALARTYPE > const &value) const |
| Scales the vector by a GPU scalar 'alpha' and returns an expression template. | |
| vector_expression< const vector< SCALARTYPE, ALIGNMENT > , const SCALARTYPE, op_div > | operator/ (SCALARTYPE value) const |
| Scales the vector by a CPU scalar 'alpha' and returns an expression template. | |
| vector_expression< const vector< SCALARTYPE, ALIGNMENT > , const scalar< SCALARTYPE > , op_div > | operator/ (scalar< SCALARTYPE > const &value) const |
| Scales the vector by a GPU scalar 'alpha' and returns an expression template. | |
| iterator | begin () |
| Returns an iterator pointing to the beginning of the vector (STL like). | |
| iterator | end () |
| Returns an iterator pointing to the end of the vector (STL like). | |
| const_iterator | begin () const |
| Returns a const-iterator pointing to the beginning of the vector (STL like). | |
| const_iterator | end () const |
| Returns a const-iterator pointing to the end of the vector (STL like). | |
| vector< SCALARTYPE, ALIGNMENT > & | swap (vector< SCALARTYPE, ALIGNMENT > &other) |
| Swaps the entries of the two vectors. | |
| vector< SCALARTYPE, ALIGNMENT > & | fast_swap (vector< SCALARTYPE, ALIGNMENT > &other) |
| Swaps the handles of two vectors by swapping the OpenCL handles only, no data copy. | |
| size_type | size () const |
| Returns the length of the vector (cf. std::vector). | |
| size_type | max_size () const |
| Returns the maximum possible size of the vector, which is given by 128 MByte due to limitations by OpenCL. | |
| size_type | internal_size () const |
| Returns the internal length of the vector, which is given by size() plus the extra memory due to padding the memory with zeros up to a multiple of 'ALIGNMENT'. | |
| bool | empty () |
| Returns true is the size is zero. | |
| const viennacl::ocl::handle < cl_mem > & | handle () const |
| Returns the OpenCL memory viennacl::ocl::handle. Typically used for launching compute viennacl::ocl::kernels. | |
| void | clear () |
| Resets all entries to zero. Does not change the size of the vector. | |
| template<unsigned int MAT_ALIGNMENT> | |
| viennacl::vector< SCALARTYPE, ALIGNMENT > & | operator= (const viennacl::vector_expression< const compressed_matrix< SCALARTYPE, MAT_ALIGNMENT >, const viennacl::vector< SCALARTYPE, ALIGNMENT >, viennacl::op_prod > &proxy) |
| Implementation of the operation v1 = A * v2, where A is a matrix. | |
| template<unsigned int MAT_ALIGNMENT> | |
| viennacl::vector< SCALARTYPE, ALIGNMENT > & | operator= (const viennacl::vector_expression< const coordinate_matrix< SCALARTYPE, MAT_ALIGNMENT >, const viennacl::vector< SCALARTYPE, ALIGNMENT >, viennacl::op_prod > &proxy) |
| Implementation of the operation v1 = A * v2, where A is a matrix. | |
| template<typename F, unsigned int MAT_ALIGNMENT> | |
| viennacl::vector< SCALARTYPE, ALIGNMENT > & | operator= (const viennacl::vector_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const viennacl::vector< SCALARTYPE, ALIGNMENT >, viennacl::op_prod > &proxy) |
| Implementation of the operation v1 = A * v2, where A is a matrix. | |
| template<typename F, unsigned int MAT_ALIGNMENT> | |
| viennacl::vector< SCALARTYPE, ALIGNMENT > & | operator= (const viennacl::vector_expression< const matrix_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, op_trans >, const viennacl::vector< SCALARTYPE, ALIGNMENT >, viennacl::op_prod > &proxy) |
| Implementation of the operation v1 = A * v2, where A is a matrix. | |
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. |
| typedef const_vector_iterator<SCALARTYPE, ALIGNMENT> const_iterator |
| typedef vcl_ptrdiff_t difference_type |
| typedef vector_iterator<SCALARTYPE, ALIGNMENT> iterator |
| typedef vcl_size_t size_type |
| typedef scalar<typename viennacl::tools::CHECK_SCALAR_TEMPLATE_ARGUMENT<SCALARTYPE>::ResultType> value_type |
| vector | ( | ) | [inline] |
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. |
Create a vector from existing OpenCL memory.
Note: The provided memory must take an eventual ALIGNMENT into account, i.e. existing_mem must be at least of size internal_size()! This is trivially the case with the default alignment, but should be considered when using vector<> with an alignment parameter not equal to 1.
| existing_mem | An OpenCL handle representing the memory | |
| vec_size | The size of the vector. |
| vector | ( | vector_expression< LHS, RHS, OP > const & | other | ) | [inline] |
The copy constructor.
Entries of 'vec' are directly copied to this vector.
| iterator begin | ( | ) | [inline] |
Returns an iterator pointing to the beginning of the vector (STL like).
| const_iterator begin | ( | ) | const [inline] |
Returns a const-iterator pointing to the beginning of the vector (STL like).
| void clear | ( | ) | [inline] |
Resets all entries to zero. Does not change the size of the vector.
| bool empty | ( | ) | [inline] |
Returns true is the size is zero.
| const_iterator end | ( | ) | const [inline] |
Returns a const-iterator pointing to the end of the vector (STL like).
| iterator end | ( | ) | [inline] |
Returns an iterator pointing to the end of the vector (STL like).
Swaps the handles of two vectors by swapping the OpenCL handles only, no data copy.
| const viennacl::ocl::handle<cl_mem>& handle | ( | ) | const [inline] |
Returns the OpenCL memory viennacl::ocl::handle. Typically used for launching compute viennacl::ocl::kernels.
| size_type internal_size | ( | ) | const [inline] |
Returns the internal length of the vector, which is given by size() plus the extra memory due to padding the memory with zeros up to a multiple of 'ALIGNMENT'.
| size_type max_size | ( | ) | const [inline] |
Returns the maximum possible size of the vector, which is given by 128 MByte due to limitations by OpenCL.
| entry_proxy<SCALARTYPE> operator() | ( | size_type | index | ) | [inline] |
Read-write access to a single element of the vector.
Read access to a single element of the vector.
| vector_expression< const vector<SCALARTYPE, ALIGNMENT>, const SCALARTYPE, op_prod> operator* | ( | SCALARTYPE | value | ) | const [inline] |
Scales the vector by a CPU scalar 'alpha' and returns an expression template.
| vector_expression< const vector<SCALARTYPE, ALIGNMENT>, const scalar<SCALARTYPE>, op_prod> operator* | ( | scalar< SCALARTYPE > const & | value | ) | const [inline] |
Scales the vector by a GPU scalar 'alpha' and returns an expression template.
| vector<SCALARTYPE, ALIGNMENT>& operator*= | ( | SCALARTYPE | val | ) | [inline] |
Scales this vector by a CPU scalar value.
Scales this vector by a GPU scalar value.
| viennacl::vector< SCALARTYPE, ALIGNMENT > operator+ | ( | const vector_expression< const matrix_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, op_trans >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 + trans(A) * v2, where v1, v2 are vectors and A is a dense matrix.
Implementation of the operation 'result = v1 + A * v2', where A is a matrix.
| proxy | An expression template proxy class | |
| proxy | An expression template proxy class. |
| viennacl::vector< SCALARTYPE, ALIGNMENT > operator+ | ( | const vector_expression< const compressed_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 + A * v2, where v1, v2 are vectors and A is a sparse matrix of type compressed_matrix.
Implementation of the operation 'result = v1 + A * v2', where A is a matrix.
| proxy | An expression template proxy class | |
| proxy | An expression template proxy class. |
| vector<SCALARTYPE, ALIGNMENT> operator+ | ( | const vector< SCALARTYPE, ALIGNMENT > & | vec | ) | const [inline] |
Adds up two vectors.
| vector<SCALARTYPE, ALIGNMENT> operator+ | ( | const vector_expression< vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_prod > & | proxy | ) | const [inline] |
Adds up two vectors, i.e. result = v1 + v2 * alpha, where alpha is a GPU scalar.
| vector<SCALARTYPE, ALIGNMENT> operator+ | ( | const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_prod > & | proxy | ) | const [inline] |
Adds up two vectors, i.e. result = v1 + v2 * alpha, where alpha is a GPU scalar.
| vector<SCALARTYPE, ALIGNMENT> operator+ | ( | const vector_expression< vector< SCALARTYPE, ALIGNMENT >, const SCALARTYPE, op_prod > & | proxy | ) | const [inline] |
Adds up two vectors, i.e. result = v1 + v2 * alpha, where alpha is a CPU scalar.
| vector<SCALARTYPE, ALIGNMENT> operator+ | ( | const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const SCALARTYPE, op_prod > & | proxy | ) | const [inline] |
Adds up two vectors, i.e. result = v1 + v2 * alpha, where alpha is a CPU scalar.
| viennacl::vector< SCALARTYPE, ALIGNMENT > operator+ | ( | const vector_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 + A * v2, where v1, v2 are vectors and A is a dense matrix.
Implementation of the operation 'result = v1 + A * v2', where A is a matrix.
| proxy | An expression template proxy class | |
| proxy | An expression template proxy class. |
| viennacl::vector< SCALARTYPE, ALIGNMENT > operator+ | ( | const vector_expression< const coordinate_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 + A * v2, where v1, v2 are vectors and A is a sparse matrix of type coordinate_matrix.
Implementation of the operation 'result = v1 + A * v2', where A is a matrix.
| proxy | An expression template proxy class | |
| proxy | An expression template proxy class. |
Inplace addition of a vector.
| viennacl::vector< SCALARTYPE, ALIGNMENT > & operator+= | ( | const vector_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 += A * v2, where v1, v2 are vectors and A is a dense matrix.
Implementation of the operation v1 += A * v2, where A is a matrix.
| proxy | An expression template proxy class | |
| proxy | An expression template proxy class. |
| vector<SCALARTYPE, ALIGNMENT>& operator+= | ( | const vector_expression< vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_prod > & | proxy | ) | [inline] |
Inplace addition of a scaled vector, i.e. v1 += alpha * v2, where alpha is a GPU scalar.
| vector<SCALARTYPE, ALIGNMENT>& operator+= | ( | const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_prod > & | proxy | ) | [inline] |
Inplace addition of a scaled vector, i.e. v1 += alpha * v2, where alpha is a GPU scalar.
| viennacl::vector< SCALARTYPE, ALIGNMENT > & operator+= | ( | const vector_expression< const compressed_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 += A * v2, where v1, v2 are vectors and A is a sparse matrix of type compressed_matrix.
Implementation of the operation v1 += A * v2, where A is a matrix.
| proxy | An expression template proxy class | |
| proxy | An expression template proxy class. |
| vector<SCALARTYPE, ALIGNMENT>& operator+= | ( | const vector_expression< vector< SCALARTYPE, ALIGNMENT >, const SCALARTYPE, op_prod > & | proxy | ) | [inline] |
Inplace addition of a scaled vector, i.e. v1 += alpha * v2, where alpha is a CPU scalar.
| vector<SCALARTYPE, ALIGNMENT>& operator+= | ( | const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const SCALARTYPE, op_prod > & | proxy | ) | [inline] |
Inplace addition of a scaled vector, i.e. v1 += alpha * v2, where alpha is a CPU scalar.
| vector<SCALARTYPE, ALIGNMENT>& operator+= | ( | const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_div > & | proxy | ) | [inline] |
Inplace addition of a scaled vector, i.e. v1 += alpha * v2, where alpha is a GPU scalar.
| viennacl::vector< SCALARTYPE, ALIGNMENT > & operator+= | ( | const vector_expression< const matrix_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, op_trans >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 += trans(A) * v2, where v1, v2 are vectors and A is a dense matrix.
Implementation of the operation v1 += A * v2, where A is a matrix.
| proxy | An expression template proxy class | |
| proxy | An expression template proxy class. |
| viennacl::vector< SCALARTYPE, ALIGNMENT > & operator+= | ( | const vector_expression< const coordinate_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 += A * v2, where v1, v2 are vectors and A is a sparse matrix of type coordinate_matrix.
Implementation of the operation v1 += A * v2, where A is a matrix.
| proxy | An expression template proxy class | |
| proxy | An expression template proxy class. |
| viennacl::vector< SCALARTYPE, ALIGNMENT > operator- | ( | const vector_expression< const matrix_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, op_trans >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 - trans(A) * v2, where v1, v2 are vectors and A is a dense matrix.
Implementation of the operation 'result = v1 - A * v2', where A is a matrix.
| proxy | An expression template proxy class | |
| proxy | An expression template proxy class. |
| vector<SCALARTYPE, ALIGNMENT> operator- | ( | const vector< SCALARTYPE, ALIGNMENT > & | vec | ) | const [inline] |
Implementation of result = v1 - v2.
| viennacl::vector< SCALARTYPE, ALIGNMENT > operator- | ( | const vector_expression< const compressed_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 - A * v2, where v1, v2 are vectors and A is a sparse matrix of type compressed_matrix.
Implementation of the operation 'result = v1 - A * v2', where A is a matrix.
| proxy | An expression template proxy class | |
| proxy | An expression template proxy class. |
| vector<SCALARTYPE, ALIGNMENT> operator- | ( | const vector_expression< vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_prod > & | proxy | ) | const [inline] |
Adds up two vectors, i.e. result = v1 - v2 * alpha, where alpha is a GPU scalar.
| vector<SCALARTYPE, ALIGNMENT> operator- | ( | const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const SCALARTYPE, op_prod > & | proxy | ) | const [inline] |
Adds up two vectors, i.e. result = v1 - v2 * alpha, where alpha is a CPU scalar.
| viennacl::vector< SCALARTYPE, ALIGNMENT > operator- | ( | const vector_expression< const coordinate_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 - A * v2, where v1, v2 are vectors and A is a sparse matrix of type coordinate_matrix.
Implementation of the operation 'result = v1 - A * v2', where A is a matrix.
| proxy | An expression template proxy class | |
| proxy | An expression template proxy class. |
| vector<SCALARTYPE, ALIGNMENT> operator- | ( | const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_prod > & | proxy | ) | const [inline] |
Adds up two vectors, i.e. result = v1 - v2 * alpha, where alpha is a GPU scalar.
| vector<SCALARTYPE, ALIGNMENT> operator- | ( | const vector_expression< vector< SCALARTYPE, ALIGNMENT >, const SCALARTYPE, op_prod > & | proxy | ) | const [inline] |
Adds up two vectors, i.e. result = v1 - v2 * alpha, where alpha is a CPU scalar.
| viennacl::vector< SCALARTYPE, ALIGNMENT > operator- | ( | const vector_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 - A * v2, where v1, v2 are vectors and A is a dense matrix.
Implementation of the operation 'result = v1 - A * v2', where A is a matrix.
| proxy | An expression template proxy class | |
| proxy | An expression template proxy class. |
| vector<SCALARTYPE, ALIGNMENT>& operator-= | ( | const vector_expression< vector< SCALARTYPE, ALIGNMENT >, const SCALARTYPE, op_prod > & | proxy | ) | [inline] |
Inplace subtraction of a scaled vector, i.e. v1 -= alpha * v2, where alpha is a CPU scalar.
Inplace subtraction of a vector.
| vector<SCALARTYPE, ALIGNMENT>& operator-= | ( | const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const SCALARTYPE, op_prod > & | proxy | ) | [inline] |
Inplace subtraction of a scaled vector, i.e. v1 -= alpha * v2, where alpha is a CPU scalar.
| viennacl::vector< SCALARTYPE, ALIGNMENT > & operator-= | ( | const vector_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 -= A * v2, where v1, v2 are vectors and A is a dense matrix.
Implementation of the operation v1 -= A * v2, where A is a matrix.
| proxy | An expression template proxy class | |
| proxy | An expression template proxy class. |
| vector<SCALARTYPE, ALIGNMENT>& operator-= | ( | const vector_expression< vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_prod > & | proxy | ) | [inline] |
Inplace subtraction of a scaled vector, i.e. v1 -= alpha * v2, where alpha is a GPU scalar.
| viennacl::vector< SCALARTYPE, ALIGNMENT > & operator-= | ( | const vector_expression< const compressed_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 -= A * v2, where v1, v2 are vectors and A is a sparse matrix of type compressed_matrix.
Implementation of the operation v1 -= A * v2, where A is a matrix.
| proxy | An expression template proxy class | |
| proxy | An expression template proxy class. |
| vector<SCALARTYPE, ALIGNMENT>& operator-= | ( | const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_div > & | proxy | ) | [inline] |
Inplace subtraction of a scaled vector, i.e. v1 -= alpha * v2, where alpha is a CPU scalar.
| viennacl::vector< SCALARTYPE, ALIGNMENT > & operator-= | ( | const vector_expression< const coordinate_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 -= A * v2, where v1, v2 are vectors and A is a sparse matrix of type coordinate_matrix.
Implementation of the operation v1 -= A * v2, where A is a matrix.
| proxy | An expression template proxy class | |
| proxy | An expression template proxy class. |
| vector<SCALARTYPE, ALIGNMENT>& operator-= | ( | const vector_expression< const vector< SCALARTYPE, ALIGNMENT >, const scalar< SCALARTYPE >, op_prod > & | proxy | ) | [inline] |
Inplace subtraction of a scaled vector, i.e. v1 -= alpha * v2, where alpha is a GPU scalar.
| viennacl::vector< SCALARTYPE, ALIGNMENT > & operator-= | ( | const vector_expression< const matrix_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, op_trans >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 -= trans(A) * v2, where v1, v2 are vectors and A is a dense matrix.
Implementation of the operation v1 -= A * v2, where A is a matrix.
| proxy | An expression template proxy class | |
| proxy | An expression template proxy class. |
| vector_expression< const vector<SCALARTYPE, ALIGNMENT>, const scalar<SCALARTYPE>, op_div> operator/ | ( | scalar< SCALARTYPE > const & | value | ) | const [inline] |
Scales the vector by a GPU scalar 'alpha' and returns an expression template.
| vector_expression< const vector<SCALARTYPE, ALIGNMENT>, const SCALARTYPE, op_div> operator/ | ( | SCALARTYPE | value | ) | const [inline] |
Scales the vector by a CPU scalar 'alpha' and returns an expression template.
| vector<SCALARTYPE, ALIGNMENT>& operator/= | ( | SCALARTYPE | val | ) | [inline] |
Scales this vector by a CPU scalar value.
Scales this vector by a CPU scalar value.
| viennacl::vector<SCALARTYPE, ALIGNMENT>& operator= | ( | const viennacl::vector_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const viennacl::vector< SCALARTYPE, ALIGNMENT >, viennacl::op_prod > & | proxy | ) |
Implementation of the operation v1 = A * v2, where A is a matrix.
| proxy | An expression template proxy class. |
| vector<SCALARTYPE, ALIGNMENT>& operator= | ( | const vector_expression< VectorType, const SCALARTYPE, op_prod > & | proxy | ) | [inline] |
Implementation of the operation v1 = alpha * v2, where alpha is a CPU scalar.
| proxy | An expression template proxy class. |
| vector<SCALARTYPE, ALIGNMENT>& operator= | ( | const vector_expression< vector< SCALARTYPE, ALIGNMENT >, vector< SCALARTYPE, ALIGNMENT >, op_sub > & | proxy | ) | [inline] |
Implementation of the operation v1 = v2 - v3.
| proxy | An expression template proxy class. |
| viennacl::vector<SCALARTYPE, ALIGNMENT>& operator= | ( | const viennacl::vector_expression< const matrix_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, op_trans >, const viennacl::vector< SCALARTYPE, ALIGNMENT >, viennacl::op_prod > & | proxy | ) |
Implementation of the operation v1 = A * v2, where A is a matrix.
| proxy | An expression template proxy class. |
| vector<SCALARTYPE, ALIGNMENT>& operator= | ( | const vector_expression< vector< SCALARTYPE, ALIGNMENT >, vector< SCALARTYPE, ALIGNMENT >, op_add > & | proxy | ) | [inline] |
Implementation of the operation v1 = v2 + v3.
| proxy | An expression template proxy class. |
| viennacl::vector<SCALARTYPE, ALIGNMENT>& operator= | ( | const viennacl::vector_expression< const compressed_matrix< SCALARTYPE, MAT_ALIGNMENT >, const viennacl::vector< SCALARTYPE, ALIGNMENT >, viennacl::op_prod > & | proxy | ) |
Implementation of the operation v1 = A * v2, where A is a matrix.
| proxy | An expression template proxy class. |
| vector<SCALARTYPE, ALIGNMENT>& operator= | ( | const vector_expression< const compressed_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 = A * v2, where v1, v2 are vectors and A is a sparse matrix of type compressed_matrix.
| proxy | An expression template proxy class |
| vector<SCALARTYPE, ALIGNMENT>& operator= | ( | const vector_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 = A * v2, where v1, v2 are vectors and A is a dense matrix.
| proxy | An expression template proxy class |
| vector<SCALARTYPE, ALIGNMENT>& operator= | ( | const vector_expression< const coordinate_matrix< SCALARTYPE, MAT_ALIGNMENT >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 = A * v2, where v1, v2 are vectors and A is a sparse matrix of type coordinate_matrix.
| proxy | An expression template proxy class |
| vector<SCALARTYPE, ALIGNMENT>& operator= | ( | const vector_expression< VectorType, const scalar< SCALARTYPE >, op_prod > & | proxy | ) | [inline] |
Implementation of the operation v1 = alpha * v2, where alpha is a GPU scalar.
| proxy | An expression template proxy class. |
| viennacl::vector<SCALARTYPE, ALIGNMENT>& operator= | ( | const viennacl::vector_expression< const coordinate_matrix< SCALARTYPE, MAT_ALIGNMENT >, const viennacl::vector< SCALARTYPE, ALIGNMENT >, viennacl::op_prod > & | proxy | ) |
Implementation of the operation v1 = A * v2, where A is a matrix.
| proxy | An expression template proxy class. |
| vector<SCALARTYPE, ALIGNMENT>& operator= | ( | const vector_expression< const matrix_expression< const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, const matrix< SCALARTYPE, F, MAT_ALIGNMENT >, op_trans >, const vector< SCALARTYPE, ALIGNMENT >, op_prod > & | proxy | ) |
Operator overload for v1 = trans(A) * v2, where v1, v2 are vectors and A is a dense matrix.
| proxy | An expression template proxy class |
Assignment operator. This vector is resized if 'vec' is of a different size.
| vector<SCALARTYPE, ALIGNMENT>& operator= | ( | const vector_expression< VectorType, const SCALARTYPE, op_div > & | proxy | ) | [inline] |
Implementation of the operation v1 = v2 / alpha, where alpha is a CPU scalar.
| proxy | An expression template proxy class. |
| vector<SCALARTYPE, ALIGNMENT>& operator= | ( | const vector_expression< VectorType, const scalar< SCALARTYPE >, op_div > & | proxy | ) | [inline] |
Implementation of the operation v1 = v2 / alpha, where alpha is a GPU scalar.
| proxy | An expression template proxy class. |
Read access to a single element of the vector.
| entry_proxy<SCALARTYPE> operator[] | ( | size_type | index | ) | [inline] |
Read-write access to a single element of the vector.
| void resize | ( | size_type | new_size, | |
| bool | preserve = true | |||
| ) | [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. |
| size_type size | ( | ) | const [inline] |
Returns the length of the vector (cf. std::vector).
Swaps the entries of the two vectors.
1.7.1