GiNaCRA
0.6.4
|
A class representing a condition on a Constraint as to whether its sign is negative (GiNaCRA::NEGATIVE_SIGN), positive (GiNaCRA::POSITVIE_SIGN) or zero (GiNaCRA::ZERO_SIGN). More...
#include <Constraint.h>
Public Member Functions | |
Constraint () | |
Standard constructor. | |
Constraint (const Polynomial &p, const GiNaC::sign s, const vector< symbol > v, bool negated=false) | |
Constructs a constraint represented as a sign condition p.sgn(...) == s or a negated sign condition p.sgn(...) != s . | |
const Polynomial | poly () const |
const GiNaC::sign | sign () const |
const vector< symbol > | variables () const |
bool | satisfiedBy (const RealAlgebraicPoint &r) const |
Test if the given point satisfies this constraint. | |
Private Member Functions | |
const vector< symbol > | checkVariables (const Polynomial &p, const vector< symbol > &v) const throw ( invalid_argument ) |
Verifies whether this constraint is solely constructed over the given variables. | |
Private Attributes | |
Polynomial | mPoly |
GiNaC::sign | mSign |
vector< symbol > | mVariables |
bool | mNegated |
A class representing a condition on a Constraint as to whether its sign is negative (GiNaCRA::NEGATIVE_SIGN), positive (GiNaCRA::POSITVIE_SIGN) or zero (GiNaCRA::ZERO_SIGN).
This class is serving as an abstract superclass of both multivariate and univariate constraints.
Definition at line 43 of file Constraint.h.
GiNaCRA::Constraint::Constraint | ( | ) | [inline] |
Standard constructor.
Definition at line 54 of file Constraint.h.
GiNaCRA::Constraint::Constraint | ( | const Polynomial & | p, |
const GiNaC::sign | s, | ||
const vector< symbol > | v, | ||
bool | negated = false |
||
) | [inline] |
Constructs a constraint represented as a sign condition p.sgn(...) == s
or a negated sign condition p.sgn(...) != s
.
p | polynomial compared |
s | sign comparing the sign of the polynomial to GiNaCRA::ZERO_SIGN, GiNaCRA::POSITVIE_SIGN, or GiNaCRA::NEGATIVE_SIGN. |
v | the variables of the polynomial |
negated | if set to true , satisfiedBy checks the negation of the specified sign condition. If otherwise false is specified (standard value), satisfiedBy checks the sign condition as specified. |
Definition at line 68 of file Constraint.h.
const vector< symbol > GiNaCRA::Constraint::checkVariables | ( | const Polynomial & | p, |
const vector< symbol > & | v | ||
) | const throw ( invalid_argument ) [private] |
Verifies whether this constraint is solely constructed over the given variables.
p | polynomial |
v | list of variables |
invalid_argument | if there is another variable in the constraint so it cannot be checked for satisfiability |
Definition at line 107 of file Constraint.cpp.
References GiNaC::isolateByVariables().
const Polynomial GiNaCRA::Constraint::poly | ( | ) | const [inline] |
Definition at line 82 of file Constraint.h.
References mPoly.
Referenced by GiNaCRA::operator<<(), and GiNaCRA::operator==().
bool GiNaCRA::Constraint::satisfiedBy | ( | const RealAlgebraicPoint & | r | ) | const |
Test if the given point satisfies this constraint.
The variables of this constraint are substituted by the components of r in ascending order until all variables are substituted, even if r is larger.
r | test point |
exception | if the point has a too small dimension |
Definition at line 56 of file Constraint.cpp.
References GiNaCRA::RealAlgebraicPoint::dim(), GiNaCRA::RealAlgebraicNumberFactory::evaluateIR(), mNegated, mPoly, mSign, mVariables, and GiNaC::sgn().
const GiNaC::sign GiNaCRA::Constraint::sign | ( | ) | const [inline] |
Definition at line 90 of file Constraint.h.
References mSign.
Referenced by GiNaCRA::operator<<(), and GiNaCRA::operator==().
const vector<symbol> GiNaCRA::Constraint::variables | ( | ) | const [inline] |
Definition at line 98 of file Constraint.h.
References mVariables.
Referenced by GiNaCRA::operator<<().
bool GiNaCRA::Constraint::mNegated [private] |
Definition at line 124 of file Constraint.h.
Referenced by satisfiedBy().
Polynomial GiNaCRA::Constraint::mPoly [private] |
Definition at line 121 of file Constraint.h.
Referenced by poly(), and satisfiedBy().
GiNaC::sign GiNaCRA::Constraint::mSign [private] |
Definition at line 122 of file Constraint.h.
Referenced by satisfiedBy(), and sign().
vector<symbol> GiNaCRA::Constraint::mVariables [private] |
Definition at line 123 of file Constraint.h.
Referenced by satisfiedBy(), and variables().