PLaSK library
Loading...
Searching...
No Matches
plask::DataVector< T > Struct Template Reference

Store pointer and size. More...

#include <plask/data.hpp>

Public Types

typedef std::remove_const< T >::type VT
 
typedef constCT
 
typedef detail::DataVectorGC Gc
 
typedefvalue_type
 type of the stored data
 
typedef T * iterator
 iterator type for the array
 
typedef const T * const_iterator
 constant iterator type for the array
 

Public Member Functions

 DataVector ()
 Create empty.
 
 DataVector (std::size_t size)
 Create vector of given size with uninitialized data values.
 
 DataVector (std::size_t size, const T &value)
 Create data vector with given size and fill all its' cells with given value.
 
 DataVector (const DataVector< CT > &src)
 Copy constructor.
 
 DataVector (const DataVector< VT > &src)
 Copy constructor.
 
template<typename TS >
 DataVector (const DataVector< TS > &src)
 Copy constructor.
 
DataVector< T > & operator= (const DataVector< CT > &M)
 Assign operator.
 
DataVector< T > & operator= (const DataVector< VT > &M)
 Assign operator.
 
 DataVector (DataVector< CT > &&src) noexcept
 Move constructor.
 
 DataVector (DataVector< VT > &&src) noexcept
 Move constructor.
 
DataVector< T > & operator= (DataVector< T > &&src) noexcept
 Move operator.
 
template<typename TS >
 DataVector (TS *existing_data, std::size_t size)
 Create vector out of existing data.
 
template<typename TS >
 DataVector (TS *existing_data, std::size_t size, const std::function< void(void *)> &deleter)
 Create vector out of existing data with guardian.
 
template<typename TS >
 DataVector (TS *existing_data, std::size_t size, std::function< void(void *)> &&deleter)
 Create vector out of existing data with guardian.
 
 DataVector (std::initializer_list< T > init)
 Create data vector and fill it with data from initializer list.
 
template<typename TS >
 DataVector (std::initializer_list< TS > init)
 Create data vector and fill it with data from initializer list.
 
 ~DataVector ()
 Delete data if this was last reference to it.
 
void reset ()
 Make this data vector points to nullptr data with 0-size.
 
template<typename TS >
void reset (TS *existing_data, std::size_t size)
 Change data of this data vector.
 
template<typename TS >
void reset (TS *existing_data, std::size_t size, const std::function< void(void *)> &deleter)
 Change data of this data vector.
 
template<typename TS >
void reset (TS *existing_data, std::size_t size, std::function< void(void *)> &&deleter)
 Change data of this data vector.
 
void reset (std::size_t size)
 Change data of this data vector to uninitialized data with given size.
 
void reset (std::size_t size, const T &value)
 Change data of this to array of given size and fill all its' cells with given value.
 
template<typename InIterT >
void reset (InIterT begin, InIterT end)
 Change data of this to copy of range [begin, end).
 
const_iterator begin () const
 Get iterator referring to the first object in data vector.
 
iterator begin ()
 Get iterator referring to the first object in data vector.
 
const_iterator end () const
 Get iterator referring to the past-the-end object in data vector.
 
iterator end ()
 Get iterator referring to the past-the-end object in data vector.
 
std::size_t size () const
 
const T * data () const
 
T * data ()
 
const T & operator[] (std::size_t n) const
 Return reference to the (constant) n-th object of the data.
 
T & operator[] (std::size_t n)
 Return reference to the n-th object of the data.
 
 operator bool () const
 
DataVector< VTcopy () const
 Make a deep copy of the data.
 
bool unique () const
 Check if this is the only one owner of data.
 
DataVector< VTremove_const () const
 Allow to remove const qualifier from data, must be.
 
DataVector< VTclaim () const
 Make copy of data only if this is not the only one owner of it.
 
void swap (DataVector< T > &other) noexcept
 Swap all internals of this and other.
 
template<typename O >
void fill (const O &value)
 Fill all data using given value.
 
DataVector< T > getSubarrayRef (std::size_t begin_index, std::size_t subarray_size)
 Get sub-array of this which refers to data of this.
 
DataVector< const T > getSubarrayRef (std::size_t begin_index, std::size_t subarray_size) const
 Get sub-array of this which refers to data of this.
 
DataVector< T > getSubarrayCopy (std::size_t begin_index, std::size_t subarray_size) const
 Get sub-array of this which copies the data (fragment) of this.
 
DataVector< T > getSubrangeRef (iterator begin, iterator end)
 Get sub-array of this which refers to data of this.
 
DataVector< const T > getSubrangeRef (const_iterator begin, const_iterator end) const
 Get sub-array of this which refers to data of this.
 
DataVector< T > getSubrangeCopy (const_iterator begin, const_iterator end)
 Get sub-array of this which copies the data (fragment) of this.
 

Friends

struct DataVector< VT >
 
struct DataVector< CT >
 

Related Symbols

(Note that these are not member symbols.)

template<class T1 , class T2 >
bool operator== (DataVector< T1 > const &a, DataVector< T2 > const &b)
 Check if two data vectors are equal.
 
template<class T1 , class T2 >
bool operator!= (DataVector< T1 > const &a, DataVector< T2 > const &b)
 Check if two data vectors are not equal.
 
template<class T1 , class T2 >
bool operator< (DataVector< T1 > const &a, DataVector< T2 > const &b)
 A lexical comparison of two data vectors.
 
template<class T1 , class T2 >
bool operator> (DataVector< T1 > const &a, DataVector< T2 > const &b)
 A lexical comparison of two data vectors.
 
template<class T1 , class T2 >
bool operator<= (DataVector< T1 > const &a, DataVector< T2 > const &b)
 A lexical comparison of two data vectors.
 
template<class T1 , class T2 >
bool operator>= (DataVector< T1 > const &a, DataVector< T2 > const &b)
 A lexical comparison of two data vectors.
 
template<class T >
std::ostream & operator<< (std::ostream &out, DataVector< T > const &to_print)
 Print data vector to stream.
 
template<class T , class S >
DataVector< T > & operator+= (DataVector< T > &to_inc, DataVector< S > const &inc_val)
 Calculate: to_inc[i] += inc_val[i] for all vector elements.
 
template<class T , class S >
DataVector< T > & operator-= (DataVector< T > &to_dec, DataVector< S > const &dec_val)
 Calculate: to_dec[i] -= dec_val[i] for all vector elements.
 
template<typename T , typename S >
DataVector< T > & operator*= (DataVector< T > &vec, S a)
 Multiply each element of vec by a.
 
template<typename T , typename S >
DataVector< T > & operator/= (DataVector< T > &vec, S a)
 Divide each element of vec by a.
 
template<typename T1 , typename T2 >
DataVector< typename std::remove_cv< decltype(T1()+T2())>::type > operator+ (DataVector< T1 > const &vec1, DataVector< T2 > const &vec2)
 Calculate sum of two data vectors.
 
template<typename T1 , typename T2 >
DataVector< typename std::remove_cv< decltype(T1() -T2())>::type > operator- (DataVector< T1 > const &vec1, DataVector< T2 > const &vec2)
 Calculate difference of two data vectors.
 
template<class T >
DataVector< typename std::remove_cv< T >::type > operator- (DataVector< T > const &vec)
 Negate the data vector.
 
template<typename T , typename S >
DataVector< typename std::remove_cv< decltype(T() *S())>::type > operator* (DataVector< T > const &vec, S a)
 Compute factor of vec and .
 
template<typename T , typename S >
DataVector< typename std::remove_cv< decltype(S() *T())>::type > operator* (S a, DataVector< T > const &vec)
 Compute factor of a and vec.
 
template<typename T , typename S >
DataVector< typename std::remove_cv< decltype(T() *(1./S()))>::type > operator/ (DataVector< T > const &vec, S a)
 Divide vec by a.
 
template<class T >
std::remove_cv< T >::type accumulate (const DataVector< T > &to_accum, typename std::remove_cv< T >::type initial=typename std::remove_cv< T >::type())
 Sum all elements in the vector.
 
template<typename RT , typename T >
DataVector< RTconst_data_cast (const DataVector< T > &src)
 Cast DataVector<const T> into DataVector<T>
 

Detailed Description

template<typename T>
struct plask::DataVector< T >

Store pointer and size.

Is like intelligent pointer for plain data arrays.

Can work in two modes:

  • managed — data will be deleted (by aligned_free) by destructor of last DataVector instance which referee to this data (reference counting is using);
  • non-managed — data will be not deleted by DataVector (so DataVector just refers to external data).

In both cases, assign operation and copy constructor of DataVector do not copy the data, but just create DataVectors which refers to the same data. So both these operations are very fast.

Definition at line 126 of file data.hpp.

Member Typedef Documentation

◆ const_iterator

template<typename T >
typedef const T* plask::DataVector< T >::const_iterator

constant iterator type for the array

Definition at line 161 of file data.hpp.

◆ CT

template<typename T >
typedef const T plask::DataVector< T >::CT

Definition at line 129 of file data.hpp.

◆ Gc

Definition at line 131 of file data.hpp.

◆ iterator

template<typename T >
typedef T* plask::DataVector< T >::iterator

iterator type for the array

Definition at line 160 of file data.hpp.

◆ value_type

template<typename T >
typedef T plask::DataVector< T >::value_type

type of the stored data

Definition at line 158 of file data.hpp.

◆ VT

template<typename T >
typedef std::remove_const<T>::type plask::DataVector< T >::VT

Definition at line 128 of file data.hpp.

Constructor & Destructor Documentation

◆ DataVector() [1/13]

template<typename T >
plask::DataVector< T >::DataVector ( )
inline

Create empty.

Definition at line 164 of file data.hpp.

◆ DataVector() [2/13]

template<typename T >
plask::DataVector< T >::DataVector ( std::size_t  size)
inlineexplicit

Create vector of given size with uninitialized data values.

Reserve memory using aligned_malloc<T>(size) call.

Parameters
sizetotal size of the data

Definition at line 172 of file data.hpp.

◆ DataVector() [3/13]

template<typename T >
plask::DataVector< T >::DataVector ( std::size_t  size,
const T &  value 
)
inline

Create data vector with given size and fill all its' cells with given value.

Parameters
sizesize of vector
valueinitial value for each cell

Definition at line 181 of file data.hpp.

◆ DataVector() [4/13]

template<typename T >
plask::DataVector< T >::DataVector ( const DataVector< CT > &  src)
inline

Copy constructor.

Only makes a shallow copy (doesn't copy data).

Parameters
srcdata source

Definition at line 193 of file data.hpp.

◆ DataVector() [5/13]

template<typename T >
plask::DataVector< T >::DataVector ( const DataVector< VT > &  src)
inline

Copy constructor.

Only makes a shallow copy (doesn't copy data).

Parameters
srcdata source

Definition at line 199 of file data.hpp.

◆ DataVector() [6/13]

template<typename T >
template<typename TS >
plask::DataVector< T >::DataVector ( const DataVector< TS > &  src)
inline

Copy constructor.

Due to the types incomatibilites it does copy data.

Parameters
srcdata source

Definition at line 206 of file data.hpp.

◆ DataVector() [7/13]

template<typename T >
plask::DataVector< T >::DataVector ( DataVector< CT > &&  src)
inlinenoexcept

Move constructor.

Parameters
srcdata to move

Definition at line 243 of file data.hpp.

◆ DataVector() [8/13]

template<typename T >
plask::DataVector< T >::DataVector ( DataVector< VT > &&  src)
inlinenoexcept

Move constructor.

Parameters
srcdata to move

Definition at line 251 of file data.hpp.

◆ DataVector() [9/13]

template<typename T >
template<typename TS >
plask::DataVector< T >::DataVector ( TS existing_data,
std::size_t  size 
)
inline

Create vector out of existing data.

Parameters
sizetotal size of the existing data
existing_datapointer to existing data

Definition at line 271 of file data.hpp.

◆ DataVector() [10/13]

template<typename T >
template<typename TS >
plask::DataVector< T >::DataVector ( TS existing_data,
std::size_t  size,
const std::function< void(void *)> &  deleter 
)
inline

Create vector out of existing data with guardian.

Parameters
sizetotal size of the existing data
existing_datapointer to existing data
deleterfunction deleting data

Definition at line 281 of file data.hpp.

◆ DataVector() [11/13]

template<typename T >
template<typename TS >
plask::DataVector< T >::DataVector ( TS existing_data,
std::size_t  size,
std::function< void(void *)> &&  deleter 
)
inline

Create vector out of existing data with guardian.

Parameters
sizetotal size of the existing data
existing_datapointer to existing data
deleterfunction deleting data

Definition at line 292 of file data.hpp.

◆ DataVector() [12/13]

template<typename T >
plask::DataVector< T >::DataVector ( std::initializer_list< T >  init)
inline

Create data vector and fill it with data from initializer list.

Parameters
initinitializer list with data

Definition at line 300 of file data.hpp.

◆ DataVector() [13/13]

template<typename T >
template<typename TS >
plask::DataVector< T >::DataVector ( std::initializer_list< TS init)
inline

Create data vector and fill it with data from initializer list.

Parameters
initinitializer list with data

Definition at line 309 of file data.hpp.

◆ ~DataVector()

template<typename T >
plask::DataVector< T >::~DataVector ( )
inline

Delete data if this was last reference to it.

Definition at line 314 of file data.hpp.

Member Function Documentation

◆ begin() [1/2]

template<typename T >
iterator plask::DataVector< T >::begin ( )
inline

Get iterator referring to the first object in data vector.

Returns
iterator referring to the first object in data vector

Definition at line 432 of file data.hpp.

◆ begin() [2/2]

template<typename T >
const_iterator plask::DataVector< T >::begin ( ) const
inline

Get iterator referring to the first object in data vector.

Returns
const iterator referring to the first object in data vector

Definition at line 426 of file data.hpp.

◆ claim()

template<typename T >
DataVector< VT > plask::DataVector< T >::claim ( ) const
inline

Make copy of data only if this is not the only one owner of it.

Returns
copy of this: shallow if unique() is true, deep if unique() is false

Definition at line 505 of file data.hpp.

◆ copy()

template<typename T >
DataVector< VT > plask::DataVector< T >::copy ( ) const
inline

Make a deep copy of the data.

Returns
new object with manage copy of this data

Definition at line 476 of file data.hpp.

◆ data() [1/2]

template<typename T >
T * plask::DataVector< T >::data ( )
inline
Returns
pointer to data

Definition at line 453 of file data.hpp.

◆ data() [2/2]

template<typename T >
const T * plask::DataVector< T >::data ( ) const
inline
Returns
constant pointer to data

Definition at line 450 of file data.hpp.

◆ end() [1/2]

template<typename T >
iterator plask::DataVector< T >::end ( )
inline

Get iterator referring to the past-the-end object in data vector.

Returns
iterator referring to the past-the-end object in data vector

Definition at line 444 of file data.hpp.

◆ end() [2/2]

template<typename T >
const_iterator plask::DataVector< T >::end ( ) const
inline

Get iterator referring to the past-the-end object in data vector.

Returns
const iterator referring to the past-the-end object in data vector

Definition at line 438 of file data.hpp.

◆ fill()

template<typename T >
template<typename O >
void plask::DataVector< T >::fill ( const O value)
inline

Fill all data using given value.

Parameters
valuevalue to fill

Definition at line 524 of file data.hpp.

◆ getSubarrayCopy()

template<typename T >
DataVector< T > plask::DataVector< T >::getSubarrayCopy ( std::size_t  begin_index,
std::size_t  subarray_size 
) const
inline

Get sub-array of this which copies the data (fragment) of this.

Parameters
begin_indexindex of this from which data of sub-array should begin
subarray_sizesize of sub-array
Returns
data vector which stores new data which are copy of data from this

Definition at line 556 of file data.hpp.

◆ getSubarrayRef() [1/2]

template<typename T >
DataVector< T > plask::DataVector< T >::getSubarrayRef ( std::size_t  begin_index,
std::size_t  subarray_size 
)
inline

Get sub-array of this which refers to data of this.

Parameters
begin_indexindex of this from which data of sub-array should begin
subarray_sizesize of sub-array
Returns
data vector which refers to same data as this and is valid not longer than the data of this

Definition at line 534 of file data.hpp.

◆ getSubarrayRef() [2/2]

template<typename T >
DataVector< const T > plask::DataVector< T >::getSubarrayRef ( std::size_t  begin_index,
std::size_t  subarray_size 
) const
inline

Get sub-array of this which refers to data of this.

Parameters
begin_indexindex of this from which data of sub-array should begin
subarray_sizesize of sub-array
Returns
data vector which refers to the same data as this and is valid not longer than the data of this

Definition at line 545 of file data.hpp.

◆ getSubrangeCopy()

template<typename T >
DataVector< T > plask::DataVector< T >::getSubrangeCopy ( const_iterator  begin,
const_iterator  end 
)
inline

Get sub-array of this which copies the data (fragment) of this.

Parameters
begin,endrange [begin, end), sub-range of [begin(), end())
Returns
data vector which stores new data which are copy of the data from this

Definition at line 585 of file data.hpp.

◆ getSubrangeRef() [1/2]

template<typename T >
DataVector< const T > plask::DataVector< T >::getSubrangeRef ( const_iterator  begin,
const_iterator  end 
) const
inline

Get sub-array of this which refers to data of this.

Parameters
begin,endrange [begin, end), sub-range of [begin(), end())
Returns
data vector which refers to same data as this and is valid not longer than the data of this

Definition at line 575 of file data.hpp.

◆ getSubrangeRef() [2/2]

template<typename T >
DataVector< T > plask::DataVector< T >::getSubrangeRef ( iterator  begin,
iterator  end 
)
inline

Get sub-array of this which refers to data of this.

Parameters
begin,endrange [begin, end), sub-range of [begin(), end())
Returns
data vector which refers to same data as this and is valid not longer than the data of this

Definition at line 565 of file data.hpp.

◆ operator bool()

template<typename T >
plask::DataVector< T >::operator bool ( ) const
inline
Returns
true if vector has any data

Definition at line 470 of file data.hpp.

◆ operator=() [1/3]

template<typename T >
DataVector< T > & plask::DataVector< T >::operator= ( const DataVector< CT > &  M)
inline

Assign operator.

Only makes a shallow copy (doesn't copy data).

Parameters
Mdata source
Returns
*this

Definition at line 216 of file data.hpp.

◆ operator=() [2/3]

template<typename T >
DataVector< T > & plask::DataVector< T >::operator= ( const DataVector< VT > &  M)
inline

Assign operator.

Only makes a shallow copy (doesn't copy data).

Parameters
Mdata source
Returns
*this

Definition at line 230 of file data.hpp.

◆ operator=() [3/3]

template<typename T >
DataVector< T > & plask::DataVector< T >::operator= ( DataVector< T > &&  src)
inlinenoexcept

Move operator.

Parameters
srcdata source
Returns
*this

Definition at line 260 of file data.hpp.

◆ operator[]() [1/2]

template<typename T >
T & plask::DataVector< T >::operator[] ( std::size_t  n)
inline

Return reference to the n-th object of the data.

Parameters
nnumber of object to return
Returns
reference to n-th object of the data

Definition at line 467 of file data.hpp.

◆ operator[]() [2/2]

template<typename T >
const T & plask::DataVector< T >::operator[] ( std::size_t  n) const
inline

Return reference to the (constant) n-th object of the data.

Parameters
nnumber of object to return
Returns
reference to n-th object of the data

Definition at line 460 of file data.hpp.

◆ remove_const()

template<typename T >
DataVector< VT > plask::DataVector< T >::remove_const ( ) const
inline

Allow to remove const qualifier from data, must be.

Returns
non-const version of this which refer to the same data

Definition at line 494 of file data.hpp.

◆ reset() [1/7]

template<typename T >
void plask::DataVector< T >::reset ( )
inline

Make this data vector points to nullptr data with 0-size.

Same effect as: DataVector().swap(*this);

Definition at line 321 of file data.hpp.

◆ reset() [2/7]

template<typename T >
template<typename InIterT >
void plask::DataVector< T >::reset ( InIterT  begin,
InIterT  end 
)
inline

Change data of this to copy of range [begin, end).

Same as: DataVector(begin,end).swap(*this);

Parameters
begin,endrange of data to copy

Definition at line 412 of file data.hpp.

◆ reset() [3/7]

template<typename T >
void plask::DataVector< T >::reset ( std::size_t  size)
inline

Change data of this data vector to uninitialized data with given size.

Reserve memory using aligned_malloc<T>(size) call.

Same effect as: DataVector(size).swap(*this);

Parameters
sizetotal size of the data

Definition at line 377 of file data.hpp.

◆ reset() [4/7]

template<typename T >
void plask::DataVector< T >::reset ( std::size_t  size,
const T &  value 
)
inline

Change data of this to array of given size and fill all its' cells with given value.

Same as: DataVector(size, value).swap(*this);

Parameters
sizesize of vector
valueinitial value for each cell

Definition at line 395 of file data.hpp.

◆ reset() [5/7]

template<typename T >
template<typename TS >
void plask::DataVector< T >::reset ( TS existing_data,
std::size_t  size 
)
inline

Change data of this data vector.

Same as: DataVector(existing_data, size).swap(*this);

Parameters
sizetotal size of the existing data
existing_datapointer to existing data

Definition at line 334 of file data.hpp.

◆ reset() [6/7]

template<typename T >
template<typename TS >
void plask::DataVector< T >::reset ( TS existing_data,
std::size_t  size,
const std::function< void(void *)> &  deleter 
)
inline

Change data of this data vector.

Same as: DataVector(existing_data, size, deleter).swap(*this);

Parameters
existing_datapointer to existing data
sizetotal size of the existing data
deleterused to free data memory

Definition at line 348 of file data.hpp.

◆ reset() [7/7]

template<typename T >
template<typename TS >
void plask::DataVector< T >::reset ( TS existing_data,
std::size_t  size,
std::function< void(void *)> &&  deleter 
)
inline

Change data of this data vector.

Same as: DataVector(existing_data, size, deleter).swap(*this);

Parameters
existing_datapointer to existing data
sizetotal size of the existing data
deleterused to free data memory

Definition at line 362 of file data.hpp.

◆ size()

template<typename T >
std::size_t plask::DataVector< T >::size ( ) const
inline
Returns
total size of the matrix/vector

Definition at line 447 of file data.hpp.

◆ swap()

template<typename T >
void plask::DataVector< T >::swap ( DataVector< T > &  other)
inlinenoexcept

Swap all internals of this and other.

Parameters
otherdata vector to swap with

Definition at line 513 of file data.hpp.

◆ unique()

template<typename T >
bool plask::DataVector< T >::unique ( ) const
inline

Check if this is the only one owner of data.

Returns
true only if for sure this is the only one owner of data

Definition at line 486 of file data.hpp.

Friends And Related Symbol Documentation

◆ accumulate()

template<class T >
std::remove_cv< T >::type accumulate ( const DataVector< T > &  to_accum,
typename std::remove_cv< T >::type  initial = typename std::remove_cv<T>::type() 
)
related

Sum all elements in the vector.

Parameters
to_accumvector to accumulate
initial
Returns
*this

Definition at line 807 of file data.hpp.

◆ const_data_cast()

template<typename RT , typename T >
DataVector< RT > const_data_cast ( const DataVector< T > &  src)
related

Cast DataVector<const T> into DataVector<T>

Parameters
srcvector of type DataVector<const T> or DataVector<T>
Returns
data vector of type DataVector<RT>
Template Parameters
RTmust be equal to T without const

Definition at line 829 of file data.hpp.

◆ DataVector< CT >

template<typename T >
friend struct DataVector< CT >
friend

Definition at line 149 of file data.hpp.

◆ DataVector< VT >

template<typename T >
friend struct DataVector< VT >
friend

Definition at line 149 of file data.hpp.

◆ operator!=()

template<class T1 , class T2 >
bool operator!= ( DataVector< T1 > const a,
DataVector< T2 > const b 
)
related

Check if two data vectors are not equal.

Parameters
a,bvectors to compare
Returns
true only if a is not equal to b

Definition at line 606 of file data.hpp.

◆ operator*() [1/2]

template<typename T , typename S >
DataVector< typename std::remove_cv< decltype(T() *S())>::type > operator* ( DataVector< T > const vec,
a 
)
related

Compute factor of vec and .

Parameters
vecvector to multiply
amultiply factor
Returns
vec * a

Definition at line 762 of file data.hpp.

◆ operator*() [2/2]

template<typename T , typename S >
DataVector< typename std::remove_cv< decltype(S() *T())>::type > operator* ( a,
DataVector< T > const vec 
)
related

Compute factor of a and vec.

Parameters
amultiply factor
vecvector to multiply
Returns
a * vec

Definition at line 776 of file data.hpp.

◆ operator*=()

template<typename T , typename S >
DataVector< T > & operator*= ( DataVector< T > &  vec,
a 
)
related

Multiply each element of vec by a.

Parameters
vecvector to multiply
amultiply factor
Returns
*this

Definition at line 690 of file data.hpp.

◆ operator+()

template<typename T1 , typename T2 >
DataVector< typename std::remove_cv< decltype(T1()+T2())>::type > operator+ ( DataVector< T1 > const vec1,
DataVector< T2 > const vec2 
)
related

Calculate sum of two data vectors.

Parameters
vec1first component
vec2second component
Returns
vec1 + vec2

Definition at line 717 of file data.hpp.

◆ operator+=()

template<class T , class S >
DataVector< T > & operator+= ( DataVector< T > &  to_inc,
DataVector< S > const inc_val 
)
related

Calculate: to_inc[i] += inc_val[i] for all vector elements.

Parameters
to_incvector to increase
inc_valincrease value (must have the same size as to_inc)
Returns
*this

Definition at line 660 of file data.hpp.

◆ operator-() [1/2]

template<class T >
DataVector< typename std::remove_cv< T >::type > operator- ( DataVector< T > const vec)
related

Negate the data vector.

Parameters
vecvector to negate
Returns
-vec1

Definition at line 748 of file data.hpp.

◆ operator-() [2/2]

template<typename T1 , typename T2 >
DataVector< typename std::remove_cv< decltype(T1() -T2())>::type > operator- ( DataVector< T1 > const vec1,
DataVector< T2 > const vec2 
)
related

Calculate difference of two data vectors.

Parameters
vec1first component
vec2second component
Returns
vec1 - vec2

Definition at line 733 of file data.hpp.

◆ operator-=()

template<class T , class S >
DataVector< T > & operator-= ( DataVector< T > &  to_dec,
DataVector< S > const dec_val 
)
related

Calculate: to_dec[i] -= dec_val[i] for all vector elements.

Parameters
to_decvector to decrease
dec_valdecrease value (must have the same size as to_dec)
Returns
*this

Definition at line 675 of file data.hpp.

◆ operator/()

template<typename T , typename S >
DataVector< typename std::remove_cv< decltype(T() *(1./S()))>::type > operator/ ( DataVector< T > const vec,
a 
)
related

Divide vec by a.

Parameters
vecvector to divide
adivide factor
Returns
vec / a

Definition at line 790 of file data.hpp.

◆ operator/=()

template<typename T , typename S >
DataVector< T > & operator/= ( DataVector< T > &  vec,
a 
)
related

Divide each element of vec by a.

Parameters
vecvector to multiply
amultiply factor
Returns
*this

Definition at line 703 of file data.hpp.

◆ operator<()

template<class T1 , class T2 >
bool operator< ( DataVector< T1 > const a,
DataVector< T2 > const b 
)
related

A lexical comparison of two data vectors.

Parameters
a,bvectors to compare
Returns
true only if a is smaller than the b

Definition at line 614 of file data.hpp.

◆ operator<<()

template<class T >
std::ostream & operator<< ( std::ostream &  out,
DataVector< T > const to_print 
)
related

Print data vector to stream.

Parameters
outoutput, destination stream
to_printvector to print
Returns
out

Definition at line 648 of file data.hpp.

◆ operator<=()

template<class T1 , class T2 >
bool operator<= ( DataVector< T1 > const a,
DataVector< T2 > const b 
)
related

A lexical comparison of two data vectors.

Parameters
a,bvectors to compare
Returns
true only if a is smaller or equal to b

Definition at line 631 of file data.hpp.

◆ operator==()

template<class T1 , class T2 >
bool operator== ( DataVector< T1 > const a,
DataVector< T2 > const b 
)
related

Check if two data vectors are equal.

Parameters
a,bvectors to compare
Returns
true only if a is equal to b (a[0]==b[0], a[1]==b[1], ...)

Definition at line 597 of file data.hpp.

◆ operator>()

template<class T1 , class T2 >
bool operator> ( DataVector< T1 > const a,
DataVector< T2 > const b 
)
related

A lexical comparison of two data vectors.

Parameters
a,bvectors to compare
Returns
true only if b is smaller than the a

Definition at line 623 of file data.hpp.

◆ operator>=()

template<class T1 , class T2 >
bool operator>= ( DataVector< T1 > const a,
DataVector< T2 > const b 
)
related

A lexical comparison of two data vectors.

Parameters
a,bvectors to compare
Returns
true only if b is smaller or equal to a

Definition at line 639 of file data.hpp.


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