#include <ncompconstraint.h>
Public Member Functions | |
NCompConstraint () | |
Creates a new constraint with an empty set of coordinate positions and a non-zero coordinate cap of zero. | |
NCompConstraint (unsigned newMaxNonZero) | |
Creates a new constraint with an empty set of coordinate positions and the given non-zero coordinate cap. | |
const std::set < unsigned > & | getCoordinates () const |
Returns the set of coordinate positions under consideration by this constraint. | |
std::set< unsigned > & | getCoordinates () |
Returns the set of coordinate positions under consideration by this constraint. | |
unsigned | getMaxNonZero () const |
Returns the non-zero coordinate cap for this constraint. | |
void | setMaxNonZero (unsigned newMaxNonZero) |
Sets the non-zero coordinate cap for this constraint. | |
template<class T> | |
bool | isSatisfied (const NVector< T > &first, const NVector< T > &second) const |
Determines whether the given pair of vectors satisfies this constraint. | |
template<class T> | |
bool | isSatisfied (const NVector< T > &v) const |
Determines whether the given vector satisfies this constraint. |
Some vertex enumerations search only for vectors representing valid vertices, under varying definitions of valid. In this case, two valid vectors are said to be compatible if any convex combination of the two vectors is also valid.
A compatibility constraint represents a necessary condition for two valid vectors to be compatible. This class stores a single constraint stating that, for a given set of coordinate positions, all but at most a given maximum number of these positions must be set to zero in both vectors. This maximum number will be referred to as the non-zero coordinate cap.
Thus, for a pair of vectors to satisfy this constraint, the number of coordinate positions in the given set for which at least one of the two vectors has a non-zero entry must be at most the non-zero coordinate cap.
regina::NCompConstraint::NCompConstraint | ( | ) | [inline] |
Creates a new constraint with an empty set of coordinate positions and a non-zero coordinate cap of zero.
regina::NCompConstraint::NCompConstraint | ( | unsigned | newMaxNonZero | ) | [inline] |
Creates a new constraint with an empty set of coordinate positions and the given non-zero coordinate cap.
newMaxNonZero | the maximum number of coordinate positions from the associated set for which some vector may have non-zero entries without breaking this constraint. |
const std::set< unsigned > & regina::NCompConstraint::getCoordinates | ( | ) | const [inline] |
Returns the set of coordinate positions under consideration by this constraint.
std::set< unsigned > & regina::NCompConstraint::getCoordinates | ( | ) | [inline] |
Returns the set of coordinate positions under consideration by this constraint.
This non-const member function may be used to modify the associated set of coordinate positions.
unsigned regina::NCompConstraint::getMaxNonZero | ( | ) | const [inline] |
Returns the non-zero coordinate cap for this constraint.
void regina::NCompConstraint::setMaxNonZero | ( | unsigned | newMaxNonZero | ) | [inline] |
Sets the non-zero coordinate cap for this constraint.
newMaxNonZero | the maximum number of coordinate positions from the associated set for which some vector may have non-zero entries without breaking this constraint. |
bool regina::NCompConstraint::isSatisfied | ( | const NVector< T > & | first, | |
const NVector< T > & | second | |||
) | const [inline] |
Determines whether the given pair of vectors satisfies this constraint.
first | the first of the two vectors to examine. | |
second | the second of the two vectors to examine. |
true
if the given pair of vectors satisfies this constraint, or false
otherwise. bool regina::NCompConstraint::isSatisfied | ( | const NVector< T > & | v | ) | const [inline] |
Determines whether the given vector satisfies this constraint.
Although constraints are defined in terms of pairs of vectors, a single vector can also be said to satisfy a constraint if the number of non-zero coordinates amongst the given set of coordinate positions is at most the given maximum.
Examining whether a single vector v satisfies a constraint is equivalent to deciding whether the pair (v, v) or equivalently the pair (v, 0) satisfies the constraint.
v | the vector to examine. |
true
if the given vector satisfies this constraint, or false
otherwise.