17 #ifndef LATTICE_ALGS_GUARD
18 #define LATTICE_ALGS_GUARD
51 cout << "Check condition on line " \
52 << __LINE__ << " of file " << __FILE__ \
53 << " not satisfied:\n "#X << endl; \
102 const mpq_class&
getH(
size_t i)
const;
105 const mpq_class&
getY(
size_t i)
const;
145 vector<mpq_class> sum(
getHDim());
146 for (
size_t i = 0; i <
getHDim(); ++i)
151 if (sum[col] !=
_h(row, col))
160 vector<mpq_class> sum(
getHDim());
161 for (
size_t i = 0; i <
getHDim(); ++i)
162 sum[i] =
_h(a, i) +
_h(b, i);
166 if (sum[col] !=
_h(row, col))
218 for (
size_t var = 1; var < a.
getYDim(); ++var)
219 if (a.
getY(var) <= 0 && b.
getY(var) <= 0)
238 const vector<Mlfb>& mlfbs,
const GrobLat& lat);
261 const vector<Mlfb>& mlfbs,
const GrobLat& lat):
262 tri(a, b, sum, mlfbs, lat) {}
296 for (
size_t i = 0; i <
_points.size(); ++i)
319 const vector<mpz_class>&
getRhs()
const {
349 return edges[indexParam];
354 return edges[indexParam];
358 for (
size_t i = 0; i < 4; ++i)
374 void reset(
size_t offset,
const vector<Neighbor>& points);
389 for (
size_t col = 0; col < 3; ++col) {
390 mat(0, col) = a.
getH(col) - c.
getH(col);
391 mat(1, col) = b.
getH(col) - c.
getH(col);
406 return dn == 0 || dn == 1 || dn == -1;
415 for (
size_t i = 0; i < 3; ++i)
444 void checkPlanes(
const vector<TriPlane>& thinPlanes,
445 const vector<Plane>& dtPlanes);
448 const vector<mpz_class>& rhs,
457 vector<vector<SeqPos> >& right,
458 const vector<Mlfb>& mlfbs,
466 void checkSeqs(
const vector<vector<SeqPos> >& left,
467 const vector<vector<SeqPos> >& right,
469 const vector<Mlfb>& mlfbs);
471 const vector<Mlfb>& mlfbs);
473 const vector<Mlfb>& mlfbs);
476 const vector<Mlfb>& mlfbs);
483 const vector<Mlfb>& mlfbs,
484 const vector<SeqPos>& flatSeq);
487 const vector<Mlfb>& mlfbs,
488 const vector<const Mlfb*>& pivots,
493 vector<Mlfb>& mlfbs);
499 map<size_t, size_t>& typeCounts);
501 bool disjointSeqs(
const vector<SeqPos>& a,
const vector<SeqPos>& b);
507 const vector<Mlfb>& mlfbs,
509 const vector<SeqPos>& flatSeq);
523 const vector<Mlfb>& mlfbs);
void checkFlatSeq(const vector< SeqPos > &flatSeq, const GrobLat &lat, const Plane &plane)
void checkGraphOnPlane(const Plane &plane, const vector< Mlfb > &mlfbs)
void checkPlanes(const vector< TriPlane > &thinPlanes, const vector< Plane > &dtPlanes)
void checkMlfbs(const vector< Mlfb > &mlfbs, const GrobLat &lat)
const char * getEdgePos(size_t index)
bool disjointSeqs(const vector< SeqPos > &a, const vector< SeqPos > &b)
void computePivotSeqs(vector< vector< SeqPos > > &seqs, const Mlfb &pivot, const Plane &plane)
Starting at pivot (which must be a pivot), follow the three non-flat sequences starting at pivot.
void checkSeqs(const vector< vector< SeqPos > > &left, const vector< vector< SeqPos > > &right, const Plane &plane, const vector< Mlfb > &mlfbs)
void computeSeqs(vector< vector< SeqPos > > &left, vector< vector< SeqPos > > &right, const vector< Mlfb > &mlfbs, const Plane &plane)
size_t pushOutFacetZero(const vector< mpz_class > &rhs, const GrobLat &lat)
char getPlaceCode(NeighborPlace place)
void computeMlfbs(vector< Mlfb > &mlfbs, const GrobLat &lat)
void computePivots(vector< const Mlfb * > &pivots, const vector< Mlfb > &mlfbs, const Plane &plane, const vector< SeqPos > &flatSeq)
Put all pivots into pivots.
void checkGraph(const vector< Mlfb > &mlfbs)
void checkMiddle(const Plane &plane, const vector< Mlfb > &mlfbs)
mpq_class getIndexSum(const vector< Mlfb > &mlfbs)
void checkDoubleTriangle(const Plane &plane, const vector< Mlfb > &mlfbs)
void computePlanes(vector< Plane > &planes, const GrobLat &lat, vector< Mlfb > &mlfbs)
void checkDoubleTrianglePlanes(const vector< Plane > &planes, const GrobLat &lat, const vector< Mlfb > &mlfbs)
size_t pushOutFacetPositive(size_t facetPushOut, const vector< mpz_class > &rhs, const GrobLat &lat)
void getThinPlanes(vector< TriPlane > &planes, const GrobLat &lat)
void checkNonSums(const GrobLat &lat)
void checkPlane(const Plane &plane, const vector< Mlfb > &mlfbs)
void setupPlaneCountsAndOrder(vector< Mlfb > &mlfbs, const Plane &plane, map< size_t, size_t > &typeCounts)
Set the plane vertex count for each mlfb and count how many MLFBs have each possible number of vertic...
void checkPlaneTri(const GrobLat &lat, const vector< Mlfb > &mlfbs, const vector< const Mlfb * > &pivots, const Plane &plane)
void checkPivotSeqs(vector< vector< SeqPos > > &pivotSeqs, const Plane &plane, const vector< Mlfb > &mlfbs, const vector< SeqPos > &flatSeq)
Perform checks where pivotSeqs are the 3 non-flat sequences on one side.
void nullSpace(Matrix &basis, const Matrix &matParam)
Sets the columns of basis to a basis of the null space of mat.
void transpose(Matrix &trans, const Matrix &mat)
Sets trans to the transpose of mat.
A lattice with associated Grobner basis/neighbors.
Neighbor getNeighbor(size_t row) const
const SatBinomIdeal & getIdeal() const
const mpq_class & getZero() const
Neighbor getSum(size_t a, size_t b) const
const vector< Neighbor > & getNonSums() const
const Matrix & getYMatrix() const
GrobLat(const Matrix &matrix, const SatBinomIdeal &ideal)
bool hasZeroEntryY() const
Neighbor getSum(Neighbor a, Neighbor b) const
bool isPointFreeBody(Neighbor a, Neighbor b, Neighbor c) const
Returns true if the smallest body containing zero, a, b and c has no neighbor in its interior.
size_t getNeighborCount() const
const Matrix & getHMatrix() const
void getInitialIdeal(BigIdeal &ideal) const
bool isInterior(Neighbor a, Neighbor b) const
bool isSum(Neighbor n) const
vector< Neighbor > _nonSums
bool isPointFreeBody(Neighbor a, Neighbor b) const
Returns true if the smallest body containing zero, a and b has no neighbor in its interior.
const Matrix & getMatrix() const
size_t getColCount() const
size_t getRowCount() const
const vector< mpz_class > & getRhs() const
Neighbor getPoint(size_t offset) const
string getName(const Plane &plane) const
bool operator==(const Mlfb &mlfb) const
vector< Neighbor > _points
size_t getFacetOf(const Mlfb &adjacent) const
vector< size_t > edgeHitsFacet
Neighbor getHitsNeighbor(size_t indexParam) const
Mlfb * getEdge(size_t indexParam)
const Mlfb * getEdge(size_t indexParam) const
bool hasPoint(Neighbor n) const
void reset(size_t offset, const vector< Neighbor > &points)
size_t getPointCount() const
bool isParallelogram() const
size_t getMinInitialFacet() const
size_t getHitsFacet(size_t indexParam) const
const mpq_class & getH(size_t i) const
Neighbor & operator=(const Neighbor &neighbor)
const mpq_class & getY(size_t i) const
const GrobLat & getGrobLat() const
bool operator==(const Neighbor &neighbor) const
bool isFlat(const Mlfb &mlfb) const
vector< NeighborPlace > neighborPlace
bool isPivot(const Mlfb &mlfb) const
Plane(Neighbor a, Neighbor b, Neighbor sum, const vector< Mlfb > &mlfbs, const GrobLat &lat)
bool is22(const Mlfb &mlfb) const
NeighborPlace getPlace(Neighbor neighbor) const
map< size_t, size_t > typeCounts
vector< const Mlfb * > pivots
size_t getTypeCount(size_t type) const
bool isSidePivot(const Mlfb &mlfb) const
size_t getMaxType() const
bool inPlane(Neighbor neighbor) const
size_t getType(const Mlfb &mlfb) const
Represents a saturated binomial ideal.
bool isPointFreeBody(const vector< mpz_class > &a, const vector< mpz_class > &b) const
Returns true if the smallest body containing zero, a and b has no generator in its interior.
size_t getVarCount() const
const vector< mpz_class > & getGenerator(size_t index) const
bool hasZeroEntry() const
Returns true if any generator does not involve every variable, i.e.
void getInitialIdeal(BigIdeal &ideal) const
mpz_class dotNormal(Neighbor a) const
bool inPlane(Neighbor a) const
bool closeToPlane(Neighbor a)
bool isParallel(const TriPlane &plane) const
const Matrix & getNormal() const
returns the normal of the plane as the row of a matrix.
TriPlane(Neighbor a, Neighbor b, Neighbor c)
bool isParallel(const Plane &plane) const
vector< const Mlfb * > _bSideMlfbs
const vector< const Mlfb * > & getBSideMlfbs() const
Tri(Neighbor a, Neighbor b, Neighbor sum, const vector< Mlfb > &mlfbs, const GrobLat &lat)
vector< Neighbor > _interior
const vector< const Mlfb * > & getASideMlfbs() const
const vector< Neighbor > & getNeighborsOnBoundary() const
vector< Neighbor > _boundary
const vector< Neighbor > & getNeighborsInInterior() const
vector< const Mlfb * > _aSideMlfbs
SeqPos getReverse() const
bool operator<(const SeqPos &pos) const
size_t getForwardFacet() const
size_t getBackFacet() const