idol
A C++ Framework for Optimization
Loading...
Searching...
No Matches
idol::LinExpr< KeyT, ValueT > Class Template Reference

#include <LinExpr.h>

Inheritance diagram for idol::LinExpr< KeyT, ValueT >:
Inheritance graph
Collaboration diagram for idol::LinExpr< KeyT, ValueT >:
Collaboration graph

Public Types

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

Public Member Functions

 LinExpr (KeyT t_key)
 
 LinExpr (SparseVector< KeyT, ValueT > t_vector)
 
 LinExpr (const ValueT &t_factor, const KeyT &t_key)
 
 LinExpr (ValueT &&t_factor, const KeyT &t_key)
 
 LinExpr (const LinExpr< KeyT, ValueT > &)=default
 
 LinExpr (LinExpr< KeyT, ValueT > &&)=default
 
LinExproperator= (const LinExpr< KeyT, ValueT > &) noexcept=default
 
LinExproperator= (LinExpr< KeyT, ValueT > &&) noexcept=default
 
LinExproperator+= (const LinExpr< KeyT, ValueT > &t_rhs)
 
LinExproperator+= (const KeyT &t_rhs)
 
LinExproperator-= (const LinExpr< KeyT, ValueT > &t_rhs)
 
LinExproperator-= (const KeyT &t_rhs)
 
virtual SparseVectoroperator+= (const SparseVector &t_vector)
 
virtual SparseVectoroperator-= (const SparseVector &t_vector)
 
virtual SparseVectoroperator*= (std::conditional_t< std::is_arithmetic_v< ValueT >, ValueT, double > t_scalar)
 
virtual SparseVectoroperator/= (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 ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
SparseVectormerge_without_conflict (const SparseVector &t_vec)
 

Static Public Attributes

static LinExpr< KeyT, ValueT > Zero {}
 

Detailed Description

template<class KeyT = idol::Var, class ValueT = double>
class idol::LinExpr< KeyT, ValueT >
Template Parameters
KeyTthe class representing keys

Definition at line 28 of file LinExpr.h.

Member Typedef Documentation

◆ const_iterator

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

Definition at line 128 of file SparseVector.h.

◆ iterator

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

Definition at line 127 of file SparseVector.h.

Constructor & Destructor Documentation

◆ LinExpr()

template<class KeyT = idol::Var, class ValueT = double>
idol::LinExpr< KeyT, ValueT >::LinExpr ( SparseVector< KeyT, ValueT >  t_vector)
inline

Definition at line 32 of file LinExpr.h.

Member Function Documentation

◆ begin() [1/2]

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

Definition at line 130 of file SparseVector.h.

◆ begin() [2/2]

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

Definition at line 134 of file SparseVector.h.

◆ cbegin()

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

Definition at line 138 of file SparseVector.h.

◆ cend()

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

Definition at line 140 of file SparseVector.h.

◆ clear()

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

Definition at line 119 of file SparseVector.h.

◆ empty()

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

Definition at line 107 of file SparseVector.h.

◆ end() [1/2]

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

Definition at line 132 of file SparseVector.h.

◆ end() [2/2]

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

Definition at line 136 of file SparseVector.h.

◆ get()

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

Definition at line 271 of file SparseVector.h.

◆ has_index()

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

Definition at line 109 of file SparseVector.h.

◆ is_zero()

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

Definition at line 226 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)
inherited

Definition at line 258 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)
virtualinherited

Definition at line 206 of file SparseVector.h.

◆ operator+=() [1/2]

template<class KeyT , class ValueT >
idol::LinExpr< KeyT, ValueT > & idol::LinExpr< KeyT, ValueT >::operator+= ( const KeyT &  t_rhs)

Definition at line 66 of file LinExpr.h.

◆ operator+=() [2/2]

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

Definition at line 237 of file SparseVector.h.

◆ operator-()

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

Definition at line 149 of file SparseVector.h.

◆ operator-=() [1/3]

template<class KeyT , class ValueT >
idol::LinExpr< KeyT, ValueT > & idol::LinExpr< KeyT, ValueT >::operator-= ( const KeyT &  t_rhs)

Definition at line 54 of file LinExpr.h.

◆ operator-=() [2/3]

template<class KeyT , class ValueT >
idol::LinExpr< KeyT, ValueT > & idol::LinExpr< KeyT, ValueT >::operator-= ( const LinExpr< KeyT, ValueT > &  t_rhs)

Definition at line 60 of file LinExpr.h.

◆ operator-=() [3/3]

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

Definition at line 182 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)
virtualinherited

Definition at line 161 of file SparseVector.h.

◆ remove()

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

Definition at line 117 of file SparseVector.h.

◆ reserve()

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

Definition at line 121 of file SparseVector.h.

◆ set()

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

Definition at line 283 of file SparseVector.h.

◆ size()

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

Definition at line 105 of file SparseVector.h.

Member Data Documentation

◆ Zero

template<class KeyT , class ValueT >
idol::LinExpr< KeyT, ValueT > idol::LinExpr< KeyT, ValueT >::Zero {}
static

Definition at line 48 of file LinExpr.h.