PandA-2024.02
|
#include <augmented_vector.hpp>
Public Member Functions | |
AugmentedVector ()=default | |
Empty Constructor. More... | |
AugmentedVector (const size_t _size, T element) | |
Construct a vector composed by size element. More... | |
AugmentedVector (const size_t _size) | |
Construct a vector of size size. More... | |
AugmentedVector (const std::vector< T > &vector) | |
Constructor from std::vector. More... | |
T & | operator[] (size_t position) |
Redefinition of [] operator. More... | |
const T & | operator[] (size_t position) const |
Redefinition of [] operator. More... | |
T | operator* (const AugmentedVector< T > &other) const |
Redefinition of * operator as scalar multiplication. More... | |
AugmentedVector< T > | operator- (const AugmentedVector< T > &other) const |
Redefinition of - operator as the difference of the single element. More... | |
size_t | size () const |
Return the size of the vector. More... | |
T | Norm2 () const |
Return the 2-norm of the vector. More... | |
void | get_min (size_t &min) const |
Return the index of mininum element of the vector. More... | |
void | get_min_max (size_t &min, size_t &max) const |
Return the index of the minimum and maximum element of the vector. More... | |
T | get_sum () const |
Return the sum of a row. More... | |
T | get_mean () const |
Return the mean of the vector. More... | |
void | remove (const size_t index) |
Remove an element. More... | |
void | clear () |
Erase all the elements. More... | |
void | push_back (const T &elem) |
Inserts a new elment at the end. More... | |
void | resize (size_t n, T t=T()) |
Inserts or erases elements at the end such that the size becomes n. More... | |
void | normalize () |
Normalize the row. More... | |
void | Clear () |
Erase all elements. More... | |
Private Attributes | |
std::vector< T > | internal_vector |
The class which it logical extended by this (inheritance from template is not allowed) More... | |
Definition at line 54 of file augmented_vector.hpp.
|
default |
Empty Constructor.
|
inline |
Construct a vector composed by size element.
size | is the size of the vector |
element | is the element with which the vector is filled |
Definition at line 71 of file augmented_vector.hpp.
|
inlineexplicit |
Construct a vector of size size.
size | is the size of the vector |
Definition at line 79 of file augmented_vector.hpp.
|
inlineexplicit |
Constructor from std::vector.
vector | is the starting vector |
Definition at line 87 of file augmented_vector.hpp.
|
inline |
Erase all the elements.
Definition at line 249 of file augmented_vector.hpp.
|
inline |
Erase all elements.
Definition at line 289 of file augmented_vector.hpp.
|
inline |
Return the mean of the vector.
Definition at line 229 of file augmented_vector.hpp.
References AugmentedVector< T >::get_sum(), and AugmentedVector< T >::size().
|
inline |
Return the index of mininum element of the vector.
min | is where the index of the mimimum element will be stored |
Definition at line 174 of file augmented_vector.hpp.
References index, and AugmentedVector< T >::size().
|
inline |
Return the index of the minimum and maximum element of the vector.
min | is where the index of the minimum element will be stored |
max | is where the index of the maximum element will be stored |
Definition at line 192 of file augmented_vector.hpp.
References index, and AugmentedVector< T >::size().
|
inline |
Return the sum of a row.
Definition at line 214 of file augmented_vector.hpp.
References index, and AugmentedVector< T >::size().
Referenced by AugmentedVector< T >::get_mean(), and AugmentedVector< T >::normalize().
|
inline |
Return the 2-norm of the vector.
Fixme this works only if exists conversion from 0 to T
Definition at line 159 of file augmented_vector.hpp.
|
inline |
Normalize the row.
Definition at line 276 of file augmented_vector.hpp.
References AugmentedVector< T >::get_sum(), index, AugmentedVector< T >::size(), and sum.
|
inline |
Redefinition of * operator as scalar multiplication.
other | is the second operand |
Fixme this works only if exists conversion from 0 to T
Definition at line 114 of file augmented_vector.hpp.
References AugmentedVector< T >::size(), and THROW_ASSERT.
|
inline |
Redefinition of - operator as the difference of the single element.
other | is the second operand |
Definition at line 133 of file augmented_vector.hpp.
References AugmentedVector< T >::internal_vector, AugmentedVector< T >::size(), and THROW_ASSERT.
|
inline |
Redefinition of [] operator.
position | is the position of the element to get |
Definition at line 95 of file augmented_vector.hpp.
|
inline |
Redefinition of [] operator.
position | is the position of the element to get |
Definition at line 104 of file augmented_vector.hpp.
|
inline |
Inserts a new elment at the end.
elem | is the element to be inserted |
Definition at line 258 of file augmented_vector.hpp.
|
inline |
Remove an element.
index | is the index of the element to be removed |
To avoid the cast, we should use a for with ++
Definition at line 238 of file augmented_vector.hpp.
References index.
|
inline |
Inserts or erases elements at the end such that the size becomes n.
n | is the new size of the vector |
t | is the element to be inserted |
Definition at line 268 of file augmented_vector.hpp.
|
inline |
Return the size of the vector.
Definition at line 150 of file augmented_vector.hpp.
Referenced by AugmentedVector< T >::get_mean(), AugmentedVector< T >::get_min(), AugmentedVector< T >::get_min_max(), AugmentedVector< T >::get_sum(), AugmentedVector< T >::normalize(), AugmentedVector< T >::operator*(), and AugmentedVector< T >::operator-().
|
private |
The class which it logical extended by this (inheritance from template is not allowed)
Definition at line 58 of file augmented_vector.hpp.
Referenced by AugmentedVector< T >::operator-().