ViennaCL - The Vienna Computing Library  1.2.0
Public Types | Public Member Functions | Static Public Attributes
vector< SCALARTYPE, ALIGNMENT > Class Template Reference

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.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > & operator= (const vector_expression< const circulant_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > & operator+= (const vector_expression< const circulant_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > & operator-= (const vector_expression< const circulant_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > operator+ (const vector_expression< const circulant_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > operator- (const vector_expression< const circulant_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > & operator= (const vector_expression< const hankel_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > & operator+= (const vector_expression< const hankel_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > & operator-= (const vector_expression< const hankel_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > operator+ (const vector_expression< const hankel_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > operator- (const vector_expression< const hankel_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > & operator= (const vector_expression< const toeplitz_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > & operator+= (const vector_expression< const toeplitz_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > & operator-= (const vector_expression< const toeplitz_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > operator+ (const vector_expression< const toeplitz_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > operator- (const vector_expression< const toeplitz_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > & operator= (const vector_expression< const vandermonde_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > & operator+= (const vector_expression< const vandermonde_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > & operator-= (const vector_expression< const vandermonde_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > operator+ (const vector_expression< const vandermonde_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 circulant_matrix.
template<unsigned int MAT_ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > operator- (const vector_expression< const vandermonde_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 circulant_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 circulant_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 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<unsigned int MAT_ALIGNMENT>
viennacl::vector< SCALARTYPE,
ALIGNMENT > & 
operator= (const viennacl::vector_expression< const hankel_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.
template<unsigned int MAT_ALIGNMENT>
viennacl::vector< SCALARTYPE,
ALIGNMENT > & 
operator= (const viennacl::vector_expression< const toeplitz_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 vandermonde_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.

Static Public Attributes

static const int alignment = ALIGNMENT

Detailed Description

template<class SCALARTYPE, unsigned int ALIGNMENT>
class viennacl::vector< SCALARTYPE, ALIGNMENT >

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.

Template Parameters
SCALARTYPEThe floating point type, either 'float' or 'double'
ALIGNMENTThe 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.

Member Typedef Documentation

typedef const_vector_iterator<SCALARTYPE, ALIGNMENT> const_iterator
typedef vector_iterator<SCALARTYPE, ALIGNMENT> iterator
typedef scalar<typename viennacl::tools::CHECK_SCALAR_TEMPLATE_ARGUMENT<SCALARTYPE>::ResultType> value_type

Constructor & Destructor Documentation

vector ( )
inline

Default constructor in order to be compatible with various containers.

vector ( size_type  vec_size)
inlineexplicit

An explicit constructor for the vector, allocating the given amount of memory (plus a padding specified by 'ALIGNMENT')

Parameters
vec_sizeThe length (i.e. size) of the vector.
vector ( cl_mem  existing_mem,
size_type  vec_size 
)
inlineexplicit

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.

Parameters
existing_memAn OpenCL handle representing the memory
vec_sizeThe size of the vector.
vector ( vector_expression< LHS, RHS, OP > const &  other)
inline
vector ( const vector< SCALARTYPE, ALIGNMENT > &  vec)
inline

The copy constructor.

Entries of 'vec' are directly copied to this vector.

Member Function Documentation

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.

iterator end ( )
inline

Returns an iterator pointing to the end of the vector (STL like)

const_iterator end ( ) const
inline

Returns a const-iterator pointing to the end of the vector (STL like)

vector<SCALARTYPE, ALIGNMENT>& fast_swap ( vector< SCALARTYPE, ALIGNMENT > &  other)
inline

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.

scalar<SCALARTYPE> operator() ( size_type  index) const
inline

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.

vector<SCALARTYPE, ALIGNMENT>& operator*= ( scalar< SCALARTYPE > const &  gpu_val)
inline

Scales this vector by a GPU scalar value.

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.

Parameters
proxyAn expression template proxy class
proxyAn 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.

Parameters
proxyAn expression template proxy class
proxyAn 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.

Parameters
proxyAn expression template proxy class
proxyAn 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.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
viennacl::vector< SCALARTYPE, ALIGNMENT > operator+ ( const vector_expression< const circulant_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 circulant_matrix.

Implementation of the operation 'result = v1 + A * v2', where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
viennacl::vector< SCALARTYPE, ALIGNMENT > operator+ ( const vector_expression< const hankel_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 circulant_matrix.

Implementation of the operation 'result = v1 + A * v2', where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
viennacl::vector< SCALARTYPE, ALIGNMENT > operator+ ( const vector_expression< const toeplitz_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 circulant_matrix.

Implementation of the operation 'result = v1 + A * v2', where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
viennacl::vector< SCALARTYPE, ALIGNMENT > operator+ ( const vector_expression< const vandermonde_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 circulant_matrix.

Implementation of the operation 'result = v1 + A * v2', where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn 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 v1 += A * v2, where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn 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 v1 += A * v2, where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn 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 v1 += A * v2, where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn 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.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
viennacl::vector< SCALARTYPE, ALIGNMENT > & operator+= ( const vector_expression< const circulant_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 circulant_matrix.

Implementation of the operation v1 += A * v2, where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
viennacl::vector< SCALARTYPE, ALIGNMENT > & operator+= ( const vector_expression< const hankel_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 circulant_matrix.

Implementation of the operation v1 += A * v2, where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
viennacl::vector< SCALARTYPE, ALIGNMENT > & operator+= ( const vector_expression< const toeplitz_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 circulant_matrix.

Implementation of the operation v1 += A * v2, where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
viennacl::vector< SCALARTYPE, ALIGNMENT > & operator+= ( const vector_expression< const vandermonde_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 circulant_matrix.

Implementation of the operation v1 += A * v2, where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
vector<SCALARTYPE, ALIGNMENT>& operator+= ( const vector< SCALARTYPE, ALIGNMENT > &  vec)
inline

Inplace addition of a vector.

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.

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< 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.

Parameters
proxyAn expression template proxy class
proxyAn 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.

Parameters
proxyAn expression template proxy class
proxyAn 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.

Parameters
proxyAn expression template proxy class
proxyAn 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.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
viennacl::vector< SCALARTYPE, ALIGNMENT > operator- ( const vector_expression< const circulant_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 circulant_matrix.

Implementation of the operation 'result = v1 - A * v2', where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
viennacl::vector< SCALARTYPE, ALIGNMENT > operator- ( const vector_expression< const hankel_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 circulant_matrix.

Implementation of the operation 'result = v1 - A * v2', where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
viennacl::vector< SCALARTYPE, ALIGNMENT > operator- ( const vector_expression< const toeplitz_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 circulant_matrix.

Implementation of the operation 'result = v1 - A * v2', where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
viennacl::vector< SCALARTYPE, ALIGNMENT > operator- ( const vector_expression< const vandermonde_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 circulant_matrix.

Implementation of the operation 'result = v1 - A * v2', where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
vector<SCALARTYPE, ALIGNMENT> operator- ( const vector< SCALARTYPE, ALIGNMENT > &  vec) const
inline

Implementation of result = v1 - v2.

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 v1 -= A * v2, where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn 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 v1 -= A * v2, where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn 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 v1 -= A * v2, where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn 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.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
viennacl::vector< SCALARTYPE, ALIGNMENT > & operator-= ( const vector_expression< const circulant_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 circulant_matrix.

Implementation of the operation v1 -= A * v2, where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
viennacl::vector< SCALARTYPE, ALIGNMENT > & operator-= ( const vector_expression< const hankel_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 circulant_matrix.

Implementation of the operation v1 -= A * v2, where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
viennacl::vector< SCALARTYPE, ALIGNMENT > & operator-= ( const vector_expression< const toeplitz_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 circulant_matrix.

Implementation of the operation v1 -= A * v2, where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
viennacl::vector< SCALARTYPE, ALIGNMENT > & operator-= ( const vector_expression< const vandermonde_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 circulant_matrix.

Implementation of the operation v1 -= A * v2, where A is a matrix.

Parameters
proxyAn expression template proxy class
proxyAn expression template proxy class.
vector<SCALARTYPE, ALIGNMENT>& operator-= ( const vector< SCALARTYPE, ALIGNMENT > &  vec)
inline

Inplace subtraction of a vector.

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.

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.

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.

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.

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.

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_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<SCALARTYPE, ALIGNMENT>& operator/= ( SCALARTYPE  val)
inline

Scales this vector by a CPU scalar value.

vector<SCALARTYPE, ALIGNMENT>& operator/= ( scalar< SCALARTYPE > const &  gpu_val)
inline

Scales this vector by a CPU scalar value.

viennacl::vector<SCALARTYPE, ALIGNMENT>& operator= ( const viennacl::vector_expression< const hankel_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.

Parameters
proxyAn expression template proxy class.
viennacl::vector<SCALARTYPE, ALIGNMENT>& operator= ( const viennacl::vector_expression< const vandermonde_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.

Parameters
proxyAn expression template proxy class.
viennacl::vector<SCALARTYPE, ALIGNMENT>& operator= ( const viennacl::vector_expression< const toeplitz_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.

Parameters
proxyAn expression template proxy class.
viennacl::vector<SCALARTYPE, ALIGNMENT>& operator= ( const viennacl::vector_expression< const circulant_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.

Parameters
proxyAn 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.

Parameters
proxyAn 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.

Parameters
proxyAn expression template proxy class.
vector<SCALARTYPE, ALIGNMENT>& operator= ( const vector< SCALARTYPE, ALIGNMENT > &  vec)
inline

Assignment operator. This vector is resized if 'vec' is of a different size.

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.

Parameters
proxyAn 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.

Parameters
proxyAn 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.

Parameters
proxyAn expression template proxy class.
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.

Parameters
proxyAn 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.

Parameters
proxyAn 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.

Parameters
proxyAn 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.

Parameters
proxyAn 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.

Parameters
proxyAn 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.

Parameters
proxyAn 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.

Parameters
proxyAn expression template proxy class
vector<SCALARTYPE, ALIGNMENT>& operator= ( const vector_expression< const circulant_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 circulant_matrix.

Parameters
proxyAn expression template proxy class
vector<SCALARTYPE, ALIGNMENT>& operator= ( const vector_expression< const hankel_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 circulant_matrix.

Parameters
proxyAn expression template proxy class
vector<SCALARTYPE, ALIGNMENT>& operator= ( const vector_expression< const toeplitz_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 circulant_matrix.

Parameters
proxyAn expression template proxy class
vector<SCALARTYPE, ALIGNMENT>& operator= ( const vector_expression< const vandermonde_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 circulant_matrix.

Parameters
proxyAn expression template proxy class
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.

Parameters
proxyAn 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.

Parameters
proxyAn expression template proxy class.
entry_proxy<SCALARTYPE> operator[] ( size_type  index)
inline

Read-write access to a single element of the vector.

scalar<SCALARTYPE> operator[] ( size_type  index) const
inline

Read 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'.

Parameters
new_sizeThe new size of the vector
preserveIf 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)

vector<SCALARTYPE, ALIGNMENT>& swap ( vector< SCALARTYPE, ALIGNMENT > &  other)
inline

Swaps the entries of the two vectors.

Field Documentation

const int alignment = ALIGNMENT
static

The documentation for this class was generated from the following files: