All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
viennacl::vector_base< NumericT, SizeT, DistanceT > Class Template Reference

Common base class for dense vectors, vector ranges, and vector slices. More...

`#include <vector_def.hpp>`

## Public Types

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

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)
template<typename LHS , typename RHS , typename OP >
| vector_base (vector_expression< const LHS, const RHS, OP > const &proxy)
| vector_base (const self_type &other)
template<typename OtherNumericT >
| 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...
template<typename LHS , typename RHS , typename OP >
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...
template<typename OtherNumericT >
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...
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...
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...
iterator | end ()
| Returns an iterator pointing to the end of the vector (STL like) More...
const_iterator | begin () const
| Returns a const-iterator pointing to the beginning 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...
template<class NumericT, typename SizeT , typename DistanceT >
| vector_base (const vector_base< NumericT, SizeT, DistanceT > &other)
template<typename LHS , typename RHS , typename OP >
vector_base< NumericT, SizeT, DistanceT > & | 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...
template<typename OtherNumericT >
vector_base< NumericT, SizeT, DistanceT > & | operator= (const vector_base< OtherNumericT > &v1)

## Protected Member Functions

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 NumericT, typename SizeT, typename DistanceT>
class viennacl::vector_base< NumericT, SizeT, DistanceT >

Common base class for dense vectors, vector ranges, and vector slices.

Template Parameters

  NumericT | The floating point type, either 'float' or 'double'

Definition at line 104 of file vector_def.hpp.

## Member Typedef Documentation

template<class NumericT, typename SizeT, typename DistanceT>

typedef const_vector_iterator<NumericT, 1> viennacl::vector_base< NumericT, SizeT, DistanceT >::const_iterator

Definition at line 114 of file vector_def.hpp.

template<class NumericT, typename SizeT, typename DistanceT>

typedef NumericT viennacl::vector_base< NumericT, SizeT, DistanceT >::cpu_value_type

Definition at line 110 of file vector_def.hpp.

template<class NumericT, typename SizeT, typename DistanceT>

typedef DistanceT viennacl::vector_base< NumericT, SizeT, DistanceT >::difference_type

Definition at line 113 of file vector_def.hpp.

template<class NumericT, typename SizeT, typename DistanceT>

typedef viennacl::backend::mem_handle viennacl::vector_base< NumericT, SizeT, DistanceT >::handle_type

Definition at line 111 of file vector_def.hpp.

template<class NumericT, typename SizeT, typename DistanceT>

typedef vector_iterator<NumericT, 1> viennacl::vector_base< NumericT, SizeT, DistanceT >::iterator

Definition at line 115 of file vector_def.hpp.

template<class NumericT, typename SizeT, typename DistanceT>

typedef SizeT viennacl::vector_base< NumericT, SizeT, DistanceT >::size_type

Definition at line 112 of file vector_def.hpp.

template<class NumericT, typename SizeT, typename DistanceT>

typedef scalar<NumericT> viennacl::vector_base< NumericT, SizeT, DistanceT >::value_type

Definition at line 109 of file vector_def.hpp.

## Constructor & Destructor Documentation

template<class NumericT , typename SizeT , typename DistanceT >

viennacl::vector_base< NumericT, SizeT, DistanceT >::vector_base | ( |  | ) |

explicit

Default constructor in order to be compatible with various containers.

Definition at line 251 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

viennacl::vector_base< NumericT, SizeT, DistanceT >::vector_base | ( | viennacl::backend::mem_handle & | h,
|  | size_type | vec_size,
|  | size_type | vec_start,
|  | size_type | vec_stride
| ) |  |

explicit

An explicit constructor for wrapping an existing vector into a vector_range or vector_slice.

Parameters

  h | The existing memory handle from a vector/vector_range/vector_slice
  vec_size | The length (i.e. size) of the buffer
  vec_start | The offset from the beginning of the buffer identified by 'h'
  vec_stride | Increment between two elements in the original buffer (in multiples of NumericT)

Definition at line 254 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

viennacl::vector_base< NumericT, SizeT, DistanceT >::vector_base | ( | size_type | vec_size,
|  | viennacl::context | ctx = `viennacl::context()`
| ) |  |

explicit

Creates a vector and allocates the necessary memory.

Definition at line 259 of file vector.hpp.

template<class NumericT, typename SizeT , typename DistanceT >

viennacl::vector_base< NumericT, SizeT, DistanceT >::vector_base | ( | NumericT * | ptr_to_mem,
|  | viennacl::memory_types | mem_type,
|  | size_type | vec_size,
|  | vcl_size_t | start = `0`,
|  | size_type | stride = `1`
| ) |  |

explicit

Definition at line 271 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >
template<typename LHS , typename RHS , typename OP >

viennacl::vector_base< NumericT, SizeT, DistanceT >::vector_base | ( | vector_expression< const LHS, const RHS, OP > const & | proxy | ) |

explicit

Definition at line 311 of file vector.hpp.

template<class NumericT, typename SizeT, typename DistanceT>

viennacl::vector_base< NumericT, SizeT, DistanceT >::vector_base | ( | const self_type & | other | ) |

template<typename NumericT , typename SizeT , typename DistanceT >
template<typename OtherNumericT >

viennacl::vector_base< NumericT, SizeT, DistanceT >::vector_base | ( | const vector_base< OtherNumericT > & | v1 | ) |

Definition at line 340 of file vector.hpp.

template<class NumericT, typename SizeT, typename DistanceT>
template<class NumericT, typename SizeT , typename DistanceT >

viennacl::vector_base< NumericT, SizeT, DistanceT >::vector_base | ( | const vector_base< NumericT, SizeT, DistanceT > & | other | ) |

Definition at line 324 of file vector.hpp.

## Member Function Documentation

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT >::iterator viennacl::vector_base< NumericT, SizeT, DistanceT >::begin | ( |  | ) |

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

Definition at line 841 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT >::const_iterator viennacl::vector_base< NumericT, SizeT, DistanceT >::begin | ( |  | ) | const

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

Definition at line 855 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

void viennacl::vector_base< NumericT, SizeT, DistanceT >::clear | ( |  | ) |

Resets all entries to zero. Does not change the size of the vector.

Definition at line 875 of file vector.hpp.

template<class NumericT, typename SizeT, typename DistanceT>

bool viennacl::vector_base< NumericT, SizeT, DistanceT >::empty | ( |  | ) | const

inline

Returns true is the size is zero.

Definition at line 126 of file vector_def.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT >::iterator viennacl::vector_base< NumericT, SizeT, DistanceT >::end | ( |  | ) |

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

Definition at line 848 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT >::const_iterator viennacl::vector_base< NumericT, SizeT, DistanceT >::end | ( |  | ) | const

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

Definition at line 861 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::fast_swap | ( | self_type & | other | ) |

protected

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

Definition at line 881 of file vector.hpp.

template<class NumericT, typename SizeT, typename DistanceT>

const handle_type& viennacl::vector_base< NumericT, SizeT, DistanceT >::handle | ( |  | ) | const

inline

Returns the memory handle.

Definition at line 128 of file vector_def.hpp.

template<class NumericT, typename SizeT, typename DistanceT>

handle_type& viennacl::vector_base< NumericT, SizeT, DistanceT >::handle | ( |  | ) |

inline

Returns the memory handle.

Definition at line 130 of file vector_def.hpp.

template<class NumericT, typename SizeT, typename DistanceT>

size_type viennacl::vector_base< NumericT, SizeT, DistanceT >::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 'AlignmentV'.

Definition at line 120 of file vector_def.hpp.

template<class NumericT, typename SizeT, typename DistanceT>

viennacl::memory_types viennacl::vector_base< NumericT, SizeT, DistanceT >::memory_domain | ( |  | ) | const

inline

Definition at line 131 of file vector_def.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

entry_proxy< NumericT > viennacl::vector_base< NumericT, SizeT, DistanceT >::operator() | ( | size_type | index | ) |

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

Definition at line 562 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

const_entry_proxy< NumericT > viennacl::vector_base< NumericT, SizeT, DistanceT >::operator() | ( | size_type | index | ) | const

Read access to a single element of the vector.

Definition at line 580 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_expression< const vector_base< NumericT, SizeT, DistanceT >, const NumericT, op_mult > viennacl::vector_base< NumericT, SizeT, DistanceT >::operator* | ( | char | value | ) | const

Scales the vector by a char (8-bit integer) 'alpha' and returns an expression template.

Scales the vector by a char (8-bit value) 'alpha' and returns an expression template.

Definition at line 742 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_expression< const vector_base< NumericT, SizeT, DistanceT >, const NumericT, op_mult > viennacl::vector_base< NumericT, SizeT, DistanceT >::operator* | ( | short | value | ) | const

Scales the vector by a short integer 'alpha' and returns an expression template.

Definition at line 749 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_expression< const vector_base< NumericT, SizeT, DistanceT >, const NumericT, op_mult > viennacl::vector_base< NumericT, SizeT, DistanceT >::operator* | ( | int | value | ) | const

Scales the vector by an integer 'alpha' and returns an expression template.

Definition at line 756 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_expression< const vector_base< NumericT, SizeT, DistanceT >, const NumericT, op_mult > viennacl::vector_base< NumericT, SizeT, DistanceT >::operator* | ( | long | value | ) | const

Scales the vector by a long integer 'alpha' and returns an expression template.

Definition at line 763 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_expression< const vector_base< NumericT, SizeT, DistanceT >, const NumericT, op_mult > viennacl::vector_base< NumericT, SizeT, DistanceT >::operator* | ( | float | value | ) | const

Scales the vector by a single precision floating point value 'alpha' and returns an expression template.

Scales the vector by a single precision floating point number 'alpha' and returns an expression template.

Definition at line 770 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_expression< const vector_base< NumericT, SizeT, DistanceT >, const NumericT, op_mult > viennacl::vector_base< NumericT, SizeT, DistanceT >::operator* | ( | double | value | ) | const

Scales the vector by a double precision floating point value 'alpha' and returns an expression template.

Scales the vector by a single precision floating point number 'alpha' and returns an expression template.

Definition at line 777 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator*= | ( | char | val | ) |

Scales a vector (or proxy) by a char (8-bit integer)

Scales a vector (or proxy) by a char (8-bit integer) value.

Definition at line 629 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator*= | ( | short | val | ) |

Scales a vector (or proxy) by a short integer.

Scales a vector (or proxy) by a short integer value.

Definition at line 638 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator*= | ( | int | val | ) |

Scales a vector (or proxy) by an integer.

Scales a vector (or proxy) by an integer value.

Definition at line 647 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator*= | ( | long | val | ) |

Scales a vector (or proxy) by a long integer.

Scales a vector (or proxy) by a long integer value.

Definition at line 656 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator*= | ( | float | val | ) |

Scales a vector (or proxy) by a single precision floating point value.

Definition at line 665 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator*= | ( | double | val | ) |

Scales a vector (or proxy) by a double precision floating point value.

Definition at line 674 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator+= | ( | const self_type & | vec | ) |

Definition at line 604 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_expression< const vector_base< NumericT, SizeT, DistanceT >, const NumericT, op_mult > viennacl::vector_base< NumericT, SizeT, DistanceT >::operator- | ( |  | ) | const

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

Definition at line 830 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator-= | ( | const self_type & | vec | ) |

Definition at line 616 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_expression< const vector_base< NumericT, SizeT, DistanceT >, const NumericT, op_div > viennacl::vector_base< NumericT, SizeT, DistanceT >::operator/ | ( | char | value | ) | const

Scales the vector by a char (8-bit integer) 'alpha' and returns an expression template.

Scales the vector by a char (8-bit value) 'alpha' and returns an expression template.

Definition at line 786 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_expression< const vector_base< NumericT, SizeT, DistanceT >, const NumericT, op_div > viennacl::vector_base< NumericT, SizeT, DistanceT >::operator/ | ( | short | value | ) | const

Scales the vector by a short integer 'alpha' and returns an expression template.

Definition at line 793 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_expression< const vector_base< NumericT, SizeT, DistanceT >, const NumericT, op_div > viennacl::vector_base< NumericT, SizeT, DistanceT >::operator/ | ( | int | value | ) | const

Scales the vector by an integer 'alpha' and returns an expression template.

Definition at line 800 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_expression< const vector_base< NumericT, SizeT, DistanceT >, const NumericT, op_div > viennacl::vector_base< NumericT, SizeT, DistanceT >::operator/ | ( | long | value | ) | const

Scales the vector by a long integer 'alpha' and returns an expression template.

Definition at line 807 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_expression< const vector_base< NumericT, SizeT, DistanceT >, const NumericT, op_div > viennacl::vector_base< NumericT, SizeT, DistanceT >::operator/ | ( | float | value | ) | const

Scales the vector by a single precision floating point value 'alpha' and returns an expression template.

Scales the vector by a single precision floating point number 'alpha' and returns an expression template.

Definition at line 814 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_expression< const vector_base< NumericT, SizeT, DistanceT >, const NumericT, op_div > viennacl::vector_base< NumericT, SizeT, DistanceT >::operator/ | ( | double | value | ) | const

Scales the vector by a double precision floating point value 'alpha' and returns an expression template.

Scales the vector by a double precision floating point number 'alpha' and returns an expression template.

Definition at line 821 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator/= | ( | char | val | ) |

Scales a vector (or proxy) by a char (8-bit integer)

Scales this vector by a char (8-bit) value.

Definition at line 685 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator/= | ( | short | val | ) |

Scales a vector (or proxy) by a short integer.

Scales this vector by a short integer value.

Definition at line 694 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator/= | ( | int | val | ) |

Scales a vector (or proxy) by an integer.

Scales this vector by an integer value.

Definition at line 703 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator/= | ( | long | val | ) |

Scales a vector (or proxy) by a long integer.

Scales this vector by a long integer value.

Definition at line 712 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator/= | ( | float | val | ) |

Scales a vector (or proxy) by a single precision floating point value.

Scales this vector by a single precision floating point value.

Definition at line 721 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator/= | ( | double | val | ) |

Scales a vector (or proxy) by a double precision floating point value.

Scales this vector by a double precision floating point value.

Definition at line 730 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator= | ( | const self_type & | vec | ) |

Assignment operator. Other vector needs to be of the same size, or this vector is not yet initialized.

Definition at line 356 of file vector.hpp.

template<class NumericT, typename SizeT, typename DistanceT>
template<typename LHS , typename RHS , typename OP >

self_type& viennacl::vector_base< NumericT, SizeT, DistanceT >::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.

Parameters

  proxy | An expression template proxy class.

template<class NumericT, typename SizeT, typename DistanceT>
template<typename OtherNumericT >

self_type& viennacl::vector_base< NumericT, SizeT, DistanceT >::operator= | ( | const vector_base< OtherNumericT > & | v1 | ) |

Converts a vector of a different numeric type to the current numeric type.

template<class NumericT, typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator= | ( | unit_vector< NumericT > const & | v | ) |

Creates the vector from the supplied unit vector.

Definition at line 434 of file vector.hpp.

template<class NumericT, typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator= | ( | zero_vector< NumericT > const & | v | ) |

Creates the vector from the supplied zero vector.

Definition at line 460 of file vector.hpp.

template<class NumericT, typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::operator= | ( | scalar_vector< NumericT > const & | v | ) |

Creates the vector from the supplied scalar vector.

Definition at line 483 of file vector.hpp.

template<class NumericT, typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::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.

Parameters

  proxy | An expression template proxy class

Definition at line 514 of file vector.hpp.

template<class NumericT, typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::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.

Parameters

  proxy | An expression template proxy class

Definition at line 535 of file vector.hpp.

template<class NumericT, typename SizeT, typename DistanceT>
template<typename LHS , typename RHS , typename OP >

vector_base<NumericT, SizeT, DistanceT>& viennacl::vector_base< NumericT, SizeT, DistanceT >::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.

Parameters

  proxy | An expression template proxy class.

Definition at line 389 of file vector.hpp.

template<class NumericT, typename SizeT, typename DistanceT>
template<typename OtherNumericT >

vector_base<NumericT, SizeT, DistanceT>& viennacl::vector_base< NumericT, SizeT, DistanceT >::operator= | ( | const vector_base< OtherNumericT > & | v1 | ) |

Definition at line 411 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

entry_proxy< NumericT > viennacl::vector_base< NumericT, SizeT, DistanceT >::operator[] | ( | size_type | index | ) |

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

Definition at line 571 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

const_entry_proxy< NumericT > viennacl::vector_base< NumericT, SizeT, DistanceT >::operator[] | ( | size_type | index | ) | const

Read access to a single element of the vector.

Definition at line 589 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

void viennacl::vector_base< NumericT, SizeT, DistanceT >::pad | ( |  | ) |

protected

Pads vectors with alignment > 1 with trailing zeros if the internal size is larger than the visible size.

Definition at line 889 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

void viennacl::vector_base< NumericT, SizeT, DistanceT >::resize | ( | size_type | new_size,
|  | bool | preserve = `true`
| ) |  |

protected

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 909 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

void viennacl::vector_base< NumericT, SizeT, DistanceT >::resize | ( | size_type | new_size,
|  | viennacl::context | ctx,
|  | bool | preserve = `true`
| ) |  |

protected

Resizes the allocated memory for the vector. Convenience function for setting an OpenCL context in case reallocation is needed.

Parameters

  new_size | The new size of the vector
  ctx | The context within which the new memory should be allocated
  preserve | If true, old entries of the vector are preserved, otherwise eventually discarded.

Definition at line 915 of file vector.hpp.

template<class NumericT, typename SizeT, typename DistanceT>

void viennacl::vector_base< NumericT, SizeT, DistanceT >::set_handle | ( | viennacl::backend::mem_handle const & | h | ) |

inline protected

Definition at line 305 of file vector_def.hpp.

template<class NumericT, typename SizeT, typename DistanceT>

size_type viennacl::vector_base< NumericT, SizeT, DistanceT >::size | ( |  | ) | const

inline

Returns the length of the vector (cf. std::vector)

Definition at line 118 of file vector_def.hpp.

template<class NumericT, typename SizeT, typename DistanceT>

size_type viennacl::vector_base< NumericT, SizeT, DistanceT >::start | ( |  | ) | const

inline

Returns the offset within the buffer.

Definition at line 122 of file vector_def.hpp.

template<class NumericT, typename SizeT, typename DistanceT>

size_type viennacl::vector_base< NumericT, SizeT, DistanceT >::stride | ( |  | ) | const

inline

Returns the stride within the buffer (in multiples of sizeof(NumericT))

Definition at line 124 of file vector_def.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

vector_base< NumericT, SizeT, DistanceT > & viennacl::vector_base< NumericT, SizeT, DistanceT >::swap | ( | self_type & | other | ) |

Swaps the entries of the two vectors.

Definition at line 867 of file vector.hpp.

template<class NumericT , typename SizeT , typename DistanceT >

void viennacl::vector_base< NumericT, SizeT, DistanceT >::switch_memory_context | ( | viennacl::context | new_ctx | ) |

protected

Definition at line 899 of file vector.hpp.

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

- viennacl/detail/vector_def.hpp
- viennacl/vector.hpp