polylib 5.22.8
polyhedron.h File Reference

Go to the source code of this file.

Macros

#define POL_ENSURE_INEQUALITIES(P)
 
#define POL_ENSURE_POINTS(P)
 
#define POL_ENSURE_FACETS(P)
 
#define POL_ENSURE_VERTICES(P)
 

Functions

void Polyhedron_Compute_Dual (Polyhedron *P)
 
PolyhedronDomainConstraintSimplify (Polyhedron *P, unsigned MaxRays)
 
PolyhedronAddConstraints (Value *Con, unsigned NbConstraints, Polyhedron *Pol, unsigned NbMaxRays)
 
PolyhedronAddPolyToDomain (Polyhedron *Pol, Polyhedron *PolDomain)
 
PolyhedronAddRays (Value *Ray2, unsigned NbRay2, Polyhedron *Pol1, unsigned NbMaxRays)
 Add 'NbAddedRays' rays to polyhedron 'Pol'. More...
 
Polyhedronalign_context (Polyhedron *Pol, int align_dimension, int NbMaxRays)
 
PolyhedronConstraints2Polyhedron (Matrix *Constraints, unsigned NbMaxRays)
 Given a matrix of constraints ('Constraints'), construct and return a polyhedron. More...
 
PolyhedronDisjoint_Domain (Polyhedron *Pol, int flag, unsigned NbMaxRays)
 
PolyhedronDomainAddConstraints (Polyhedron *Pol, Matrix *Mat, unsigned NbMaxRays)
 
PolyhedronDomainAddRays (Polyhedron *Pol, Matrix *Ray, unsigned NbMaxConstrs)
 Add rays pointed by 'Ray' to each and every polyhedron in the polyhedral domain 'Pol'. More...
 
PolyhedronDomainConvex (Polyhedron *Pol, unsigned NbMaxConstrs)
 
IntervalDomainCost (Polyhedron *Pol, Value *Cost)
 
PolyhedronDomainDifference (Polyhedron *Pol1, Polyhedron *Pol2, unsigned NbMaxRays)
 
PolyhedronDomainImage (Polyhedron *Pol, Matrix *Func, unsigned NbMaxConstrs)
 
PolyhedronDomainIntersection (Polyhedron *Pol1, Polyhedron *Pol2, unsigned NbMaxRays)
 Return the intersection of two polyhedral domains 'Pol1' and 'Pol2'. More...
 
PolyhedronDomainPreimage (Polyhedron *Pol, Matrix *Func, unsigned NbMaxRays)
 
PolyhedronDomainSimplify (Polyhedron *Pol1, Polyhedron *Pol2, unsigned NbMaxRays)
 
PolyhedronStras_DomainSimplify (Polyhedron *Pol1, Polyhedron *Pol2, unsigned NbMaxRays)
 
PolyhedronDomainUnion (Polyhedron *Pol1, Polyhedron *Pol2, unsigned NbMaxRays)
 
PolyhedronDomain_Copy (Polyhedron *Pol)
 
void Domain_Free (Polyhedron *Pol)
 
void Domain_PrintConstraints (FILE *Dst, const char *Format, Polyhedron *Pol)
 
PolyhedronEmpty_Polyhedron (unsigned Dimension)
 
int Gauss (Matrix *Mat, int NbEq, int Dimension)
 
int lower_upper_bounds (int pos, Polyhedron *P, Value *context, Value *LBp, Value *UBp)
 
MatrixPolyhedron2Constraints (Polyhedron *Pol)
 
MatrixPolyhedron2Rays (Polyhedron *Pol)
 Given a polyhedron 'Pol', return a matrix of rays. More...
 
int PolyhedronIncludes (Polyhedron *Pol1, Polyhedron *Pol2)
 
PolyhedronPolyhedron_Alloc (unsigned Dimension, unsigned NbConstraints, unsigned NbRays)
 
PolyhedronPolyhedron_Copy (Polyhedron *Pol)
 
void Polyhedron_Free (Polyhedron *Pol)
 
PolyhedronPolyhedron_Image (Polyhedron *Pol, Matrix *Func, unsigned NbMaxConstrs)
 
PolyhedronPolyhedron_Preimage (Polyhedron *Pol, Matrix *Func, unsigned NbMaxRays)
 
void Polyhedron_Print (FILE *Dst, const char *Format, const Polyhedron *Pol)
 
void Polyhedron_PrintConstraints (FILE *Dst, const char *Format, Polyhedron *Pol)
 
PolyhedronPolyhedron_Scan (Polyhedron *D, Polyhedron *C, unsigned MAXRAYS)
 
void PolyPrint (Polyhedron *Pol)
 
PolyhedronRays2Polyhedron (Matrix *Ray, unsigned NbMaxConstrs)
 Given a matrix of rays 'Ray', create and return a polyhedron. More...
 
PolyhedronSubConstraint (Value *Con, Polyhedron *Pol, unsigned NbMaxRays, int Pass)
 
PolyhedronUniverse_Polyhedron (unsigned Dimension)
 
void polylib_close (void)
 Free all cache allocated memory: call this function before exiting in a memory checker environment like valgrind. More...
 

Macro Definition Documentation

◆ POL_ENSURE_FACETS

#define POL_ENSURE_FACETS (   P)
Value:
if (F_ISSET(P, POL_VALID) && !F_ISSET(P, POL_FACETS)) \
Polyhedron_Compute_Dual(P);
#define F_ISSET(p, f)
Definition: types.h:91
#define POL_VALID
Definition: types.h:107
#define POL_FACETS
Definition: types.h:101

Definition at line 13 of file polyhedron.h.

◆ POL_ENSURE_INEQUALITIES

#define POL_ENSURE_INEQUALITIES (   P)
Value:
Polyhedron_Compute_Dual(P);
#define POL_INEQUALITIES
Definition: types.h:100

Definition at line 5 of file polyhedron.h.

◆ POL_ENSURE_POINTS

#define POL_ENSURE_POINTS (   P)
Value:
if (F_ISSET(P, POL_VALID) && !F_ISSET(P, POL_POINTS)) \
Polyhedron_Compute_Dual(P);
#define POL_POINTS
Definition: types.h:102

Definition at line 9 of file polyhedron.h.

◆ POL_ENSURE_VERTICES

#define POL_ENSURE_VERTICES (   P)
Value:
Polyhedron_Compute_Dual(P);
#define POL_VERTICES
Definition: types.h:103

Definition at line 17 of file polyhedron.h.

Function Documentation

◆ AddConstraints()

◆ AddPolyToDomain()

◆ AddRays()

Polyhedron * AddRays ( Value *  AddedRays,
unsigned  NbAddedRays,
Polyhedron Pol,
unsigned  NbMaxConstrs 
)

◆ align_context()

◆ Constraints2Polyhedron()

Polyhedron * Constraints2Polyhedron ( Matrix Constraints,
unsigned  NbMaxRays 
)

Given a matrix of constraints ('Constraints'), construct and return a polyhedron.

Parameters
ConstraintsConstraints (may be modified!)
NbMaxRaysEstimated number of rays in the ray matrix of the polyhedron.
Returns
newly allocated Polyhedron

Definition at line 1905 of file polyhedron.c.

References any_exception_error, CATCH, Chernikova(), polyhedron::Constraint, ConstraintSimplify(), Empty_Polyhedron(), errormsg1(), ExchangeRows(), F_SET, First_Non_Zero(), Gauss(), ImplicitEqualities(), Matrix_Alloc(), Matrix_Free(), Matrix_Print(), matrix::NbColumns, polyhedron::NbEq, matrix::NbRows, SatMatrix::NbRows, matrix::p, matrix::p_Init, SatMatrix::p_init, POL_INEQUALITIES, POL_INTEGER, POL_ISSET, POL_NO_DUAL, POL_VALID, Polyhedron_Alloc(), Polyhedron_Free(), Polyhedron_Print(), polyhedron::Ray, Remove_Redundants(), RETHROW, Sat, SMAlloc(), SMFree(), SMPrint(), SMVector_Init, SortConstraints(), TRY, UNCATCH, Universe_Polyhedron(), value_clear, value_init, value_notzero_p, value_set_si, value_zero_p, Vector_Copy(), and Vector_Set().

Referenced by AddConstraints(), dehomogenize_polyhedron(), DomainSimplify(), Ehrhart_Quick_Apx(), Elim_Columns(), eliminable_vars(), Enumeration_zero(), Find_m_faces(), homogenize(), LexSmaller(), main(), Param_Vertices_Print(), Polyhedron_Compute_Dual(), Polyhedron_Preimage(), Polyhedron_Preprocess(), Polyhedron_Preprocess2(), Polyhedron_Remove_parm_eqs(), Recession_Cone(), Stras_DomainSimplify(), test_Constraints_fullDimensionize(), test_Constraints_Remove_parm_eqs(), test_Polyhedron_Remove_parm_eqs(), and Union_Read().

◆ Disjoint_Domain()

◆ Domain_Copy()

◆ Domain_Free()

◆ Domain_PrintConstraints()

void Domain_PrintConstraints ( FILE *  Dst,
const char *  Format,
Polyhedron Pol 
)

Definition at line 4752 of file polyhedron.c.

References polyhedron::next, and Polyhedron_PrintConstraints().

◆ DomainAddConstraints()

Polyhedron * DomainAddConstraints ( Polyhedron Pol,
Matrix Mat,
unsigned  NbMaxRays 
)

◆ DomainAddRays()

Polyhedron * DomainAddRays ( Polyhedron Pol,
Matrix Ray,
unsigned  NbMaxConstrs 
)

Add rays pointed by 'Ray' to each and every polyhedron in the polyhedral domain 'Pol'.

'NbMaxConstrs' is maximum allowed constraints in the constraint set of a polyhedron.

Definition at line 2794 of file polyhedron.c.

References AddRays(), polyhedron::Dimension, Domain_Copy(), errormsg1(), matrix::NbColumns, matrix::NbRows, polyhedron::next, matrix::p, Polyhedron_Free(), and PolyhedronIncludes().

Referenced by Find_m_faces(), and Polyhedron_Scan().

◆ DomainConstraintSimplify()

Polyhedron * DomainConstraintSimplify ( Polyhedron P,
unsigned  MaxRays 
)

◆ DomainConvex()

Polyhedron * DomainConvex ( Polyhedron Pol,
unsigned  NbMaxConstrs 
)

◆ DomainCost()

◆ DomainDifference()

◆ DomainImage()

◆ DomainIntersection()

Polyhedron * DomainIntersection ( Polyhedron Pol1,
Polyhedron Pol2,
unsigned  NbMaxRays 
)

◆ DomainPreimage()

◆ DomainSimplify()

◆ DomainUnion()

Polyhedron * DomainUnion ( Polyhedron Pol1,
Polyhedron Pol2,
unsigned  NbMaxRays 
)

◆ Empty_Polyhedron()

◆ Gauss()

int Gauss ( Matrix Mat,
int  NbEq,
int  Dimension 
)

◆ lower_upper_bounds()

◆ Polyhedron2Constraints()

◆ Polyhedron2Rays()

Matrix * Polyhedron2Rays ( Polyhedron Pol)

Given a polyhedron 'Pol', return a matrix of rays.

Definition at line 2672 of file polyhedron.c.

References polyhedron::Dimension, errormsg1(), Matrix_Alloc(), polyhedron::NbRays, matrix::p_Init, POL_ENSURE_POINTS, polyhedron::Ray, and Vector_Copy().

Referenced by main().

◆ Polyhedron_Alloc()

◆ Polyhedron_Compute_Dual()

◆ Polyhedron_Copy()

◆ Polyhedron_Free()

◆ Polyhedron_Image()

◆ Polyhedron_Preimage()

◆ Polyhedron_Print()

◆ Polyhedron_PrintConstraints()

void Polyhedron_PrintConstraints ( FILE *  Dst,
const char *  Format,
Polyhedron Pol 
)

◆ Polyhedron_Scan()

◆ PolyhedronIncludes()

◆ polylib_close()

void polylib_close ( void  )

Free all cache allocated memory: call this function before exiting in a memory checker environment like valgrind.

Notice that, in a multithreaded environment, all your threads have to call this function

Definition at line 4843 of file polyhedron.c.

References free_exception_stack(), and free_value_cache().

◆ PolyPrint()

void PolyPrint ( Polyhedron Pol)

Definition at line 1710 of file polyhedron.c.

References Polyhedron_Print().

◆ Rays2Polyhedron()

Polyhedron * Rays2Polyhedron ( Matrix Ray,
unsigned  NbMaxConstrs 
)

Given a matrix of rays 'Ray', create and return a polyhedron.

Parameters
RayRays (may be modified!)
NbMaxConstrsEstimated number of constraints in the polyhedron.
Returns
newly allocated Polyhedron

Definition at line 2087 of file polyhedron.c.

References any_exception_error, CATCH, Chernikova(), Empty_Polyhedron(), errormsg1(), Matrix_Alloc(), Matrix_Free(), Matrix_Print(), matrix::NbColumns, matrix::NbRows, matrix::p, matrix::p_Init, POL_ISSET, POL_NO_DUAL, Polyhedron_Free(), Polyhedron_Print(), Remove_Redundants(), RETHROW, Sat, SMAlloc(), SMFree(), SMPrint(), SMVector_Init, TransformSat(), TRY, UNCATCH, value_set_si, and Vector_Set().

Referenced by main(), Polyhedron_Image(), and traite_m_face().

◆ Stras_DomainSimplify()

◆ SubConstraint()

◆ Universe_Polyhedron()