This data structure represents a column of the matrix, thas is it strores a linear expression of the dual variables (Rows).
There are several ways to access and modify the contents of this container.
or you can also iterate through its elements.
(This code computes the sum of all coefficients).
double
's) and variables (Rows) directly convert to an DualExpr and the usual linear operations are defined, so #include <lemon/lp_base.h>
Classes | |
class | CoeffIt |
Iterator over the expression. More... | |
class | ConstCoeffIt |
Iterator over the expression. More... | |
Public Types | |
typedef LpBase::Row | Key |
The key type of the expression. | |
typedef LpBase::Value | Value |
The value type of the expression. | |
Public Member Functions | |
DualExpr () | |
Default constructor. More... | |
DualExpr (const Row &r) | |
Construct an expression from a row. More... | |
Value | operator[] (const Row &r) const |
Returns the coefficient of the row. | |
Value & | operator[] (const Row &r) |
Returns the coefficient of the row. | |
void | set (const Row &r, const Value &v) |
Sets the coefficient of the row. | |
void | simplify (Value epsilon=0.0) |
Removes the coefficients which's absolute value does not exceed epsilon . | |
void | clear () |
Sets all coefficients to 0. | |
DualExpr & | operator+= (const DualExpr &e) |
Compound assignment. | |
DualExpr & | operator-= (const DualExpr &e) |
Compound assignment. | |
DualExpr & | operator*= (const Value &v) |
Multiply with a constant. | |
DualExpr & | operator/= (const Value &v) |
Division with a constant. | |
Related Functions | |
(Note that these are not member functions.) | |
LpBase::DualExpr | operator+ (const LpBase::DualExpr &a, const LpBase::DualExpr &b) |
Addition. | |
LpBase::DualExpr | operator- (const LpBase::DualExpr &a, const LpBase::DualExpr &b) |
Substraction. | |
LpBase::DualExpr | operator* (const LpBase::DualExpr &a, const LpBase::Value &b) |
Multiply with constant. | |
LpBase::DualExpr | operator* (const LpBase::Value &a, const LpBase::DualExpr &b) |
Multiply with constant. | |
LpBase::DualExpr | operator/ (const LpBase::DualExpr &a, const LpBase::Value &b) |
Divide with constant. | |
|
inline |
Construct an empty expression, the coefficients are initialized to zero.