ViennaCL - The Vienna Computing Library: viennacl::vector< SCALARTYPE, ALIGNMENT > Class Template Reference

ViennaCL - The Vienna Computing Library 1.7.1 Free open-source GPU-accelerated linear algebra and solver library. |

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
viennacl::vector< SCALARTYPE, ALIGNMENT > Class Template Reference

`#include <forwards.h>`

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

## Public Types
typedef base_type::size_type | size_type
typedef base_type::difference_type | difference_type
Public Types inherited from viennacl::vector_base< NumericT >
typedef scalar< NumericT > | value_type
typedef NumericT | cpu_value_type
typedef viennacl::backend::mem_handle | handle_type
typedef SizeT | size_type
typedef DistanceT | difference_type
typedef const_vector_iterator < NumericT, 1 > | const_iterator
typedef vector_iterator < NumericT, 1 > | iterator

## Public Member Functions
| vector ()
| Default constructor in order to be compatible with various containers. More...
| vector (size_type vec_size)
| An explicit constructor for the vector, allocating the given amount of memory (plus a padding specified by 'AlignmentV') More...
| vector (size_type vec_size, viennacl::context ctx)
| vector (NumericT *ptr_to_mem, viennacl::memory_types mem_type, size_type vec_size, size_type start=0, size_type stride=1)
template<typename LHS , typename RHS , typename OP >
| vector (vector_expression< const LHS, const RHS, OP > const &proxy)
| vector (const base_type &v)
| vector (const self_type &v)
| vector (unit_vector< NumericT > const &v)
| Creates the vector from the supplied unit vector. More...
| vector (zero_vector< NumericT > const &v)
| Creates the vector from the supplied zero vector. More...
| vector (scalar_vector< NumericT > const &v)
| Creates the vector from the supplied scalar vector. More...
template<typename T >
self_type & | operator= (T const &other)
void | resize (size_type new_size, bool preserve=true)
| Resizes the allocated memory for the vector. Pads the memory to be a multiple of 'AlignmentV'. More...
void | resize (size_type new_size, viennacl::context ctx, bool preserve=true)
self_type & | fast_swap (self_type &other)
| Swaps the handles of two vectors by swapping the OpenCL handles only, no data copy. More...
void | switch_memory_context (viennacl::context new_ctx)
Public Member Functions inherited from viennacl::vector_base< NumericT >
size_type | size () const
| Returns the length of the vector (cf. std::vector) More...
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 'AlignmentV'. More...
size_type | start () const
| Returns the offset within the buffer. More...
size_type | stride () const
| Returns the stride within the buffer (in multiples of sizeof(NumericT)) More...
bool | empty () const
| Returns true is the size is zero. More...
const handle_type & | handle () const
| Returns the memory handle. More...
handle_type & | handle ()
| Returns the memory handle. More...
viennacl::memory_types | memory_domain () const
| vector_base ()
| Default constructor in order to be compatible with various containers. More...
| vector_base (viennacl::backend::mem_handle &h, size_type vec_size, size_type vec_start, size_type vec_stride)
| An explicit constructor for wrapping an existing vector into a vector_range or vector_slice. More...
| vector_base (size_type vec_size, viennacl::context ctx=viennacl::context())
| Creates a vector and allocates the necessary memory. More...
| vector_base (NumericT *ptr_to_mem, viennacl::memory_types mem_type, size_type vec_size, vcl_size_t start=0, size_type stride=1)
| vector_base (vector_expression< const LHS, const RHS, OP > const &proxy)
| vector_base (const self_type &other)
| vector_base (const vector_base< OtherNumericT > &v1)
self_type & | operator= (const self_type &vec)
| Assignment operator. Other vector needs to be of the same size, or this vector is not yet initialized. More...
self_type & | operator= (const vector_expression< const LHS, const RHS, OP > &proxy)
| Implementation of the operation v1 = v2 @ alpha, where @ denotes either multiplication or division, and alpha is either a CPU or a GPU scalar. More...
self_type & | operator= (const vector_base< OtherNumericT > &v1)
| Converts a vector of a different numeric type to the current numeric type. More...
self_type & | operator= (unit_vector< NumericT > const &v)
| Creates the vector from the supplied unit vector. More...
self_type & | operator= (zero_vector< NumericT > const &v)
| Creates the vector from the supplied zero vector. More...
self_type & | operator= (scalar_vector< NumericT > const &v)
| Creates the vector from the supplied scalar vector. More...
self_type & | operator= (const viennacl::vector_expression< const matrix_base< NumericT >, const vector_base< NumericT >, viennacl::op_prod > &proxy)
| Operator overload for v1 = A * v2, where v1, v2 are vectors and A is a dense matrix. More...
self_type & | operator= (const vector_expression< const matrix_expression< const matrix_base< NumericT >, const matrix_base< NumericT >, op_trans >, const vector_base< NumericT >, op_prod > &proxy)
| Operator overload for v1 = trans(A) * v2, where v1, v2 are vectors and A is a dense matrix. More...
entry_proxy< NumericT > | operator() (size_type index)
| Read-write access to a single element of the vector. More...
const_entry_proxy< NumericT > | operator() (size_type index) const
| Read access to a single element of the vector. More...
entry_proxy< NumericT > | operator[] (size_type index)
| Read-write access to a single element of the vector. More...
const_entry_proxy< NumericT > | operator[] (size_type index) const
| Read access to a single element of the vector. More...
self_type & | operator+= (const self_type &vec)
self_type & | operator-= (const self_type &vec)
self_type & | operator*= (char val)
| Scales a vector (or proxy) by a char (8-bit integer) More...
self_type & | operator*= (short val)
| Scales a vector (or proxy) by a short integer. More...
self_type & | operator*= (int val)
| Scales a vector (or proxy) by an integer. More...
self_type & | operator*= (long val)
| Scales a vector (or proxy) by a long integer. More...
self_type & | operator*= (float val)
| Scales a vector (or proxy) by a single precision floating point value. More...
self_type & | operator*= (double val)
| Scales a vector (or proxy) by a double precision floating point value. More...
self_type & | operator/= (char val)
| Scales a vector (or proxy) by a char (8-bit integer) More...
self_type & | operator/= (short val)
| Scales a vector (or proxy) by a short integer. More...
self_type & | operator/= (int val)
| Scales a vector (or proxy) by an integer. More...
self_type & | operator/= (long val)
| Scales a vector (or proxy) by a long integer. More...
self_type & | operator/= (float val)
| Scales a vector (or proxy) by a single precision floating point value. More...
self_type & | operator/= (double val)
| Scales a vector (or proxy) by a double precision floating point value. More...
vector_expression< const self_type, const NumericT, op_mult > | operator* (char value) const
| Scales the vector by a char (8-bit integer) 'alpha' and returns an expression template. More...
vector_expression< const self_type, const NumericT, op_mult > | operator* (short value) const
| Scales the vector by a short integer 'alpha' and returns an expression template. More...
vector_expression< const self_type, const NumericT, op_mult > | operator* (int value) const
| Scales the vector by an integer 'alpha' and returns an expression template. More...
vector_expression< const self_type, const NumericT, op_mult > | operator* (long value) const
| Scales the vector by a long integer 'alpha' and returns an expression template. More...
vector_expression< const self_type, const NumericT, op_mult > | operator* (float value) const
| Scales the vector by a single precision floating point value 'alpha' and returns an expression template. More...
vector_expression< const self_type, const NumericT, op_mult > | operator* (double value) const
| Scales the vector by a double precision floating point value 'alpha' and returns an expression template. More...
vector_expression< const self_type, const NumericT, op_div > | operator/ (char value) const
| Scales the vector by a char (8-bit integer) 'alpha' and returns an expression template. More...
vector_expression< const self_type, const NumericT, op_div > | operator/ (short value) const
| Scales the vector by a short integer 'alpha' and returns an expression template. More...
vector_expression< const self_type, const NumericT, op_div > | operator/ (int value) const
| Scales the vector by an integer 'alpha' and returns an expression template. More...
vector_expression< const self_type, const NumericT, op_div > | operator/ (long value) const
| Scales the vector by a long integer 'alpha' and returns an expression template. More...
vector_expression< const self_type, const NumericT, op_div > | operator/ (float value) const
| Scales the vector by a single precision floating point value 'alpha' and returns an expression template. More...
vector_expression< const self_type, const NumericT, op_div > | operator/ (double value) const
| Scales the vector by a double precision floating point value 'alpha' and returns an expression template. More...
vector_expression< const self_type, const NumericT, op_mult > | operator- () const
| Sign flip for the vector. Emulated to be equivalent to -1.0 * vector. More...
iterator | begin ()
| Returns an iterator pointing to the beginning of the vector (STL like) More...
const_iterator | begin () const
| Returns a const-iterator pointing to the beginning of the vector (STL like) More...
iterator | end ()
| Returns an iterator pointing to the end of the vector (STL like) More...
const_iterator | end () const
| Returns a const-iterator pointing to the end of the vector (STL like) More...
self_type & | swap (self_type &other)
| Swaps the entries of the two vectors. More...
void | clear ()
| Resets all entries to zero. Does not change the size of the vector. More...

## Additional Inherited Members
Protected Member Functions inherited from viennacl::vector_base< NumericT >
void | set_handle (viennacl::backend::mem_handle const &h)
self_type & | fast_swap (self_type &other)
| Swaps the handles of two vectors by swapping the OpenCL handles only, no data copy. More...
void | pad ()
| Pads vectors with alignment > 1 with trailing zeros if the internal size is larger than the visible size. More...
void | switch_memory_context (viennacl::context new_ctx)
void | resize (size_type new_size, bool preserve=true)
| Resizes the allocated memory for the vector. Pads the memory to be a multiple of 'AlignmentV'. More...
void | resize (size_type new_size, viennacl::context ctx, bool preserve=true)
| Resizes the allocated memory for the vector. Convenience function for setting an OpenCL context in case reallocation is needed. More...

## Detailed Description

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

Examples:
  examples/tutorial/libviennacl.cpp.

Definition at line 266 of file forwards.h.

## Member Typedef Documentation

template<class SCALARTYPE, unsigned int ALIGNMENT = 1>

typedef base_type::difference_type viennacl::vector< SCALARTYPE, ALIGNMENT >::difference_type

Definition at line 957 of file vector.hpp.

template<class SCALARTYPE, unsigned int ALIGNMENT = 1>

typedef base_type::size_type viennacl::vector< SCALARTYPE, ALIGNMENT >::size_type

Definition at line 956 of file vector.hpp.

## Constructor & Destructor Documentation

template<class SCALARTYPE, unsigned int ALIGNMENT = 1>

viennacl::vector< SCALARTYPE, ALIGNMENT >::vector | ( |  | ) |
| inlineexplicit

Default constructor in order to be compatible with various containers.

Definition at line 961 of file vector.hpp.

template<class SCALARTYPE, unsigned int ALIGNMENT = 1>

viennacl::vector< SCALARTYPE, ALIGNMENT >::vector | ( | size_type | vec_size | ) |
| inlineexplicit

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

Parameters

  vec_size | The length (i.e. size) of the vector.

Definition at line 967 of file vector.hpp.

template<class SCALARTYPE, unsigned int ALIGNMENT = 1>

viennacl::vector< SCALARTYPE, ALIGNMENT >::vector | ( | size_type | vec_size,
|  | viennacl::context | ctx
| ) |  |
| inlineexplicit

Definition at line 969 of file vector.hpp.

template<class SCALARTYPE, unsigned int ALIGNMENT = 1>

viennacl::vector< SCALARTYPE, ALIGNMENT >::vector | ( | NumericT * | ptr_to_mem,
|  | viennacl::memory_types | mem_type,
|  | size_type | vec_size,
|  | size_type | start = `0`,
|  | size_type | stride = `1`
| ) |  |
| inlineexplicit

Definition at line 971 of file vector.hpp.

template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
template<typename LHS , typename RHS , typename OP >

viennacl::vector< SCALARTYPE, ALIGNMENT >::vector | ( | vector_expression< const LHS, const RHS, OP > const & | proxy | ) |
| inline

Definition at line 994 of file vector.hpp.

template<class SCALARTYPE, unsigned int ALIGNMENT = 1>

viennacl::vector< SCALARTYPE, ALIGNMENT >::vector | ( | const base_type & | v | ) |
| inline

Definition at line 996 of file vector.hpp.

template<class SCALARTYPE, unsigned int ALIGNMENT = 1>

viennacl::vector< SCALARTYPE, ALIGNMENT >::vector | ( | const self_type & | v | ) |
| inline

Definition at line 1002 of file vector.hpp.

template<class SCALARTYPE, unsigned int ALIGNMENT = 1>

viennacl::vector< SCALARTYPE, ALIGNMENT >::vector | ( | unit_vector< NumericT > const & | v | ) |
| inline

Creates the vector from the supplied unit vector.

Definition at line 1009 of file vector.hpp.

template<class SCALARTYPE, unsigned int ALIGNMENT = 1>

viennacl::vector< SCALARTYPE, ALIGNMENT >::vector | ( | zero_vector< NumericT > const & | v | ) |
| inline

Creates the vector from the supplied zero vector.

Definition at line 1016 of file vector.hpp.

template<class SCALARTYPE, unsigned int ALIGNMENT = 1>

viennacl::vector< SCALARTYPE, ALIGNMENT >::vector | ( | scalar_vector< NumericT > const & | v | ) |
| inline

Creates the vector from the supplied scalar vector.

Definition at line 1023 of file vector.hpp.

## Member Function Documentation

template<class SCALARTYPE, unsigned int ALIGNMENT = 1>

self_type& viennacl::vector< SCALARTYPE, ALIGNMENT >::fast_swap | ( | self_type & | other | ) |
| inline

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

Definition at line 1058 of file vector.hpp.

template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
template<typename T >

self_type& viennacl::vector< SCALARTYPE, ALIGNMENT >::operator= | ( | T const & | other | ) |
| inline

Definition at line 1031 of file vector.hpp.

template<class SCALARTYPE, unsigned int ALIGNMENT = 1>

void viennacl::vector< SCALARTYPE, ALIGNMENT >::resize | ( | size_type | new_size,
|  | bool | preserve = `true`
| ) |  |
| inline

Resizes the allocated memory for the vector. Pads the memory to be a multiple of 'AlignmentV'.

Parameters

  new_size | The new size of the vector
  preserve | If true, old entries of the vector are preserved, otherwise eventually discarded.

Definition at line 1046 of file vector.hpp.

template<class SCALARTYPE, unsigned int ALIGNMENT = 1>

void viennacl::vector< SCALARTYPE, ALIGNMENT >::resize | ( | size_type | new_size,
|  | viennacl::context | ctx,
|  | bool | preserve = `true`
| ) |  |
| inline

Definition at line 1051 of file vector.hpp.

template<class SCALARTYPE, unsigned int ALIGNMENT = 1>

void viennacl::vector< SCALARTYPE, ALIGNMENT >::switch_memory_context | ( | viennacl::context | new_ctx | ) |
| inline

Definition at line 1064 of file vector.hpp.

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

- viennacl/forwards.h
- viennacl/vector.hpp