ViennaCL - The Vienna Computing Library  1.4.2
Public Types | Public Member Functions
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>

Inheritance diagram for vector< SCALARTYPE, ALIGNMENT >:
vector_base< SCALARTYPE >

Public Types

typedef base_type::size_type size_type

Public Member Functions

 vector ()
 Default constructor in order to be compatible with various containers.
 vector (size_type vec_size)
 An explicit constructor for the vector, allocating the given amount of memory (plus a padding specified by 'ALIGNMENT')
template<typename LHS , typename RHS , typename OP >
 vector (vector_expression< const LHS, const RHS, OP > const &proxy)
 vector (const base_type &v)
 vector (const self_type &v)
 vector (unit_vector< SCALARTYPE > const &v)
 Creates the vector from the supplied unit vector.
 vector (zero_vector< SCALARTYPE > const &v)
 Creates the vector from the supplied zero vector.
 vector (scalar_vector< SCALARTYPE > const &v)
 Creates the vector from the supplied scalar vector.
template<typename SparseMatrixType >
viennacl::enable_if
< viennacl::is_any_sparse_matrix
< SparseMatrixType >::value,
self_type & >::type 
operator= (const viennacl::vector_expression< const SparseMatrixType, const base_type, viennacl::op_prod > &proxy)
 Implementation of the operation v1 = A * v2, where A is a sparse matrix.
template<unsigned int MAT_ALIGNMENT>
self_typeoperator= (const vector_expression< const circulant_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_typeoperator+= (const vector_expression< const circulant_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_typeoperator-= (const vector_expression< const circulant_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_type operator+ (const vector_expression< const circulant_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_type operator- (const vector_expression< const circulant_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_typeoperator= (const vector_expression< const hankel_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_typeoperator+= (const vector_expression< const hankel_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_typeoperator-= (const vector_expression< const hankel_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_type operator+ (const vector_expression< const hankel_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_type operator- (const vector_expression< const hankel_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_typeoperator= (const vector_expression< const toeplitz_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_typeoperator+= (const vector_expression< const toeplitz_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_typeoperator-= (const vector_expression< const toeplitz_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_type operator+ (const vector_expression< const toeplitz_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_type operator- (const vector_expression< const toeplitz_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_typeoperator= (const vector_expression< const vandermonde_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_typeoperator+= (const vector_expression< const vandermonde_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_typeoperator-= (const vector_expression< const vandermonde_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_type operator+ (const vector_expression< const vandermonde_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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>
self_type operator- (const vector_expression< const vandermonde_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, op_prod > &proxy)
 Operator overload for v1 - A * v2, where v1, v2 are vectors and A is a sparse matrix of type circulant_matrix.
vector_expression< const
vector_base< SCALARTYPE >
, const SCALARTYPE, op_prod > 
operator- () const
 Sign flip for the vector. Emulated to be equivalent to -1.0 * vector.
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'.
self_typefast_swap (self_type &other)
 Swaps the handles of two vectors by swapping the OpenCL handles only, no data copy.
void switch_memory_domain (viennacl::memory_types new_domain)
template<unsigned int MAT_ALIGNMENT>
viennacl::vector< SCALARTYPE,
ALIGNMENT > & 
operator= (const viennacl::vector_expression< const circulant_matrix< SCALARTYPE, MAT_ALIGNMENT >, const viennacl::vector_base< SCALARTYPE >, 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_base< SCALARTYPE >, 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_base< SCALARTYPE >, 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_base< SCALARTYPE >, viennacl::op_prod > &proxy)
 Implementation of the operation v1 = A * v2, where A is a matrix.

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

Reimplemented from vector_base< SCALARTYPE >.


Constructor & Destructor Documentation

vector ( ) [inline, explicit]

Default constructor in order to be compatible with various containers.

vector ( size_type  vec_size) [inline, explicit]

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 ( vector_expression< const LHS, const RHS, OP > const &  proxy) [inline]
vector ( const base_type v) [inline]
vector ( const self_type v) [inline]
vector ( unit_vector< SCALARTYPE > const &  v) [inline]

Creates the vector from the supplied unit vector.

vector ( zero_vector< SCALARTYPE > const &  v) [inline]

Creates the vector from the supplied zero vector.

vector ( scalar_vector< SCALARTYPE > const &  v) [inline]

Creates the vector from the supplied scalar vector.


Member Function Documentation

self_type& fast_swap ( self_type other) [inline]

Swaps the handles of two vectors by swapping the OpenCL handles only, no data copy.

viennacl::vector< SCALARTYPE, ALIGNMENT > operator+ ( const vector_expression< const circulant_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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 base_type, 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 base_type, 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 base_type, 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 circulant_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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 base_type, 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 base_type, 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 base_type, 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 circulant_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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 base_type, 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 base_type, 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 base_type, 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_expression<const vector_base<SCALARTYPE>, const SCALARTYPE, op_prod> operator- ( ) const [inline]

Sign flip for the vector. Emulated to be equivalent to -1.0 * vector.

Reimplemented from vector_base< SCALARTYPE >.

viennacl::vector< SCALARTYPE, ALIGNMENT > & operator-= ( const vector_expression< const circulant_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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 base_type, 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 base_type, 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 base_type, 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 viennacl::vector_expression< const hankel_matrix< SCALARTYPE, MAT_ALIGNMENT >, const viennacl::vector_base< SCALARTYPE >, 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_base< SCALARTYPE >, 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_base< SCALARTYPE >, 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_base< SCALARTYPE >, viennacl::op_prod > &  proxy)

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

Parameters:
proxyAn expression template proxy class.
viennacl::enable_if< viennacl::is_any_sparse_matrix< SparseMatrixType >::value, viennacl::vector< SCALARTYPE, ALIGNMENT > & >::type operator= ( const viennacl::vector_expression< const SparseMatrixType, const base_type, viennacl::op_prod > &  proxy)

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

Parameters:
proxyAn expression template proxy class.
self_type& operator= ( const vector_expression< const circulant_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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
self_type& operator= ( const vector_expression< const hankel_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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
self_type& operator= ( const vector_expression< const toeplitz_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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
self_type& operator= ( const vector_expression< const vandermonde_matrix< SCALARTYPE, MAT_ALIGNMENT >, const base_type, 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
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.

Reimplemented from vector_base< SCALARTYPE >.

void switch_memory_domain ( viennacl::memory_types  new_domain) [inline]

Reimplemented from vector_base< SCALARTYPE >.


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