Gröbner basis project
Codebase for research into Gröbner basis computation
|
a ray defined by nonnegative coordinates \((a_1,\ldots,a_n)\) More...
#include <lp_solver.hpp>
Public Member Functions | |
Construction | |
ray (NVAR_TYPE, long=-1) | |
Creates a ray with the given number of variables, all set to 0. More... | |
ray (NVAR_TYPE, const RAYENT_TYPE []) | |
Creates a ray with the given number of variables, with coordinates set to the value of the array. More... | |
ray (NVAR_TYPE, const EXP_TYPE []) | |
Creates a ray with the given number of variables, with coordinates set to the value of the array. More... | |
ray (const vector< RAYENT_TYPE > &) | |
Creates a ray whose coordinates are given by the vector. More... | |
ray (const ray &) | |
Copies the coordinates of the other ray. More... | |
Destruction | |
~ray () | |
Deletes memory allocated by the constructor. More... | |
Basic properies | |
NVAR_TYPE | get_dimension () const |
Returns the dimension of this ray. | |
RAYENT_TYPE | operator[] (NVAR_TYPE index) const |
Returns the entry indicated. Numbering starts at 0. | |
const RAYENT_TYPE * | weights () const |
Returns the weights. | |
const RAYENT_TYPE | coordinate (NVAR_TYPE index) |
Synonym for []. I have no idea why I added this. | |
bool | is_active_at (const constraint &hyperplane) const |
Returns true if and only if the hyperplane is active at this ray. More... | |
bool | is_above (constraint &hyperplane) |
Returns true if and only if this ray is above the hyperplane. More... | |
bool | is_below (constraint &hyperplane) |
Returns true if and only if this ray is below the hyperplane. More... | |
Computation | |
DOTPROD_TYPE | obtain_dot_product (const constraint &) const |
Convenience function to compute dot product between ray and constraint. More... | |
Modification | |
void | simplify_ray () |
Simplifies the ray by dividing its components by the least common denominator. | |
ray & | operator= (const ray &) |
Assignment operator; assigns the value of other to this . More... | |
void | swap (ray &) |
Swap two rays of equal dimension by swapping their data, avoiding memory reallocation. More... | |
Friends | |
Comparison | |
bool | operator== (const ray &, const ray &) |
Indicates whether the two rays are equal. More... | |
bool | operator!= (const ray &, const ray &) |
bool | operator!= (ray &r, ray &s) |
Indicates whether the two rays are unequal. More... | |
bool | operator== (const ray &, const ray &) |
Returns true if and only if the coordinates of the two rays are equal. More... | |
bool | operator< (const ray &, const ray &) |
Lexicographic comparison of rays. More... | |
I/O | |
ostream & | operator<< (ostream &, const ray &) |
Output is of the form \((r_1, \ldots, r_n)\). | |
a ray defined by nonnegative coordinates \((a_1,\ldots,a_n)\)
This class encapsulates a ray, one major part of the definition of a skeleton. Rays can be initialized to a particular set of coefficients, or to a particular axis (which is then translated into the corresponding coefficients).
A special feature is that a rays can track the constraints known to be active at the ray, allowing for more efficient computation in the double description method. Adding known constraints can be done with or without checking whether the constraint actually is active, so this should be done with care.
Definition at line 165 of file lp_solver.hpp.
ray::ray | ( | NVAR_TYPE | dimension, |
long | direction = -1 |
||
) |
Creates a ray with the given number of variables, all set to 0.
The optional second argument specifies a direction, and sets that coordinate to 1. In this case, there is no need to set the ray's known active constraints, as this is known and populated automatically.
Definition at line 115 of file lp_solver.cpp.
ray::ray | ( | NVAR_TYPE | dimension, |
const RAYENT_TYPE | entries[] | ||
) |
Creates a ray with the given number of variables, with coordinates set to the value of the array.
Definition at line 126 of file lp_solver.cpp.
ray::ray | ( | NVAR_TYPE | dimension, |
const EXP_TYPE | entries[] | ||
) |
Creates a ray with the given number of variables, with coordinates set to the value of the array.
Definition at line 135 of file lp_solver.cpp.
ray::ray | ( | const vector< RAYENT_TYPE > & | entries | ) |
Creates a ray whose coordinates are given by the vector.
Definition at line 144 of file lp_solver.cpp.
ray::ray | ( | const ray & | old_ray | ) |
Copies the coordinates of the other ray.
Allocates new memory, and copies the active constraints.
Definition at line 153 of file lp_solver.cpp.
ray::~ray | ( | ) |
Deletes memory allocated by the constructor.
Currently, that means it deletes coords
.
Definition at line 163 of file lp_solver.cpp.
|
inline |
Returns true
if and only if this ray is above the hyperplane.
Practically speaking, if the hyperplane is defined by the vector \( \mathbf c \) and the ray is defined by \( \mathbf r \) , this function returns true if and only if \( c\cdot r > 0 \).
Definition at line 264 of file lp_solver.hpp.
|
inline |
Returns true
if and only if the hyperplane is active at this ray.
Practically speaking, if the hyperplane is defined by the vector \( \mathbf c \) and the ray is defined by \( \mathbf r \) , this function returns true if and only if \( c\cdot r = 0 \).
Definition at line 252 of file lp_solver.hpp.
|
inline |
Returns true
if and only if this ray is below the hyperplane.
Practically speaking, if the hyperplane is defined by the vector \( \mathbf c \) and the ray is defined by \( \mathbf r \) , this function returns true if and only if \( c\cdot r < 0 \).
Definition at line 276 of file lp_solver.hpp.
DOTPROD_TYPE ray::obtain_dot_product | ( | const constraint & | hyperplane | ) | const |
Convenience function to compute dot product between ray and constraint.
Definition at line 195 of file lp_solver.cpp.
Assignment operator; assigns the value of other
to this
.
Definition at line 313 of file lp_solver.cpp.
void ray::swap | ( | ray & | other | ) |
Swap two rays of equal dimension by swapping their data, avoiding memory reallocation.
Definition at line 333 of file lp_solver.cpp.
Indicates whether the two rays are unequal.
Definition at line 299 of file lp_solver.hpp.
Lexicographic comparison of rays.
Definition at line 344 of file lp_solver.cpp.
Indicates whether the two rays are equal.
Definition at line 287 of file lp_solver.cpp.
Returns true
if and only if the coordinates of the two rays are equal.
Definition at line 287 of file lp_solver.cpp.