Loading...
Searching...
No Matches
idol::SparseVector< IndexT, ValueT > Class Template Reference

Description

template<class IndexT, class ValueT>
class idol::SparseVector< IndexT, ValueT >

Definition at line 66 of file SparseVector.h.

Public Types

using iterator = typename map_t::iterator
using const_iterator = typename map_t::const_iterator

Public Methods

 SparseVector (const IndexT &t_index, const ValueT &t_value)
 SparseVector (const SparseVector &)=default
 SparseVector (SparseVector &&)=default
SparseVector & operator= (const SparseVector &)=default
SparseVector & operator= (SparseVector &&) noexcept=default
virtual SparseVector & operator+= (const SparseVector &t_vector)
virtual SparseVector & operator-= (const SparseVector &t_vector)
virtual SparseVector & operator*= (std::conditional_t< std::is_arithmetic_v< ValueT >, ValueT, double > t_scalar)
virtual SparseVector & operator/= (std::conditional_t< std::is_arithmetic_v< ValueT >, ValueT, double > t_scalar)
SparseVector operator- () const
unsigned int size () const
bool empty () const
bool has_index (const IndexT &t_index) const
const ValueT & get (const IndexT &t_index1) const
void set (const IndexT &t_index, const ValueT &t_value)
virtual bool is_zero (double t_tolerance) const
void remove (const IndexT &t_index)
void clear ()
void reserve (unsigned int t_capacity)
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
const_iterator cbegin () const
const_iterator cend () const
SparseVector & merge_without_conflict (const SparseVector &t_vec)

Member Typedef Documentation

◆ const_iterator

template<class IndexT, class ValueT>
using idol::SparseVector< IndexT, ValueT >::const_iterator = typename map_t::const_iterator

Definition at line 130 of file SparseVector.h.

◆ iterator

template<class IndexT, class ValueT>
using idol::SparseVector< IndexT, ValueT >::iterator = typename map_t::iterator

Definition at line 129 of file SparseVector.h.

Constructor & Destructor Documentation

◆ SparseVector()

template<class IndexT, class ValueT>
idol::SparseVector< IndexT, ValueT >::SparseVector ( const IndexT & t_index,
const ValueT & t_value )
inline

Definition at line 87 of file SparseVector.h.

Methods Documentation

◆ begin() [1/2]

template<class IndexT, class ValueT>
iterator idol::SparseVector< IndexT, ValueT >::begin ( )
inlinenodiscard

Definition at line 132 of file SparseVector.h.

◆ begin() [2/2]

template<class IndexT, class ValueT>
const_iterator idol::SparseVector< IndexT, ValueT >::begin ( ) const
inlinenodiscard

Definition at line 136 of file SparseVector.h.

◆ cbegin()

template<class IndexT, class ValueT>
const_iterator idol::SparseVector< IndexT, ValueT >::cbegin ( ) const
inlinenodiscard

Definition at line 140 of file SparseVector.h.

◆ cend()

template<class IndexT, class ValueT>
const_iterator idol::SparseVector< IndexT, ValueT >::cend ( ) const
inlinenodiscard

Definition at line 142 of file SparseVector.h.

◆ clear()

template<class IndexT, class ValueT>
void idol::SparseVector< IndexT, ValueT >::clear ( )
inline

Definition at line 121 of file SparseVector.h.

◆ empty()

template<class IndexT, class ValueT>
bool idol::SparseVector< IndexT, ValueT >::empty ( ) const
inlinenodiscard

Definition at line 109 of file SparseVector.h.

◆ end() [1/2]

template<class IndexT, class ValueT>
iterator idol::SparseVector< IndexT, ValueT >::end ( )
inlinenodiscard

Definition at line 134 of file SparseVector.h.

◆ end() [2/2]

template<class IndexT, class ValueT>
const_iterator idol::SparseVector< IndexT, ValueT >::end ( ) const
inlinenodiscard

Definition at line 138 of file SparseVector.h.

◆ get()

template<class IndexT, class ValueT>
const ValueT & idol::SparseVector< IndexT, ValueT >::get ( const IndexT & t_index1) const
nodiscard

Definition at line 273 of file SparseVector.h.

◆ has_index()

template<class IndexT, class ValueT>
bool idol::SparseVector< IndexT, ValueT >::has_index ( const IndexT & t_index) const
inlinenodiscard

Definition at line 111 of file SparseVector.h.

◆ is_zero()

template<class IndexT, class ValueT>
bool idol::SparseVector< IndexT, ValueT >::is_zero ( double t_tolerance) const
nodiscardvirtual

Definition at line 228 of file SparseVector.h.

◆ merge_without_conflict()

template<class IndexT, class ValueT>
idol::SparseVector< IndexT, ValueT > & idol::SparseVector< IndexT, ValueT >::merge_without_conflict ( const SparseVector< IndexT, ValueT > & t_vec)

Definition at line 260 of file SparseVector.h.

◆ operator*=()

template<class IndexT, class ValueT>
idol::SparseVector< IndexT, ValueT > & idol::SparseVector< IndexT, ValueT >::operator*= ( std::conditional_t< std::is_arithmetic_v< ValueT >, ValueT, double > t_scalar)
virtual

Definition at line 208 of file SparseVector.h.

◆ operator+=()

template<class IndexT, class ValueT>
idol::SparseVector< IndexT, ValueT > & idol::SparseVector< IndexT, ValueT >::operator+= ( const SparseVector< IndexT, ValueT > & t_vector)
virtual

Definition at line 239 of file SparseVector.h.

◆ operator-()

template<class IndexT, class ValueT>
idol::SparseVector< IndexT, ValueT > idol::SparseVector< IndexT, ValueT >::operator- ( ) const

Definition at line 151 of file SparseVector.h.

◆ operator-=()

template<class IndexT, class ValueT>
idol::SparseVector< IndexT, ValueT > & idol::SparseVector< IndexT, ValueT >::operator-= ( const SparseVector< IndexT, ValueT > & t_vector)
virtual

Definition at line 184 of file SparseVector.h.

◆ operator/=()

template<class IndexT, class ValueT>
idol::SparseVector< IndexT, ValueT > & idol::SparseVector< IndexT, ValueT >::operator/= ( std::conditional_t< std::is_arithmetic_v< ValueT >, ValueT, double > t_scalar)
virtual

Definition at line 163 of file SparseVector.h.

◆ remove()

template<class IndexT, class ValueT>
void idol::SparseVector< IndexT, ValueT >::remove ( const IndexT & t_index)
inline

Definition at line 119 of file SparseVector.h.

◆ reserve()

template<class IndexT, class ValueT>
void idol::SparseVector< IndexT, ValueT >::reserve ( unsigned int t_capacity)
inline

Definition at line 123 of file SparseVector.h.

◆ set()

template<class IndexT, class ValueT>
void idol::SparseVector< IndexT, ValueT >::set ( const IndexT & t_index,
const ValueT & t_value )

Definition at line 285 of file SparseVector.h.

◆ size()

template<class IndexT, class ValueT>
unsigned int idol::SparseVector< IndexT, ValueT >::size ( ) const
inlinenodiscard

Definition at line 107 of file SparseVector.h.