Class sdm::MappedVector
template <class TIndex, class T, class Hash, class KeyEqual>
Class List > sdm > MappedVector
Mapped vectors are vectors with specific type of indexes. They are represented by a map. More...
#include <mapped_vector.hpp>
Inherits the following classes: std::unordered_map< TIndex, T, Hash, KeyEqual >, sdm::VectorInterface
Public Types
Type | Name |
---|---|
typedef typename std::unordered_map< TIndex, T, Hash, KeyEqual >::const_iterator | const_iterator |
typedef typename std::unordered_map< TIndex, T, Hash, KeyEqual >::iterator | iterator |
typedef typename RecursiveMap< TIndex, T >::type | type |
typedef typename RecursiveMap< TIndex, T >::value_list_type | value_list_type |
typedef typename RecursiveMap< TIndex, T >::value_type | value_type |
Public Static Attributes
Type | Name |
---|---|
double | PRECISION |
Public Functions
Type | Name |
---|---|
MappedVector () | |
MappedVector (T default_value) | |
MappedVector (long size, T default_value) | |
MappedVector (const MappedVector &) | |
MappedVector (std::initializer_list< value_list_type >) | |
std::shared_ptr< TOutput > | add (const std::shared_ptr< TOutput > & other, double coef_this=1., double coef_other=1.) const |
virtual void | addValueAt (const TIndex &, const T &) |
virtual TIndex | argmax () |
virtual TIndex | argmin () |
virtual T | at (const TIndex &) const |
T | dot (const MappedVector &) const This method implements a non-commutative dot product : It is worth noticing that sometimes arg1.dot(arg2) != arg2.dot(arg1) |
void | finalize () |
T | getDefault () const |
virtual std::vector< TIndex > | getIndexes () const |
virtual T | getValueAt (const TIndex &) const |
bool | isExist (const TIndex &) const |
bool | is_equal (const MappedVector & other, double precision) const |
virtual T | max () |
virtual T | min () |
T | norm_1 () const |
T | norm_2 () const |
bool | operator!= (const MappedVector &) const |
T | operator* (const MappedVector &) const |
bool | operator< (const MappedVector &) const |
bool | operator== (const MappedVector & other) const |
T | operator^ (const MappedVector &) const This method implements a non-commutative dot product : It is worth noticing that sometimes arg1.dot(arg2) != arg2.dot(arg1) |
void | serialize (Archive & archive, const unsigned int) |
void | setDefault (double default_value) |
virtual void | setValueAt (const TIndex &, const T &) |
void | setupIndexes () |
virtual size_t | size () const |
virtual std::string | str () const |
virtual | ~MappedVector () |
Public Functions inherited from sdm::VectorInterface
Type | Name |
---|---|
virtual void | addValueAt (const I & index, const T & value) = 0 |
virtual I | argmax () = 0 |
virtual I | argmin () = 0 |
virtual T | at (const I & index) const = 0 |
virtual std::vector< I > | getIndexes () const = 0 |
virtual T | getValueAt (const I & index) const = 0 |
virtual T | max () = 0 |
virtual T | min () = 0 |
virtual void | setValueAt (const I & index, const T & value) = 0 |
virtual size_t | size () const = 0 |
virtual std::string | str () const = 0 |
Public Static Functions
Type | Name |
---|---|
void | setPrecision (double) |
Protected Attributes
Type | Name |
---|---|
bool | bmax = = false |
bool | bmin = = false |
T | default_value_ = = 0.0 |
std::pair< TIndex, T > | pmax |
std::pair< TIndex, T > | pmin |
long | size_ = = -1 |
std::vector< TIndex > | v_indexes = = {} |
Protected Functions
Type | Name |
---|---|
const std::pair< TIndex, T > & | getMax () |
const std::pair< TIndex, T > & | getMin () |
Detailed Description
Template parameters:
TIndex
the type of indexT
the type of value (default :double
)
Using map structure allows to keep only necessary values. Moreover, it allows to see vectors not only as a mapping from integer to value but also as a mapping from any type of index to values.
Public Types Documentation
typedef const_iterator
using sdm::MappedVector< TIndex, T, Hash, KeyEqual >::const_iterator = typename std::unordered_map<TIndex, T, Hash, KeyEqual>::const_iterator;
typedef iterator
using sdm::MappedVector< TIndex, T, Hash, KeyEqual >::iterator = typename std::unordered_map<TIndex, T, Hash, KeyEqual>::iterator;
typedef type
using sdm::MappedVector< TIndex, T, Hash, KeyEqual >::type = typename RecursiveMap<TIndex, T>::type;
typedef value_list_type
using sdm::MappedVector< TIndex, T, Hash, KeyEqual >::value_list_type = typename RecursiveMap<TIndex, T>::value_list_type;
typedef value_type
using sdm::MappedVector< TIndex, T, Hash, KeyEqual >::value_type = typename RecursiveMap<TIndex, T>::value_type;
Public Static Attributes Documentation
variable PRECISION
double sdm::MappedVector< TIndex, T, Hash, KeyEqual >::PRECISION;
Public Functions Documentation
function MappedVector [1/5]
sdm::MappedVector::MappedVector ()
function MappedVector [2/5]
sdm::MappedVector::MappedVector (
T default_value
)
function MappedVector [3/5]
sdm::MappedVector::MappedVector (
long size,
T default_value
)
function MappedVector [4/5]
sdm::MappedVector::MappedVector (
const MappedVector &
)
function MappedVector [5/5]
sdm::MappedVector::MappedVector (
std::initializer_list< value_list_type >
)
function add
template<class TOutput class TOutput>
inline std::shared_ptr< TOutput > sdm::MappedVector::add (
const std::shared_ptr< TOutput > & other,
double coef_this=1.,
double coef_other=1.
) const
function addValueAt
virtual void sdm::MappedVector::addValueAt (
const TIndex &,
const T &
)
Implements sdm::VectorInterface::addValueAt
function argmax
virtual TIndex sdm::MappedVector::argmax ()
Implements sdm::VectorInterface::argmax
function argmin
virtual TIndex sdm::MappedVector::argmin ()
Implements sdm::VectorInterface::argmin
function at
virtual T sdm::MappedVector::at (
const TIndex &
) const
Implements sdm::VectorInterface::at
function dot
T sdm::MappedVector::dot (
const MappedVector &
) const
Returns:
T
function finalize
void sdm::MappedVector::finalize ()
function getDefault
T sdm::MappedVector::getDefault () const
function getIndexes
virtual std::vector< TIndex > sdm::MappedVector::getIndexes () const
Implements sdm::VectorInterface::getIndexes
function getValueAt
virtual T sdm::MappedVector::getValueAt (
const TIndex &
) const
Implements sdm::VectorInterface::getValueAt
function isExist
bool sdm::MappedVector::isExist (
const TIndex &
) const
function is_equal
bool sdm::MappedVector::is_equal (
const MappedVector & other,
double precision
) const
function max
virtual T sdm::MappedVector::max ()
Implements sdm::VectorInterface::max
function min
virtual T sdm::MappedVector::min ()
Implements sdm::VectorInterface::min
function norm_1
T sdm::MappedVector::norm_1 () const
function norm_2
T sdm::MappedVector::norm_2 () const
function operator!=
bool sdm::MappedVector::operator!= (
const MappedVector &
) const
function operator*
T sdm::MappedVector::operator* (
const MappedVector &
) const
function operator<
bool sdm::MappedVector::operator< (
const MappedVector &
) const
function operator==
bool sdm::MappedVector::operator== (
const MappedVector & other
) const
function operator^
T sdm::MappedVector::operator^ (
const MappedVector &
) const
Returns:
T
function serialize
template<class Archive class Archive>
void sdm::MappedVector::serialize (
Archive & archive,
const unsigned int
)
function setDefault
void sdm::MappedVector::setDefault (
double default_value
)
function setValueAt
virtual void sdm::MappedVector::setValueAt (
const TIndex &,
const T &
)
Implements sdm::VectorInterface::setValueAt
function setupIndexes
void sdm::MappedVector::setupIndexes ()
function size
virtual size_t sdm::MappedVector::size () const
Implements sdm::VectorInterface::size
function str
virtual std::string sdm::MappedVector::str () const
Implements sdm::VectorInterface::str
function ~MappedVector
virtual sdm::MappedVector::~MappedVector ()
Public Static Functions Documentation
function setPrecision
static void sdm::MappedVector::setPrecision (
double
)
Protected Attributes Documentation
variable bmax
bool sdm::MappedVector< TIndex, T, Hash, KeyEqual >::bmax;
variable bmin
bool sdm::MappedVector< TIndex, T, Hash, KeyEqual >::bmin;
variable default_value_
T sdm::MappedVector< TIndex, T, Hash, KeyEqual >::default_value_;
variable pmax
std::pair<TIndex, T> sdm::MappedVector< TIndex, T, Hash, KeyEqual >::pmax;
variable pmin
std::pair<TIndex, T> sdm::MappedVector< TIndex, T, Hash, KeyEqual >::pmin;
variable size_
long sdm::MappedVector< TIndex, T, Hash, KeyEqual >::size_;
variable v_indexes
std::vector<TIndex> sdm::MappedVector< TIndex, T, Hash, KeyEqual >::v_indexes;
Protected Functions Documentation
function getMax
const std::pair< TIndex, T > & sdm::MappedVector::getMax ()
function getMin
const std::pair< TIndex, T > & sdm::MappedVector::getMin ()
Friends Documentation
friend access
friend class sdm::MappedVector::access ()
friend operator<<
inline friend std::ostream & sdm::MappedVector::operator<< (
std::ostream & os,
const MappedVector & vect
)
The documentation for this class was generated from the following file src/sdm/utils/linear_algebra/mapped_vector.hpp