Represents a linear combination of variables plus a constant term.
More...
#include <lin_expr.hpp>
|
| LinExpr ()=default |
| Sets constant term and linear combination to zero.
|
|
template<typename Arithmetic , std::enable_if_t< std::is_arithmetic_v< Arithmetic >, bool > = true> |
| LinExpr (Arithmetic constant) |
| Creates a linear expression with no variables.
|
|
| LinExpr (const Var &var) |
| Creates a linear expression with zero as constant the given variable with coefficient one.
|
|
double | getConstant () const |
| Returns the constant term of the expression.
|
|
LinExpr & | operator*= (double factor) |
| Multiply all coefficients.
|
|
LinExpr & | operator+= (const LinExpr &expr) |
| Add another linear expression to this.
|
|
LinExpr & | operator-= (const LinExpr &expr) |
| Subtract another expression from this.
|
|
Represents a linear combination of variables plus a constant term.
- Since
- 1.0.0
Definition at line 13 of file lin_expr.hpp.
◆ LinExpr() [1/3]
scippp::LinExpr::LinExpr |
( |
| ) |
|
|
default |
Sets constant term and linear combination to zero.
- Since
- 1.0.0
◆ LinExpr() [2/3]
template<typename Arithmetic , std::enable_if_t< std::is_arithmetic_v< Arithmetic >, bool > = true>
scippp::LinExpr::LinExpr |
( |
Arithmetic |
constant | ) |
|
|
inline |
Creates a linear expression with no variables.
- Since
- 1.0.0
- Template Parameters
-
Arithmetic | type that will be casted to double . |
- Warning
Arithmetic
is casted to double
without creating a narrowing warning!
- Parameters
-
constant | Constant term to set. |
Definition at line 37 of file lin_expr.hpp.
◆ LinExpr() [3/3]
scippp::LinExpr::LinExpr |
( |
const Var & |
var | ) |
|
Creates a linear expression with zero as constant the given variable with coefficient one.
- Since
- 1.0.0
- Parameters
-
var | Variable to store with coefficient one in the expression. |
◆ getConstant()
double scippp::LinExpr::getConstant |
( |
| ) |
const |
Returns the constant term of the expression.
- Since
- 1.0.0
- Returns
- the constant term of the expression.
◆ operator*=()
LinExpr & scippp::LinExpr::operator*= |
( |
double |
factor | ) |
|
Multiply all coefficients.
- Since
- 1.0.0
- Parameters
-
factor | to multiply all coefficients with. |
- Returns
- Scaled expression.
◆ operator+=()
Add another linear expression to this.
- Since
- 1.0.0
- Parameters
-
expr | Other linear expression to add. |
- Returns
- Updated sum.
◆ operator-=()
Subtract another expression from this.
- Since
- 1.0.0
- Parameters
-
expr | Right-hand-side of the subtraction. |
- Returns
- Updated expression.
◆ Model
The documentation for this class was generated from the following file: