GiNaCRA  0.6.4
GiNaCRA::Constraint Class Reference

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>

Collaboration diagram for GiNaCRA::Constraint:

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

Detailed Description

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.

Author:
Ulrich Loup
Since:
2011-12-05
Version:
2012-04-17

Definition at line 43 of file Constraint.h.


Constructor & Destructor Documentation

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.

Parameters:
ppolynomial compared
ssign comparing the sign of the polynomial to GiNaCRA::ZERO_SIGN, GiNaCRA::POSITVIE_SIGN, or GiNaCRA::NEGATIVE_SIGN.
vthe variables of the polynomial
negatedif 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.


Member Function Documentation

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.

Parameters:
ppolynomial
vlist of variables
Returns:
v if the check was successful
Exceptions:
invalid_argumentif 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]
Returns:
the polynomial of the constraint

Definition at line 82 of file Constraint.h.

References mPoly.

Referenced by GiNaCRA::operator<<(), and GiNaCRA::operator==().

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.

Parameters:
rtest point
Returns:
false if the constraint was not satisfied by the given point, true otherwise.
Exceptions:
exceptionif 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]
Returns:
the polynomial of the constraint

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]
Returns:
the list of variables of this constraint

Definition at line 98 of file Constraint.h.

References mVariables.

Referenced by GiNaCRA::operator<<().


Field Documentation

Definition at line 124 of file Constraint.h.

Referenced by satisfiedBy().

Definition at line 121 of file Constraint.h.

Referenced by poly(), and satisfiedBy().

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().


The documentation for this class was generated from the following files: