polylib 5.22.8
ehrhart.h File Reference

Go to the source code of this file.

Functions

void count_points (int pos, Polyhedron *P, Value *context, Value *res)
 PROCEDURES TO COMPUTE ENUMERATION. More...
 
void eadd (evalue *e1, evalue *res)
 adds one evalue to evalue 'res. More...
 
enodeecopy (enode *e)
 
void edot (enode *v1, enode *v2, evalue *res)
 computes the inner product of two vectors. More...
 
enodenew_enode (enode_type type, int size, int pos)
 EHRHART POLYNOMIAL SYMBOLIC ALGEBRA SYSTEM. More...
 
void free_evalue_refs (evalue *e)
 releases all memory referenced by e. More...
 
EnumerationPolyhedron_Enumerate (Polyhedron *P, Polyhedron *C, unsigned MAXRAYS, const char **pname)
 Procedure to count points in a parameterized polytope. More...
 
void print_enode (FILE *DST, enode *p, const char **pname)
 prints the enode to DST More...
 
void print_evalue (FILE *DST, evalue *e, const char **pname)
 
void reduce_evalue (evalue *e)
 
void Enumeration_Free (Enumeration *en)
 
EnumerationEhrhart_Quick_Apx (Matrix *M, Matrix *C, Matrix **Validity_Lattice, unsigned MAXRAYS)
 Computes the approximation of the Ehrhart polynomial of a polyhedron (implicit form -> matrix), treating the non-full-dimensional case. More...
 
EnumerationEnumeration_zero (unsigned int nbParms, unsigned int maxRays)
 returns a constant Ehrhart polynomial whose value is zero for any value of the parameters. More...
 

Variables

int overflow_warning_flag
 

Function Documentation

◆ count_points()

void count_points ( int  pos,
Polyhedron P,
Value *  context,
Value *  res 
)

PROCEDURES TO COMPUTE ENUMERATION.

recursive procedure, recurse for each imbriquation

Parameters
posindex position of current loop index (1..hdim-1)
Ploop domain
contextcontext values for fixed indices
resthe number of integer points in this polyhedron

Definition at line 1154 of file ehrhart.c.

References count_points(), emptyQ, lower_upper_bounds(), polyhedron::next, P_VALUE_FMT, POL_ENSURE_FACETS, POL_ENSURE_VERTICES, value_add_int, value_addto, value_assign, value_clear, value_increment, value_init, value_le, value_lt, value_notmone_p, value_print, value_set_si, and value_subtract.

Referenced by check_poly(), count_points(), Enumerate_NoParameters(), and P_Enum().

◆ eadd()

void eadd ( evalue e1,
evalue res 
)

adds one evalue to evalue 'res.

result = res + e1

Parameters
e1an evalue
res

Definition at line 385 of file ehrhart.c.

References _enode::arr, _evalue::d, eadd(), ecopy(), free_evalue_refs(), periodic, polynomial, value_addto, value_clear, value_divexact, value_gcd, value_init, value_multiply, value_notone_p, value_notzero_p, value_zero_p, and _evalue::x.

Referenced by eadd(), and edot().

◆ ecopy()

enode * ecopy ( enode e)
Parameters
epointer to an evalue
Returns
description

Definition at line 144 of file ehrhart.c.

References _enode::arr, _evalue::d, ecopy(), new_enode(), _enode::pos, _enode::size, _enode::type, value_assign, value_init, value_zero_p, and _evalue::x.

Referenced by Domain_Enumerate(), eadd(), ecopy(), and new_eadd().

◆ edot()

void edot ( enode v1,
enode v2,
evalue res 
)

computes the inner product of two vectors.

Result = result (evalue) = v1.v2 (dot product)

Parameters
v1an enode (vector)
v2an enode (vector of constants)
resresult (evalue)

Definition at line 514 of file ehrhart.c.

References _enode::arr, _evalue::d, eadd(), emul(), evector, free_evalue_refs(), _enode::size, _enode::type, value_init, value_set_si, and _evalue::x.

Referenced by P_Enum().

◆ Ehrhart_Quick_Apx()

Enumeration * Ehrhart_Quick_Apx ( Matrix M,
Matrix C,
Matrix **  Validity_Lattice,
unsigned  maxRays 
)

Computes the approximation of the Ehrhart polynomial of a polyhedron (implicit form -> matrix), treating the non-full-dimensional case.

Parameters
Ma polyhedron under implicit form
CM's context under implicit form
Validity_Latticea pointer to the parameter's validity lattice
MAXRAYSthe needed "working space" for other polylib functions used here
param_namethe names of the parameters,

Definition at line 2627 of file ehrhart.c.

References Constraints2Polyhedron(), Ehrhart_Quick_Apx_Full_Dim(), full_dimensionize(), Matrix_Free(), maxRays, mpolyhedron_compress_last_vars(), matrix::NbColumns, Polyhedron_Free(), and show_matrix.

Referenced by Constraints_EhrhartQuickApx(), and main().

◆ Enumeration_Free()

void Enumeration_Free ( Enumeration en)

◆ Enumeration_zero()

Enumeration * Enumeration_zero ( unsigned int  nbParms,
unsigned int  maxRays 
)

returns a constant Ehrhart polynomial whose value is zero for any value of the parameters.

Parameters
nbParmsthe number of parameters, i.e., the number of arguments to the Ehrhart polynomial

Definition at line 2719 of file ehrhart.c.

References Constraints2Polyhedron(), Matrix_Alloc(), Matrix_Free(), maxRays, matrix::p, Polyhedron_Enumerate(), Polyhedron_Free(), Universe_Polyhedron(), and value_set_si.

Referenced by test_Constraints_fullDimensionize().

◆ free_evalue_refs()

void free_evalue_refs ( evalue e)

releases all memory referenced by e.

(recursive)

Parameters
epointer to an evalue

Definition at line 115 of file ehrhart.c.

References _enode::arr, _evalue::d, free_evalue_refs(), _enode::size, value_clear, value_notzero_p, and _evalue::x.

Referenced by dehomogenize_evalue(), Domain_Enumerate(), eadd(), edot(), Enumeration_Free(), free_evalue_refs(), main(), P_Enum(), and reduce_evalue().

◆ new_enode()

enode * new_enode ( enode_type  type,
int  size,
int  pos 
)

EHRHART POLYNOMIAL SYMBOLIC ALGEBRA SYSTEM.

The newly allocated enode can be freed with a simple free(x)

Parameters
type: enode type
size: degree+1 for polynomial, period for periodic
pos: 1..nb_param, position of parameter
Returns
a newly allocated enode

Definition at line 90 of file ehrhart.c.

References _enode::arr, _evalue::d, _enode::pos, _enode::size, _enode::type, value_init, value_set_si, and _evalue::x.

Referenced by ecopy(), emul(), Enumerate_NoParameters(), new_eadd(), and P_Enum().

◆ Polyhedron_Enumerate()

Enumeration * Polyhedron_Enumerate ( Polyhedron Pi,
Polyhedron C,
unsigned  MAXRAYS,
const char **  param_name 
)

Procedure to count points in a parameterized polytope.

Parameters
PiPolyhedron to enumerate
CContext Domain
MAXRAYSsize of workspace
param_nameparameter names (array of strings), may be NULL
Returns
a list of validity domains + evalues EP

Definition at line 1870 of file ehrhart.c.

References addeliminatedparams_evalue(), assert, CATCH, _Param_Polyhedron::D, _evalue::d, dehomogenize_evalue(), polyhedron::Dimension, _Param_Domain::Domain, Domain_Free(), DomainIntersection(), DomainSimplify(), emptyQ, Enumerate_NoParameters(), _enumeration::EP, _Param_Domain::F, homogenize(), Matrix_Free(), MAXRAYS, polyhedron::NbBid, matrix::NbColumns, polyhedron::NbEq, polyhedron::NbRays, matrix::NbRows, _Param_Domain::next, _enumeration::next, overflow_error, overflow_warning_flag, P_Enum(), P_VALUE_FMT, Param_Polyhedron_Free(), Param_Vertices_Free(), Pi, POL_ENSURE_FACETS, POL_ENSURE_VERTICES, POL_ISSET, POL_NO_DUAL, Polyhedron2Param_SimplifiedDomain(), Polyhedron_Free(), Polyhedron_Preimage(), Polyhedron_Preprocess(), Polyhedron_Preprocess2(), Polyhedron_Print(), Polyhedron_Scan(), PolyhedronIncludes(), Print_Domain(), print_evalue(), polyhedron::Ray, reduce_evalue(), Scan_Vertices(), TRY, UNCATCH, Universe_Polyhedron(), _Param_Polyhedron::V, _enumeration::ValidityDomain, value_addto, value_clear, value_init, value_multiply, value_notzero_p, value_print, value_set_si, value_zero_p, Vector_Set(), and _evalue::x.

Referenced by Domain_Enumerate(), Enumeration_zero(), main(), and test_Constraints_fullDimensionize().

◆ print_enode()

void print_enode ( FILE *  DST,
enode p,
const char **  pname 
)

prints the enode to DST

Parameters
DSTdestination file
ppointer to enode to be printed
pnamearray of strings, name of the parameters

Definition at line 190 of file ehrhart.c.

References _enode::arr, evector, periodic, polynomial, _enode::pos, print_evalue(), _enode::size, and _enode::type.

Referenced by P_Enum(), and print_evalue().

◆ print_evalue()

void print_evalue ( FILE *  DST,
evalue e,
const char **  pname 
)
Parameters
DSTdestination file
epointer to evalue to be printed
pnamearray of strings, name of the parameters

Definition at line 169 of file ehrhart.c.

References _evalue::d, print_enode(), value_notone_p, value_notzero_p, value_print, and _evalue::x.

Referenced by compute_poly(), Ehrhart_Quick_Apx_Full_Dim(), Enumerate_NoParameters(), main(), P_Enum(), Polyhedron_Enumerate(), print_enode(), and test_Constraints_fullDimensionize().

◆ reduce_evalue()

Variable Documentation

◆ overflow_warning_flag

int overflow_warning_flag
extern