polylib: ehrhart.h File Reference

# 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.
void | eadd (evalue *e1, evalue *res)
| adds one evalue to evalue 'res.
enode * | ecopy (enode *e)
void | edot (enode *v1, enode *v2, evalue *res)
| computes the inner product of two vectors.
enode * | new_enode (enode_type type, int size, int pos)
| EHRHART POLYNOMIAL SYMBOLIC ALGEBRA SYSTEM.
void | free_evalue_refs (evalue *e)
| releases all memory referenced by e.
Enumeration * | Polyhedron_Enumerate (Polyhedron *P, Polyhedron *C, unsigned MAXRAYS, const char **pname)
| Procedure to count points in a parameterized polytope.
void | print_enode (FILE *DST, enode *p, const char **pname)
| prints the enode to DST
void | print_evalue (FILE *DST, evalue *e, const char **pname)
void | reduce_evalue (evalue *e)
void | Enumeration_Free (Enumeration *en)
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.
Enumeration * | Enumeration_zero (unsigned int nbParms, unsigned int maxRays)
| returns a constant Ehrhart polynomial whose value is zero for any value of the parameters.

## Function Documentation

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

PROCEDURES TO COMPUTE ENUMERATION.

recursive procedure, recurse for each imbriquation

Parameters:

  | pos | index position of current loop index (1..hdim-1)
  | P | loop domain
  | context | context values for fixed indices
  | res | the number of integer points in this polyhedron

Definition at line 1145 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().

void eadd | ( | evalue * | e1,
|  | evalue * | res |
| ) |  |  |

adds one evalue to evalue 'res.

result = res + e1

Parameters:

  | e1 | an evalue
  | res |

Definition at line 410 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, and value_zero_p.

Referenced by eadd(), and edot().

enode* ecopy | ( | enode * | e | ) |

Parameters:

  | e | pointer to an evalue

Returns:
  description

Definition at line 167 of file ehrhart.c.

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

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

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

computes the inner product of two vectors.

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

Parameters:

  | v1 | an enode (vector)
  | v2 | an enode (vector of constants)
  | res | result (evalue)

Definition at line 526 of file ehrhart.c.

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

Referenced by P_Enum().

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:

  | M | a polyhedron under implicit form
  | C | M's context under implicit form
  | Validity_Lattice | a pointer to the parameter's validity lattice
  | MAXRAYS | the needed "working space" for other polylib functions used here
  | param_name | the names of the parameters,

Definition at line 2635 of file ehrhart.c.

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

Referenced by Constraints_EhrhartQuickApx(), and main().

void Enumeration_Free | ( | Enumeration * | en | ) |

Definition at line 2220 of file ehrhart.c.

References Domain_Free(), _enumeration::EP, free_evalue_refs(), _enumeration::next, and _enumeration::ValidityDomain.

Referenced by main(), and test_Constraints_fullDimensionize().

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:

  | nbParms | the number of parameters, i.e., the number of arguments to the Ehrhart polynomial

Definition at line 2732 of file ehrhart.c.

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

Referenced by test_Constraints_fullDimensionize().

void free_evalue_refs | ( | evalue * | e | ) |

releases all memory referenced by e.

(recursive)

Parameters:

  | e | pointer to an evalue

Definition at line 139 of file ehrhart.c.

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

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

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 114 of file ehrhart.c.

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

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

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

Procedure to count points in a parameterized polytope.

Parameters:

  | Pi | Polyhedron to enumerate
  | C | Context Domain
  | MAXRAYS | size of workspace
  | param_name | parameter names (array of strings), may be NULL

Returns:
  a list of validity domains + evalues EP

Definition at line 1860 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(), 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(), 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, and Vector_Set().

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

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

prints the enode to DST

Parameters:

  | DST | destination file
  | p | pointer to enode to be printed
  | pname | array of strings, name of the parameters

Definition at line 216 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().

void print_evalue | ( | FILE * | DST,
|  | evalue * | e,
|  | const char ** | pname |
| ) |  |  |

Parameters:

  | DST | destination file
  | e | pointer to evalue to be printed
  | pname | array of strings, name of the parameters

Definition at line 192 of file ehrhart.c.

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

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

void reduce_evalue | ( | evalue * | e | ) |

Parameters:

  | e | pointer to an evalue

Definition at line 295 of file ehrhart.c.

References _enode::arr, _evalue::d, eequal(), free_evalue_refs(), p, periodic, polynomial, reduce_evalue(), _enode::size, _enode::type, value_clear, value_notzero_p, value_one_p, and value_zero_p.

Referenced by Ehrhart_Quick_Apx_Full_Dim(), Polyhedron_Enumerate(), and reduce_evalue().