![]() |
aGrUM
0.16.0
|
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. More... | |
std::string | toString () const |
Get the string representation of a calling expression. More... | |
template<typename SCALAR > | |
INLINE LpExpr | multiply (const SCALAR &lhs, const LpCol &rhs) |
template<typename T1 , typename T2 > | |
INLINE LpExpr | lessThan (T1 &&lhs, T2 &&rhs) |
Constructors / Destructors | |
LpExpr () | |
Default constructor. More... | |
LpExpr (const LpExpr &expr) | |
Copy constructor. More... | |
LpExpr (const LpExpr &expr, bool copyLeft, bool copyMiddle, bool copyRight) | |
Copy constructor. More... | |
LpExpr (LpExpr &&expr) | |
Move copy constructor from temporary. More... | |
LpExpr (LpExpr &&expr, bool copyLeft, bool copyMiddle, bool copyRight) | |
Move copy constructor from temporary. More... | |
~LpExpr () | |
Default destructor. More... | |
Assignment operators = | |
LpExpr & | operator= (const LpCol &rhs) |
Assignment operator = with a variable. More... | |
LpExpr & | operator= (const LpExpr &rhs) |
Assignment operator = with another expression, by copy. More... | |
LpExpr & | operator= (LpExpr &&rhs) |
Assignment operator = with another expression, by move. More... | |
template<typename SCALAR > | |
LpExpr & | operator= (const SCALAR &rhs) |
Assignment operator = with a scalar. More... | |
Compound assignment operators += | |
LpExpr & | operator+= (const LpCol &rhs) |
Compound assignment operator += with a variable. More... | |
LpExpr & | operator+= (const LpExpr &rhs) |
Compound assignment operator += with another expression. More... | |
LpExpr & | operator+= (LpExpr &&rhs) |
Compound assignment operator += with another temporary expression. More... | |
template<typename T > | |
LpExpr & | operator+= (const T &rhs) |
Compound assignment operator += with a scalar. More... | |
Compound assignment operators -= | |
LpExpr & | operator-= (const LpCol &rhs) |
Compound assignment operator -= with a variable. More... | |
LpExpr & | operator-= (const LpExpr &rhs) |
Compound assignment operator -= with another expression. More... | |
template<typename T > | |
LpExpr & | operator-= (const T &rhs) |
Compound assignment operator -= with a salar. More... | |
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) |
Friends | |
class | LpRow |
template<typename GUM_SCALAR > | |
class | LpInterface |
Class representing a linear expression.
Definition at line 210 of file LpInterface.h.
gum::credal::lp::LpExpr::LpExpr | ( | ) |
Default constructor.
class LpExpr
Definition at line 70 of file LpInterface_tpl.h.
gum::credal::lp::LpExpr::LpExpr | ( | const LpExpr & | expr | ) |
Copy constructor.
expr | The constant reference to the expression to copy. |
Definition at line 78 of file LpInterface_tpl.h.
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 88 of file LpInterface_tpl.h.
References __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 120 of file LpInterface_tpl.h.
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 133 of file LpInterface_tpl.h.
References __ileft, __imiddle, __iright, __lCoeffs, __lValue, __mCoeffs, __mValue, __rCoeffs, __rValue, and gum::credal::lp::swap().
gum::credal::lp::LpExpr::~LpExpr | ( | ) |
Default destructor.
Definition at line 165 of file LpInterface_tpl.h.
References __lCoeffs, __mCoeffs, and __rCoeffs.
|
inlineprivate |
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 341 of file LpInterface_tpl.h.
References __ileft, __imiddle, __iright, __lCoeffs, __mCoeffs, __rCoeffs, and GUM_ERROR.
Referenced by lessThan().
|
inlineprivate |
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 357 of file LpInterface_tpl.h.
References __ileft, __imiddle, __iright, __lCoeffs, __lValue, __mCoeffs, __mValue, __rCoeffs, __rValue, and GUM_ERROR.
|
inlineprivate |
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 438 of file LpInterface_tpl.h.
References __ileft, __imiddle, __iright, __lCoeffs, __lValue, __mCoeffs, __mValue, __rCoeffs, __rValue, GUM_ERROR, and gum::credal::lp::swap().
|
inlineprivate |
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 528 of file LpInterface_tpl.h.
References __ileft, __imiddle, __iright, __lValue, __mValue, __rValue, and GUM_ERROR.
void gum::credal::lp::LpExpr::clear | ( | ) |
Clear all data of the calling expression as if it was constructed.
Definition at line 544 of file LpInterface_tpl.h.
References __ileft, __imiddle, __iright, __lCoeffs, __lValue, __mCoeffs, __mValue, __rCoeffs, and __rValue.
Referenced by operator=().
|
static |
INLINE LpExpr gum::credal::lp::LpExpr::lessThan | ( | T1 && | lhs, |
T2 && | rhs | ||
) |
Definition at line 1172 of file LpInterface_tpl.h.
References __addSide().
INLINE LpExpr gum::credal::lp::LpExpr::multiply | ( | const SCALAR & | lhs, |
const LpCol & | rhs | ||
) |
Compound assignment operator +=
with a variable.
rhs | the constant reference to the variable to add to the calling expression. |
Definition at line 230 of file LpInterface_tpl.h.
References __ileft, __imiddle, __iright, __mCoeffs, and GUM_ERROR.
Compound assignment operator +=
with another expression.
rhs | the constant reference to the expression to add to the calling expression. |
Definition at line 242 of file LpInterface_tpl.h.
References __ileft, __imiddle, __iright, __mCoeffs, __mValue, and GUM_ERROR.
Compound assignment operator +=
with another temporary expression.
rhs | the temporary expression to add to the calling expression. |
Definition at line 258 of file LpInterface_tpl.h.
References __ileft, __imiddle, __iright, __mCoeffs, __mValue, GUM_ERROR, and gum::credal::lp::swap().
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 283 of file LpInterface_tpl.h.
References __ileft, __imiddle, __iright, __mValue, and GUM_ERROR.
Compound assignment operator -=
with a variable.
rhs | the constant reference to the variable to substract from the calling expression. |
Definition at line 295 of file LpInterface_tpl.h.
References __ileft, __imiddle, __iright, __mCoeffs, and GUM_ERROR.
Compound assignment operator -=
with another expression.
rhs | the constant reference to the expression to substract from the calling expression. |
Definition at line 307 of file LpInterface_tpl.h.
References __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 substract from the calling expression. |
Definition at line 324 of file LpInterface_tpl.h.
References __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 173 of file LpInterface_tpl.h.
References __imiddle, __mCoeffs, and clear().
Assignment operator =
with another expression, by copy.
rhs | the constant reference to the expression to copy. |
Definition at line 182 of file LpInterface_tpl.h.
References __ileft, __imiddle, __iright, __lCoeffs, __lValue, __mCoeffs, __mValue, __rCoeffs, and __rValue.
Assignment operator =
with another expression, by move.
rhs | the expression to move to this. |
Definition at line 201 of file LpInterface_tpl.h.
References __ileft, __imiddle, __iright, __lCoeffs, __lValue, __mCoeffs, __mValue, __rCoeffs, __rValue, and gum::credal::lp::swap().
LpExpr & gum::credal::lp::LpExpr::operator= | ( | const SCALAR & | rhs | ) |
Assignment operator =
with a scalar.
SCALAR | A scalar type ( integer or float ( any precision ) ). |
rhs | the constant reference to the scalar to form an expression with. |
Definition at line 221 of file LpInterface_tpl.h.
References __imiddle, __mValue, and clear().
std::string gum::credal::lp::LpExpr::toString | ( | ) | const |
Get the string representation of a calling expression.
Definition at line 558 of file LpInterface_tpl.h.
References __lCoeffs, __lValue, __mCoeffs, __mValue, __rCoeffs, and __rValue.
Referenced by gum::credal::lp::LpInterface< GUM_SCALAR >::addRow(), gum::credal::lp::LpRow::LpRow(), and gum::credal::lp::operator<<().
|
friend |
Definition at line 213 of file LpInterface.h.
|
friend |
Definition at line 211 of file LpInterface.h.
|
private |
True
if this expression has a non-empty left side L : L <= M <= R .
False
otherwise.
Definition at line 415 of file LpInterface.h.
Referenced by __addSide(), gum::credal::lp::LpInterface< GUM_SCALAR >::addRow(), clear(), LpExpr(), gum::credal::lp::LpRow::LpRow(), 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 419 of file LpInterface.h.
Referenced by __addSide(), gum::credal::lp::LpInterface< GUM_SCALAR >::addRow(), clear(), LpExpr(), multiply(), operator+=(), operator-=(), and operator=().
|
private |
True
if this expression has a non-empty right side R : L <= M <= R .
False
otherwise.
Definition at line 423 of file LpInterface.h.
Referenced by __addSide(), gum::credal::lp::LpInterface< GUM_SCALAR >::addRow(), clear(), LpExpr(), gum::credal::lp::LpRow::LpRow(), 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 435 of file LpInterface.h.
Referenced by __addSide(), clear(), LpExpr(), gum::credal::lp::LpRow::LpRow(), operator=(), toString(), and ~LpExpr().
|
private |
The constant on the left side L : L <= M <= R.
Definition at line 426 of file LpInterface.h.
Referenced by __addSide(), clear(), LpExpr(), gum::credal::lp::LpRow::LpRow(), 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 439 of file LpInterface.h.
Referenced by __addSide(), gum::credal::lp::LpInterface< GUM_SCALAR >::addRow(), clear(), LpExpr(), gum::credal::lp::LpRow::LpRow(), multiply(), operator+=(), operator-=(), operator=(), toString(), and ~LpExpr().
|
private |
The constant on the middle side L : L <= M <= R.
Definition at line 428 of file LpInterface.h.
Referenced by __addSide(), gum::credal::lp::LpInterface< GUM_SCALAR >::addRow(), clear(), LpExpr(), gum::credal::lp::LpRow::LpRow(), 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 443 of file LpInterface.h.
Referenced by __addSide(), clear(), LpExpr(), gum::credal::lp::LpRow::LpRow(), operator=(), toString(), and ~LpExpr().
|
private |
The constant on the right side L : L <= M <= R.
Definition at line 430 of file LpInterface.h.
Referenced by __addSide(), clear(), LpExpr(), gum::credal::lp::LpRow::LpRow(), operator=(), and toString().