remora::vector< T, cpu_tag > Class Template Reference

#include <shark/LinAlg/BLAS/cpu/vector.hpp>

+ Inheritance diagram for remora::vector< T, cpu_tag >:

Public Types

typedef array_type::const_reference const_reference
 
typedef array_type::reference reference
 
typedef elementwise< dense_tag > evaluation_category
 
typedef iterators::dense_storage_iterator< value_type > iterator
 
typedef iterators::dense_storage_iterator< value_type const > const_iterator
 

Public Member Functions

 vector ()=default
 Constructor of a vector By default it is empty, i.e. size()==0. More...
 
 vector (size_type size)
 Constructor of a vector with a predefined size By default, its elements are initialized to 0. More...
 
 vector (size_type size, const value_type &init)
 Constructor of a vector with a predefined size and a unique initial value. More...
 
 vector (vector const &v)=default
 Copy-constructor of a vector. More...
 
 vector (vector &&v)
 Move-constructor of a vector. More...
 
 vector (std::initializer_list< T > list)
 
template<class Iter >
 vector (Iter begin, Iter end)
 Constructs the vector from a predefined range. More...
 
template<class E >
 vector (vector_expression< E, cpu_tag > const &e)
 Copy-constructor of a vector from a vector_expression. More...
 
vectoroperator= (vector const &v)=default
 Assign a full vector (RHS-vector) to the current vector (LHS-vector) Assign a full vector (RHS-vector) to the current vector (LHS-vector). This method does not create any temporary. More...
 
vectoroperator= (vector &&v)
 Move-Assign a full vector (RHS-vector) to the current vector (LHS-vector) More...
 
template<class C >
vectoroperator= (vector_container< C, cpu_tag > const &v)
 Assign a full vector (RHS-vector) to the current vector (LHS-vector) Assign a full vector (RHS-vector) to the current vector (LHS-vector). This method does not create any temporary. More...
 
template<class E >
vectoroperator= (vector_expression< E, cpu_tag > const &e)
 Assign the result of a vector_expression to the vector Assign the result of a vector_expression to the vector. More...
 
size_type size () const
 Return the size of the vector. More...
 
storage_type raw_storage ()
 Returns the underlying storage structure for low level access. More...
 
const_storage_type raw_storage () const
 Returns the underlying storage structure for low level access. More...
 
device_traits< cpu_tag >::queue_type & queue ()
 
size_type max_size () const
 Return the maximum size of the data container. Return the upper bound (maximum size) on the data container. Depending on the container, it can be bigger than the current size of the vector. More...
 
bool empty () const
 Return true if the vector is empty (size==0) More...
 
void resize (size_type size)
 Resize the vector. More...
 
const_reference operator() (size_type i) const
 Return a const reference to the element \(i\) Return a const reference to the element \(i\). With some compilers, this notation will be faster than operator[]. More...
 
reference operator() (size_type i)
 Return a reference to the element \(i\) Return a reference to the element \(i\). With some compilers, this notation will be faster than operator[]. More...
 
const_reference operator[] (size_type i) const
 Return a const reference to the element \(i\). More...
 
reference operator[] (size_type i)
 Return a reference to the element \(i\). More...
 
reference front ()
 Returns the first element of the vector. More...
 
const_reference front () const
 Returns the first element of the vector. More...
 
reference back ()
 Returns the last element of the vector. More...
 
const_reference back () const
 Returns the last element of the vector. More...
 
void push_back (value_type const &element)
 resizes the vector by appending a new element to the end. this invalidates storage More...
 
void clear ()
 Clear the vector, i.e. set all values to the zero value. More...
 
const_iterator cbegin () const
 return an iterator on the first element of the vector More...
 
const_iterator cend () const
 return an iterator after the last element of the vector More...
 
const_iterator begin () const
 return an iterator on the first element of the vector More...
 
const_iterator end () const
 return an iterator after the last element of the vector More...
 
iterator begin ()
 Return an iterator on the first element of the vector. More...
 
iterator end ()
 Return an iterator at the end of the vector. More...
 
iterator set_element (iterator pos, size_type index, value_type value)
 
iterator clear_element (iterator pos)
 
iterator clear_range (iterator start, iterator end)
 
void reserve (size_type)
 
template<class Archive >
void serialize (Archive &ar, const unsigned int file_version)
 
- Public Member Functions inherited from remora::vector_container< vector< T, cpu_tag >, cpu_tag >
const container_type & operator() () const
 
container_type & operator() ()
 
- Public Member Functions inherited from remora::vector_expression< vector< T, cpu_tag >, cpu_tag >
const expression_type & operator() () const
 
expression_type & operator() ()
 

Friends

void swap (vector &v1, vector &v2)
 Swap the content of two vectors. More...
 

Detailed Description

template<class T>
class remora::vector< T, cpu_tag >

Definition at line 43 of file vector.hpp.

Member Typedef Documentation

◆ const_iterator

template<class T >
typedef iterators::dense_storage_iterator<value_type const> remora::vector< T, cpu_tag >::const_iterator

Definition at line 244 of file vector.hpp.

◆ const_reference

template<class T >
typedef array_type::const_reference remora::vector< T, cpu_tag >::const_reference

Definition at line 49 of file vector.hpp.

◆ evaluation_category

template<class T >
typedef elementwise<dense_tag> remora::vector< T, cpu_tag >::evaluation_category

Definition at line 57 of file vector.hpp.

◆ iterator

template<class T >
typedef iterators::dense_storage_iterator<value_type> remora::vector< T, cpu_tag >::iterator

Definition at line 243 of file vector.hpp.

◆ reference

template<class T >
typedef array_type::reference remora::vector< T, cpu_tag >::reference

Definition at line 50 of file vector.hpp.

Constructor & Destructor Documentation

◆ vector() [1/8]

template<class T >
remora::vector< T, cpu_tag >::vector ( )
default

Constructor of a vector By default it is empty, i.e. size()==0.

◆ vector() [2/8]

template<class T >
remora::vector< T, cpu_tag >::vector ( size_type  size)
inlineexplicit

Constructor of a vector with a predefined size By default, its elements are initialized to 0.

Parameters
sizeinitial size of the vector

Definition at line 68 of file vector.hpp.

◆ vector() [3/8]

template<class T >
remora::vector< T, cpu_tag >::vector ( size_type  size,
const value_type &  init 
)
inline

Constructor of a vector with a predefined size and a unique initial value.

Parameters
sizeof the vector
initvalue to assign to each element of the vector

Definition at line 73 of file vector.hpp.

◆ vector() [4/8]

template<class T >
remora::vector< T, cpu_tag >::vector ( vector< T, cpu_tag > const &  v)
default

Copy-constructor of a vector.

Parameters
vis the vector to be duplicated

◆ vector() [5/8]

template<class T >
remora::vector< T, cpu_tag >::vector ( vector< T, cpu_tag > &&  v)
inline

Move-constructor of a vector.

Parameters
vis the vector to be moved

Definition at line 82 of file vector.hpp.

◆ vector() [6/8]

template<class T >
remora::vector< T, cpu_tag >::vector ( std::initializer_list< T >  list)
inline

Definition at line 84 of file vector.hpp.

◆ vector() [7/8]

template<class T >
template<class Iter >
remora::vector< T, cpu_tag >::vector ( Iter  begin,
Iter  end 
)
inline

Constructs the vector from a predefined range.

Definition at line 88 of file vector.hpp.

◆ vector() [8/8]

template<class T >
template<class E >
remora::vector< T, cpu_tag >::vector ( vector_expression< E, cpu_tag > const &  e)
inline

Copy-constructor of a vector from a vector_expression.

Parameters
ethe vector_expression whose values will be duplicated into the vector

Definition at line 93 of file vector.hpp.

References remora::assign().

Member Function Documentation

◆ back() [1/2]

template<class T >
reference remora::vector< T, cpu_tag >::back ( )
inline

Returns the last element of the vector.

Definition at line 224 of file vector.hpp.

◆ back() [2/2]

template<class T >
const_reference remora::vector< T, cpu_tag >::back ( ) const
inline

Returns the last element of the vector.

Definition at line 228 of file vector.hpp.

◆ begin() [1/2]

template<class T >
const_iterator remora::vector< T, cpu_tag >::begin ( ) const
inline

return an iterator on the first element of the vector

Definition at line 257 of file vector.hpp.

◆ begin() [2/2]

template<class T >
iterator remora::vector< T, cpu_tag >::begin ( )
inline

Return an iterator on the first element of the vector.

Definition at line 267 of file vector.hpp.

◆ cbegin()

template<class T >
const_iterator remora::vector< T, cpu_tag >::cbegin ( ) const
inline

return an iterator on the first element of the vector

Definition at line 247 of file vector.hpp.

◆ cend()

template<class T >
const_iterator remora::vector< T, cpu_tag >::cend ( ) const
inline

return an iterator after the last element of the vector

Definition at line 252 of file vector.hpp.

◆ clear()

template<class T >
void remora::vector< T, cpu_tag >::clear ( )
inline

Clear the vector, i.e. set all values to the zero value.

Definition at line 238 of file vector.hpp.

◆ clear_element()

template<class T >
iterator remora::vector< T, cpu_tag >::clear_element ( iterator  pos)
inline

◆ clear_range()

template<class T >
iterator remora::vector< T, cpu_tag >::clear_range ( iterator  start,
iterator  end 
)
inline

Definition at line 292 of file vector.hpp.

◆ empty()

template<class T >
bool remora::vector< T, cpu_tag >::empty ( ) const
inline

Return true if the vector is empty (size==0)

Returns
true if empty, false otherwise

Definition at line 171 of file vector.hpp.

◆ end() [1/2]

template<class T >
const_iterator remora::vector< T, cpu_tag >::end ( ) const
inline

return an iterator after the last element of the vector

Definition at line 262 of file vector.hpp.

◆ end() [2/2]

template<class T >
iterator remora::vector< T, cpu_tag >::end ( )
inline

Return an iterator at the end of the vector.

Definition at line 272 of file vector.hpp.

◆ front() [1/2]

template<class T >
reference remora::vector< T, cpu_tag >::front ( )
inline

Returns the first element of the vector.

Definition at line 216 of file vector.hpp.

◆ front() [2/2]

template<class T >
const_reference remora::vector< T, cpu_tag >::front ( ) const
inline

Returns the first element of the vector.

Definition at line 220 of file vector.hpp.

◆ max_size()

template<class T >
size_type remora::vector< T, cpu_tag >::max_size ( ) const
inline

Return the maximum size of the data container. Return the upper bound (maximum size) on the data container. Depending on the container, it can be bigger than the current size of the vector.

Definition at line 165 of file vector.hpp.

◆ operator()() [1/2]

template<class T >
const_reference remora::vector< T, cpu_tag >::operator() ( size_type  i) const
inline

Return a const reference to the element \(i\) Return a const reference to the element \(i\). With some compilers, this notation will be faster than operator[].

Parameters
iindex of the element

Definition at line 188 of file vector.hpp.

◆ operator()() [2/2]

template<class T >
reference remora::vector< T, cpu_tag >::operator() ( size_type  i)
inline

Return a reference to the element \(i\) Return a reference to the element \(i\). With some compilers, this notation will be faster than operator[].

Parameters
iindex of the element

Definition at line 196 of file vector.hpp.

◆ operator=() [1/4]

template<class T >
vector& remora::vector< T, cpu_tag >::operator= ( vector< T, cpu_tag > const &  v)
default

Assign a full vector (RHS-vector) to the current vector (LHS-vector) Assign a full vector (RHS-vector) to the current vector (LHS-vector). This method does not create any temporary.

Parameters
vis the source vector container
Returns
a reference to a vector (i.e. the destination vector)

◆ operator=() [2/4]

template<class T >
vector& remora::vector< T, cpu_tag >::operator= ( vector< T, cpu_tag > &&  v)
inline

Move-Assign a full vector (RHS-vector) to the current vector (LHS-vector)

Parameters
vis the source vector container
Returns
a reference to a vector (i.e. the destination vector)

Definition at line 111 of file vector.hpp.

◆ operator=() [3/4]

template<class T >
template<class C >
vector& remora::vector< T, cpu_tag >::operator= ( vector_container< C, cpu_tag > const &  v)
inline

Assign a full vector (RHS-vector) to the current vector (LHS-vector) Assign a full vector (RHS-vector) to the current vector (LHS-vector). This method does not create any temporary.

Parameters
vis the source vector container
Returns
a reference to a vector (i.e. the destination vector)

Definition at line 121 of file vector.hpp.

References remora::assign().

◆ operator=() [4/4]

template<class T >
template<class E >
vector& remora::vector< T, cpu_tag >::operator= ( vector_expression< E, cpu_tag > const &  e)
inline

Assign the result of a vector_expression to the vector Assign the result of a vector_expression to the vector.

Parameters
eis a const reference to the vector_expression
Returns
a reference to the resulting vector

Definition at line 131 of file vector.hpp.

References shark::swap().

◆ operator[]() [1/2]

template<class T >
const_reference remora::vector< T, cpu_tag >::operator[] ( size_type  i) const
inline

Return a const reference to the element \(i\).

Parameters
iindex of the element

Definition at line 203 of file vector.hpp.

◆ operator[]() [2/2]

template<class T >
reference remora::vector< T, cpu_tag >::operator[] ( size_type  i)
inline

Return a reference to the element \(i\).

Parameters
iindex of the element

Definition at line 210 of file vector.hpp.

◆ push_back()

template<class T >
void remora::vector< T, cpu_tag >::push_back ( value_type const &  element)
inline

resizes the vector by appending a new element to the end. this invalidates storage

Definition at line 233 of file vector.hpp.

◆ queue()

template<class T >
device_traits<cpu_tag>::queue_type& remora::vector< T, cpu_tag >::queue ( )
inline

Definition at line 155 of file vector.hpp.

◆ raw_storage() [1/2]

template<class T >
storage_type remora::vector< T, cpu_tag >::raw_storage ( )
inline

Returns the underlying storage structure for low level access.

Definition at line 147 of file vector.hpp.

◆ raw_storage() [2/2]

template<class T >
const_storage_type remora::vector< T, cpu_tag >::raw_storage ( ) const
inline

Returns the underlying storage structure for low level access.

Definition at line 152 of file vector.hpp.

◆ reserve()

template<class T >
void remora::vector< T, cpu_tag >::reserve ( size_type  )
inline

Definition at line 298 of file vector.hpp.

◆ resize()

template<class T >
void remora::vector< T, cpu_tag >::resize ( size_type  size)
inline

Resize the vector.

Parameters
sizenew size of the vector

Definition at line 177 of file vector.hpp.

◆ serialize()

template<class T >
template<class Archive >
void remora::vector< T, cpu_tag >::serialize ( Archive &  ar,
const unsigned int  file_version 
)
inline

Serialize a vector into and archive as defined in Boost

Parameters
arArchive object. Can be a flat file, an XML file or any other stream
file_versionOptional file version (not yet used)

Definition at line 314 of file vector.hpp.

◆ set_element()

template<class T >
iterator remora::vector< T, cpu_tag >::set_element ( iterator  pos,
size_type  index,
value_type  value 
)
inline

◆ size()

template<class T >
size_type remora::vector< T, cpu_tag >::size ( ) const
inline

Return the size of the vector.

Definition at line 142 of file vector.hpp.

Friends And Related Function Documentation

◆ swap

template<class T >
void swap ( vector< T, cpu_tag > &  v1,
vector< T, cpu_tag > &  v2 
)
friend

Swap the content of two vectors.

Parameters
v1is the first vector. It takes values from v2
v2is the second vector It takes values from v1

Definition at line 303 of file vector.hpp.


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