![]() |
aGrUM 3.2.0
a C++ library for (probabilistic) graphical models
|
Class representing a linear expression. More...
#include <agrum/CN/LpInterface.h>
Public Member Functions | |
| void | clear () |
| Clear all data of the calling expression as if it was constructed. | |
| std::string | toString () const |
| Get the string representation of a calling expression. | |
Constructors / Destructors | |
| LpExpr () | |
| Default constructor. | |
| LpExpr (const LpExpr &expr) | |
| Copy constructor. | |
| LpExpr (const LpExpr &expr, bool copyLeft, bool copyMiddle, bool copyRight) | |
| Copy constructor. | |
| LpExpr (LpExpr &&expr) | |
| Move copy constructor from temporary. | |
| LpExpr (LpExpr &&expr, bool copyLeft, bool copyMiddle, bool copyRight) | |
| Move copy constructor from temporary. | |
| ~LpExpr () | |
| Default destructor. | |
Assignment operators = | |
| LpExpr & | operator= (const LpCol &rhs) |
Assignment operator = with a variable. | |
| LpExpr & | operator= (const LpExpr &rhs) |
Assignment operator = with another expression, by copy. | |
| LpExpr & | operator= (LpExpr &&rhs) |
Assignment operator = with another expression, by move. | |
| template<typename SCALAR> | |
| LpExpr & | operator= (const SCALAR &rhs) |
Assignment operator = with a scalar. | |
Compound assignment operators += | |
| LpExpr & | operator+= (const LpCol &rhs) |
Compound assignment operator += with a variable. | |
| LpExpr & | operator+= (const LpExpr &rhs) |
Compound assignment operator += with another expression. | |
| LpExpr & | operator+= (LpExpr &&rhs) |
Compound assignment operator += with another temporary expression. | |
| template<typename T> | |
| LpExpr & | operator+= (const T &rhs) |
Compound assignment operator += with a scalar. | |
Compound assignment operators -= | |
| LpExpr & | operator-= (const LpCol &rhs) |
Compound assignment operator -= with a variable. | |
| LpExpr & | operator-= (const LpExpr &rhs) |
Compound assignment operator -= with another expression. | |
| template<typename T> | |
| LpExpr & | operator-= (const T &rhs) |
Compound assignment operator -= with a salar. | |
Static Public Member Functions | |
Helper static methods for operations | |
| template<typename T1, typename T2> | |
| static LpExpr | lessThan (T1 &&lhs, T2 &&rhs) |
| template<typename SCALAR> | |
| static LpExpr | multiply (const SCALAR &lhs, const LpCol &rhs) |
Private Member Functions | |
Used by static method LpExpr::LessThan<T1,T2> and by operator | |
<= | |
| void | _addSide_ (const LpCol &from) |
| Set the side of the calling expression, from LEFT TO RIGHT : L <= M <= R. | |
| void | _addSide_ (const LpExpr &from) |
| Copy an expression to a side of the calling expression, from LEFT TO RIGHT : L <= M <= R. | |
| void | _addSide_ (LpExpr &&from) |
| Move an expression to a side of the calling expression, from LEFT TO RIGHT : L <= M <= R. | |
| template<typename SCALAR> | |
| void | _addSide_ (const SCALAR &from) |
| Set the side of the calling expression, from LEFT TO RIGHT : L <= M <= R. | |
Private Attributes | |
| bool | _ileft_ |
True if this expression has a non-empty left side L : L <= M <= R . | |
| bool | _imiddle_ |
True if this expression has a non-empty middle side M ( the default ) : L <= M <= R . | |
| bool | _iright_ |
True if this expression has a non-empty right side R : L <= M <= R . | |
| double | _lValue_ |
| The constant on the left side L : L <= M <= R. | |
| double | _mValue_ |
| The constant on the middle side L : L <= M <= R. | |
| double | _rValue_ |
| The constant on the right side L : L <= M <= R. | |
| HashTable< LpCol, double > * | _lCoeffs_ |
| The coefficients of each variable on the left side L : L <= M <= R. | |
| HashTable< LpCol, double > * | _mCoeffs_ |
| The coefficients of each variable on the middle side L : L <= M <= R. | |
| HashTable< LpCol, double > * | _rCoeffs_ |
| The coefficients of each variable on the right side L : L <= M <= R. | |
Friends | |
| class | LpRow |
| template<GUM_Numeric GUM_SCALAR> | |
| class | LpInterface |
Class representing a linear expression.
Definition at line 229 of file LpInterface.h.
| gum::credal::lp::LpExpr::LpExpr | ( | ) |
Default constructor.
class LpExpr
Definition at line 83 of file LpInterface.cpp.
References LpExpr(), _ileft_, _imiddle_, _iright_, _lCoeffs_, _lValue_, _mCoeffs_, _mValue_, _rCoeffs_, and _rValue_.
Referenced by LpExpr(), LpExpr(), LpExpr(), LpExpr(), LpExpr(), ~LpExpr(), _addSide_(), _addSide_(), lessThan(), LpInterface, multiply(), operator+=(), operator+=(), operator+=(), operator+=(), operator-=(), operator-=(), operator-=(), operator=(), operator=(), operator=(), and operator=().
| gum::credal::lp::LpExpr::LpExpr | ( | const LpExpr & | expr | ) |
Copy constructor.
| expr | The constant reference to the expression to copy. |
Definition at line 90 of file LpInterface.cpp.
References LpExpr(), _ileft_, _imiddle_, _iright_, _lCoeffs_, _lValue_, _mCoeffs_, _mValue_, _rCoeffs_, and _rValue_.
| gum::credal::lp::LpExpr::LpExpr | ( | const LpExpr & | expr, |
| bool | copyLeft, | ||
| bool | copyMiddle, | ||
| bool | copyRight ) |
Copy constructor.
Makes a ( partial ) copy.
| expr | The constant reference to the expression to copy. |
| copyLeft | True if we want to copy left side of expr, False otherwise. |
| copyMiddle | True if we want to copy middle side of expr, False otherwise. |
| copyRight | True if we want to copy right side of expr, False otherwise. |
Definition at line 99 of file LpInterface.cpp.
References gum::HashTable< Key, Val >::HashTable(), LpExpr(), _ileft_, _imiddle_, _iright_, _lCoeffs_, _lValue_, _mCoeffs_, _mValue_, _rCoeffs_, and _rValue_.
| gum::credal::lp::LpExpr::LpExpr | ( | LpExpr && | expr | ) |
Move copy constructor from temporary.
Swap ressources between the temporary expr and the caller instead of copying the temporary.
| expr | The temporary expression to move to this. |
Definition at line 123 of file LpInterface.cpp.
References LpExpr(), _ileft_, _imiddle_, _iright_, _lCoeffs_, _lValue_, _mCoeffs_, _mValue_, _rCoeffs_, and _rValue_.
Move copy constructor from temporary.
Makes ( partial ) moves.
| expr | The temporary expression to ( partially ) move to this. |
| copyLeft | True if we want to copy left side of expr, False otherwise. |
| copyMiddle | True if we want to copy middle side of expr, False otherwise. |
| copyRight | True if we want to copy right side of expr, False otherwise. |
Definition at line 134 of file LpInterface.cpp.
References gum::HashTable< Key, Val >::HashTable(), LpExpr(), _ileft_, _imiddle_, _iright_, _lCoeffs_, _lValue_, _mCoeffs_, _mValue_, _rCoeffs_, _rValue_, and gum::credal::lp::swap().
| gum::credal::lp::LpExpr::~LpExpr | ( | ) |
|
private |
Set the side of the calling expression, from LEFT TO RIGHT : L <= M <= R.
| from | the constant reference to the variable ( the side ) to put on the first empty side met, starting at left. |
Definition at line 287 of file LpInterface.cpp.
References _ileft_, _imiddle_, _iright_, _lCoeffs_, _mCoeffs_, _rCoeffs_, and GUM_ERROR.
Referenced by lessThan().
|
private |
Copy an expression to a side of the calling expression, from LEFT TO RIGHT : L <= M <= R.
| from | the constant reference to the expression ( the side ) to copy on the first empty side met, starting at left. |
Definition at line 303 of file LpInterface.cpp.
References LpExpr(), _ileft_, _imiddle_, _iright_, _lCoeffs_, _lValue_, _mCoeffs_, _mValue_, _rCoeffs_, _rValue_, and GUM_ERROR.
|
private |
Set the side of the calling expression, from LEFT TO RIGHT : L <= M <= R.
| SCALAR | A scalar type ( integer or float ( any precision ) ). |
| from | the constant reference to the scalar ( the side ) to put on the first empty side met, starting at left. |
Definition at line 90 of file LpInterface_tpl.h.
References _ileft_, _imiddle_, _iright_, _lValue_, _mValue_, _rValue_, and GUM_ERROR.
|
private |
Move an expression to a side of the calling expression, from LEFT TO RIGHT : L <= M <= R.
| from | the expression ( the side ) to move on the first empty side met, starting at left. |
Definition at line 384 of file LpInterface.cpp.
References LpExpr(), _ileft_, _imiddle_, _iright_, _lCoeffs_, _lValue_, _mCoeffs_, _mValue_, _rCoeffs_, _rValue_, GUM_ERROR, and gum::credal::lp::swap().
| void gum::credal::lp::LpExpr::clear | ( | ) |
Clear all data of the calling expression as if it was constructed.
Definition at line 473 of file LpInterface.cpp.
References _ileft_, _imiddle_, _iright_, _lCoeffs_, _lValue_, _mCoeffs_, _mValue_, _rCoeffs_, and _rValue_.
Referenced by LpInterface, operator=(), and operator=().
|
static |
Definition at line 514 of file LpInterface_tpl.h.
References LpExpr(), and _addSide_().
Referenced by LpInterface, gum::credal::lp::operator<=(), gum::credal::lp::operator<=(), gum::credal::lp::operator<=(), gum::credal::lp::operator<=(), gum::credal::lp::operator<=(), gum::credal::lp::operator<=(), gum::credal::lp::operator<=(), and gum::credal::lp::operator<=().
|
static |
Definition at line 495 of file LpInterface_tpl.h.
References LpExpr(), _imiddle_, and _mCoeffs_.
Referenced by LpInterface, gum::credal::lp::operator*(), and gum::credal::lp::operator*().
Compound assignment operator += with a variable.
| rhs | the constant reference to the variable to add to the calling expression. |
Definition at line 213 of file LpInterface.cpp.
References LpExpr(), _ileft_, _imiddle_, _iright_, _mCoeffs_, and GUM_ERROR.
Referenced by LpInterface.
Compound assignment operator += with another expression.
| rhs | the constant reference to the expression to add to the calling expression. |
Definition at line 224 of file LpInterface.cpp.
References LpExpr(), _ileft_, _imiddle_, _iright_, _mCoeffs_, _mValue_, and GUM_ERROR.
| LpExpr & gum::credal::lp::LpExpr::operator+= | ( | const T & | rhs | ) |
Compound assignment operator += with a scalar.
| SCALAR | A scalar type ( integer or float ( any precision ) ). |
| rhs | the constant reference to the scalar to add to the calling expression. |
Definition at line 66 of file LpInterface_tpl.h.
References LpExpr(), _ileft_, _imiddle_, _iright_, _mValue_, and GUM_ERROR.
Compound assignment operator += with another temporary expression.
| rhs | the temporary expression to add to the calling expression. |
Definition at line 240 of file LpInterface.cpp.
References LpExpr(), _ileft_, _imiddle_, _iright_, _mCoeffs_, _mValue_, GUM_ERROR, and gum::credal::lp::swap().
Compound assignment operator -= with a variable.
| rhs | the constant reference to the variable to subtract from the calling expression. |
Definition at line 261 of file LpInterface.cpp.
References LpExpr(), _ileft_, _imiddle_, _iright_, _mCoeffs_, and GUM_ERROR.
Referenced by LpInterface.
Compound assignment operator -= with another expression.
| rhs | the constant reference to the expression to subtract from the calling expression. |
Definition at line 272 of file LpInterface.cpp.
References LpExpr(), _ileft_, _imiddle_, _iright_, _mCoeffs_, _mValue_, and GUM_ERROR.
| LpExpr & gum::credal::lp::LpExpr::operator-= | ( | const T & | rhs | ) |
Compound assignment operator -= with a salar.
| SCALAR | A scalar type ( integer or float ( any precision ) ). |
| rhs | the constant reference to the scalar to subtract from the calling expression. |
Definition at line 78 of file LpInterface_tpl.h.
References LpExpr(), _ileft_, _imiddle_, _iright_, _mValue_, and GUM_ERROR.
Assignment operator = with a variable.
| rhs | the constant reference to the variable to form an expression with. |
Definition at line 166 of file LpInterface.cpp.
References LpExpr(), _imiddle_, _mCoeffs_, and clear().
Referenced by LpInterface.
Assignment operator = with another expression, by copy.
| rhs | the constant reference to the expression to copy. |
Definition at line 175 of file LpInterface.cpp.
References LpExpr(), _ileft_, _imiddle_, _iright_, _lCoeffs_, _lValue_, _mCoeffs_, _mValue_, _rCoeffs_, and _rValue_.
| LpExpr & gum::credal::lp::LpExpr::operator= | ( | const SCALAR & | rhs | ) |
Assignment operator = with a scalar.
class LpExpr
| SCALAR | A scalar type ( integer or float ( any precision ) ). |
| rhs | the constant reference to the scalar to form an expression with. |
Definition at line 56 of file LpInterface_tpl.h.
References LpExpr(), _imiddle_, _mValue_, and clear().
Assignment operator = with another expression, by move.
| rhs | the expression to move to this. |
Definition at line 194 of file LpInterface.cpp.
References LpExpr(), _ileft_, _imiddle_, _iright_, _lCoeffs_, _lValue_, _mCoeffs_, _mValue_, _rCoeffs_, _rValue_, and gum::credal::lp::swap().
| std::string gum::credal::lp::LpExpr::toString | ( | ) | const |
Get the string representation of a calling expression.
Definition at line 487 of file LpInterface.cpp.
References _lCoeffs_, _lValue_, _mCoeffs_, _mValue_, _rCoeffs_, and _rValue_.
Referenced by gum::credal::lp::LpInterface< GUM_SCALAR >::addRow(), and LpInterface.
|
friend |
Definition at line 232 of file LpInterface.h.
References LpExpr(), clear(), lessThan(), LpInterface, multiply(), operator+=(), operator-=(), operator=(), and toString().
Referenced by LpInterface.
|
friend |
|
private |
True if this expression has a non-empty left side L : L <= M <= R .
False otherwise.
Definition at line 435 of file LpInterface.h.
Referenced by LpExpr(), LpExpr(), LpExpr(), LpExpr(), LpExpr(), gum::credal::lp::LpRow::LpRow(), _addSide_(), _addSide_(), _addSide_(), _addSide_(), gum::credal::lp::LpInterface< GUM_SCALAR >::addRow(), clear(), operator+=(), operator+=(), operator+=(), operator+=(), operator-=(), operator-=(), operator-=(), operator=(), and operator=().
|
private |
True if this expression has a non-empty middle side M ( the default ) : L <= M <= R .
False otherwise.
Definition at line 439 of file LpInterface.h.
Referenced by LpExpr(), LpExpr(), LpExpr(), LpExpr(), LpExpr(), _addSide_(), _addSide_(), _addSide_(), _addSide_(), gum::credal::lp::LpInterface< GUM_SCALAR >::addRow(), clear(), multiply(), operator+=(), operator+=(), operator+=(), operator+=(), operator-=(), operator-=(), operator-=(), operator=(), operator=(), operator=(), and operator=().
|
private |
True if this expression has a non-empty right side R : L <= M <= R .
False otherwise.
Definition at line 443 of file LpInterface.h.
Referenced by LpExpr(), LpExpr(), LpExpr(), LpExpr(), LpExpr(), gum::credal::lp::LpRow::LpRow(), _addSide_(), _addSide_(), _addSide_(), _addSide_(), gum::credal::lp::LpInterface< GUM_SCALAR >::addRow(), clear(), operator+=(), operator+=(), operator+=(), operator+=(), operator-=(), operator-=(), operator-=(), operator=(), and operator=().
The coefficients of each variable on the left side L : L <= M <= R.
If a variable is not present, it's coefficient is 0.
Definition at line 455 of file LpInterface.h.
Referenced by LpExpr(), LpExpr(), LpExpr(), LpExpr(), LpExpr(), ~LpExpr(), _addSide_(), _addSide_(), _addSide_(), clear(), operator=(), operator=(), and toString().
|
private |
The constant on the left side L : L <= M <= R.
Definition at line 446 of file LpInterface.h.
Referenced by LpExpr(), LpExpr(), LpExpr(), LpExpr(), LpExpr(), gum::credal::lp::LpRow::LpRow(), _addSide_(), _addSide_(), _addSide_(), clear(), operator=(), operator=(), and toString().
The coefficients of each variable on the middle side L : L <= M <= R.
If a variable is not present, it's coefficient is 0.
Definition at line 459 of file LpInterface.h.
Referenced by LpExpr(), LpExpr(), LpExpr(), LpExpr(), LpExpr(), ~LpExpr(), _addSide_(), _addSide_(), _addSide_(), gum::credal::lp::LpInterface< GUM_SCALAR >::addRow(), clear(), multiply(), operator+=(), operator+=(), operator+=(), operator-=(), operator-=(), operator=(), operator=(), operator=(), and toString().
|
private |
The constant on the middle side L : L <= M <= R.
Definition at line 448 of file LpInterface.h.
Referenced by LpExpr(), LpExpr(), LpExpr(), LpExpr(), LpExpr(), gum::credal::lp::LpRow::LpRow(), _addSide_(), _addSide_(), _addSide_(), gum::credal::lp::LpInterface< GUM_SCALAR >::addRow(), clear(), operator+=(), operator+=(), operator+=(), operator-=(), operator-=(), operator=(), operator=(), operator=(), and toString().
The coefficients of each variable on the right side L : L <= M <= R.
If a variable is not present, it's coefficient is 0.
Definition at line 463 of file LpInterface.h.
Referenced by LpExpr(), LpExpr(), LpExpr(), LpExpr(), LpExpr(), ~LpExpr(), _addSide_(), _addSide_(), _addSide_(), clear(), operator=(), operator=(), and toString().
|
private |
The constant on the right side L : L <= M <= R.
Definition at line 450 of file LpInterface.h.
Referenced by LpExpr(), LpExpr(), LpExpr(), LpExpr(), LpExpr(), _addSide_(), _addSide_(), _addSide_(), clear(), operator=(), operator=(), and toString().