Class sdm::sdmsVector
template <class I class I, class T class T, class TBaseVector class TBaseVector>
Class List > sdm > sdmsVector
Create a SDMS Vector. A SMDS Vector is used to optimize the calculation, however, you have to be careful when using it because it's not possible to add element after the initialization. More...
#include <sdms_vector.hpp>
Inherits the following classes: sdm::VectorInterface
Public Static Attributes
Type | Name |
---|---|
double | PRECISION |
Public Functions
Type | Name |
---|---|
virtual void | addValueAt (const I &, const T & value) |
virtual I | argmax () |
virtual I | argmin () |
virtual T | at (const I &) const |
auto | begin () const |
T | dot (const sdmsVector & v2) const |
auto | end () const |
virtual const std::vector< I > & | getIndexes () const |
std::shared_ptr< std::unordered_map< I, size_t > > | getMapElementToIndex () const |
virtual T | getValueAt (const I &) const |
bool | is_equal (const sdmsVector & other, double precision) const |
virtual T | max () |
virtual T | min () |
T | norm_1 () const |
T | norm_2 () const |
bool | operator!= (const sdmsVector &) const |
bool | operator<= (const sdmsVector &) const Compare two vectors. Return true if all values are lower or equal to the second vector. |
bool | operator== (const sdmsVector &) const |
T | operator^ (const sdmsVector & v2) const |
sdmsVector () | |
sdmsVector (std::shared_ptr< std::unordered_map< I, size_t >>, std::shared_ptr< std::unordered_map< I, T >>, double=0) Create a SDMS Vector. In order to create a vector, it's necessary to provide a map that associated the I element with a specific index and a specific Value. | |
sdmsVector (std::vector< I >, std::vector< T >, double=0) Create a SDMS Vector. | |
void | serialize (Archive & archive, const unsigned int) |
virtual void | setValueAt (const I &, const T & value) |
virtual size_t | size () const |
virtual std::string | str () const |
T | sum () const |
virtual | ~sdmsVector () |
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 |
Protected Attributes
Type | Name |
---|---|
std::shared_ptr< std::unordered_map< I, size_t > > | map_element_to_index_ |
TBaseVector | tbasevector_ |
std::vector< I > | vector_element_ |
Protected Functions
Type | Name |
---|---|
std::pair< I, T > | getMax () const |
std::pair< I, T > | getMin () const |
Detailed Description
Template parameters:
I
Type of indexT
Type of value
Public Static Attributes Documentation
variable PRECISION
double sdm::sdmsVector< I, T, TBaseVector >::PRECISION;
Public Functions Documentation
function addValueAt
virtual void sdm::sdmsVector::addValueAt (
const I &,
const T & value
)
Implements sdm::VectorInterface::addValueAt
function argmax
virtual I sdm::sdmsVector::argmax ()
Implements sdm::VectorInterface::argmax
function argmin
virtual I sdm::sdmsVector::argmin ()
Implements sdm::VectorInterface::argmin
function at
virtual T sdm::sdmsVector::at (
const I &
) const
Implements sdm::VectorInterface::at
function begin
inline auto sdm::sdmsVector::begin () const
function dot
T sdm::sdmsVector::dot (
const sdmsVector & v2
) const
function end
inline auto sdm::sdmsVector::end () const
function getIndexes
virtual const std::vector< I > & sdm::sdmsVector::getIndexes () const
Implements sdm::VectorInterface::getIndexes
function getMapElementToIndex
std::shared_ptr< std::unordered_map< I, size_t > > sdm::sdmsVector::getMapElementToIndex () const
function getValueAt
virtual T sdm::sdmsVector::getValueAt (
const I &
) const
Implements sdm::VectorInterface::getValueAt
function is_equal
bool sdm::sdmsVector::is_equal (
const sdmsVector & other,
double precision
) const
function max
virtual T sdm::sdmsVector::max ()
Implements sdm::VectorInterface::max
function min
virtual T sdm::sdmsVector::min ()
Implements sdm::VectorInterface::min
function norm_1
T sdm::sdmsVector::norm_1 () const
function norm_2
T sdm::sdmsVector::norm_2 () const
function operator!=
bool sdm::sdmsVector::operator!= (
const sdmsVector &
) const
function operator<=
bool sdm::sdmsVector::operator<= (
const sdmsVector &
) const
Returns:
true
Returns:
false
function operator==
bool sdm::sdmsVector::operator== (
const sdmsVector &
) const
function operator^
T sdm::sdmsVector::operator^ (
const sdmsVector & v2
) const
function sdmsVector [1/3]
sdm::sdmsVector::sdmsVector ()
function sdmsVector [2/3]
sdm::sdmsVector::sdmsVector (
std::shared_ptr< std::unordered_map< I, size_t >>,
std::shared_ptr< std::unordered_map< I, T >>,
double=0
)
Parameters:
std::shared_ptr<std::unordered_map<I
: A map that associate the element I with a specific indexstd::shared_ptr<std::unordered_map<I
: A map that associate the element I with a specific valuedouble
: the default value
function sdmsVector [3/3]
sdm::sdmsVector::sdmsVector (
std::vector< I >,
std::vector< T >,
double=0
)
Parameters:
std::vector<I>>
: A vector for each element Istd::vector<T>
: A vector for each value associate at the same position of the element I in vectordouble
: the default value
function serialize
template<class Archive class Archive>
void sdm::sdmsVector::serialize (
Archive & archive,
const unsigned int
)
function setValueAt
virtual void sdm::sdmsVector::setValueAt (
const I &,
const T & value
)
Implements sdm::VectorInterface::setValueAt
function size
virtual size_t sdm::sdmsVector::size () const
Implements sdm::VectorInterface::size
function str
virtual std::string sdm::sdmsVector::str () const
Implements sdm::VectorInterface::str
function sum
T sdm::sdmsVector::sum () const
function ~sdmsVector
inline virtual sdm::sdmsVector::~sdmsVector ()
Protected Attributes Documentation
variable map_element_to_index_
std::shared_ptr<std::unordered_map<I, size_t> > sdm::sdmsVector< I, T, TBaseVector >::map_element_to_index_;
variable tbasevector_
TBaseVector sdm::sdmsVector< I, T, TBaseVector >::tbasevector_;
variable vector_element_
std::vector<I> sdm::sdmsVector< I, T, TBaseVector >::vector_element_;
Protected Functions Documentation
function getMax
std::pair< I, T > sdm::sdmsVector::getMax () const
function getMin
std::pair< I, T > sdm::sdmsVector::getMin () const
The documentation for this class was generated from the following file src/sdm/utils/linear_algebra/sdms_vector.hpp