Overview of the ZPolyhedralSets Subpackage
Calling Sequence
Description
Examples
References
Compatibility
ZPolyhedralSets:-command(arguments)
command(arguments)
The ZPolyhedralSets subpackage of the PolyhedralSets package is a collection of commands for computing with Z-polyhedral sets.
A Z-polyhedral set is the intersection of a polyhedral set with an integer lattice. (A Z-polytope is the intersection of a polytope with an integer lattice; a polytope is a bounded polyhedral set.)
The functionalities of this package offer tools to construct, visualize and study Z-polyhedral sets.
The commands Lattice and ZPolyhedralSet build integer lattices and Z-polyhedral sets.
The command IsContained is an inclusion-test for sets of Z-polyhedral sets.
The command IsEmpty checks whether a Z-Polyhedral set is empty.
The command IsIntegerPointOf checks whether a given integer point belongs to a given a Z-Polyhedral set.
The command SamplePoint returns one point of a non-empty Z-Polyhedral set.
The command EnumerateIntegerPoints enumerates the points of a bounded Z-Polyhedral set.
The command PlotIntegerPoints3d plots the points of a bounded three-dimensional Z-Polyhedral set.
The command IntegerPointDecomposition is at the core of this package: it decomposes a given Z-polyhedral set into Z-polyhedral sets with additional properties (such as consistency and good specialization).
The examples below are advanced problems taken from the literature (see the fourth reference below). They illustrate the kind of applications that this package can support.
with⁡PolyhedralSets:
with⁡ZPolyhedralSets:
This first problem considers dependence anaysis in Cholesky's LU algorithm. See the image below, taken from William Pugh's paper on Presburger arithmetic. One objective of this problem is to decide whether the studied code can be parallelized. This is achieved by checking whether the same memory location is accessed by two statements (or more), at least once while writing.
For example, is there an an array slot read by Line 5 at some iteration i,j,k before being written in Line 6 at some iteration i′,j′,k′. Answering this particular question is done by solving for the integer solutions of a system of linear equations and inequalities. Three cases need to be distinguished: (1) i<i′, (2) i=i′ and j<j′, and (3) i=i′ and j=j′.
The system below corresponds to the first case. The other two cases are treated similarly.
vars≔i,j,k,i1,j1,n
ineqs≔j=j1,k=i1,0≤i,i≤n,i+1≤j,j≤n,1≤k,k≤i−1,0≤i1,i1≤n,i1+1≤j1,j1≤n,i≤i1−1
zp≔ZPolyhedralSet⁡ineqs,vars
We apply IntegerPointDecomposition. Since no integer points are found, we deduce that there are no dependencies.
IntegerPointDecomposition⁡zp
The second problem considers memory accesses by a for-loop nest. See the image below, taken from William Pugh's paper on Presburger arithmetic.
One objective of this problem is to describe analytically the set of accessed memory locations as a function of the loop bound N. Describing this set is done by setting up a system of linear equations and inequalities and eliminating the intermediate (and unnecessary) variables. In the system below those intermediate variables (to be eliminated) are i,j,di,dj, whereas x,y,N are seen as parameters.
ineqs≔x=i+di,y=j+dj,2≤i,i≤N−1,2≤j,j≤N−1,−1≤di+dj,di−dj≤1,di+dj≤1,−1≤di−dj
vars≔di,dj,i,j;params≔x,y,N
vars≔di,dj,i,j
params≔x,y,N
pzp≔ZPolyhedralSet⁡ineqs,vars,:-parameters=params
Applying IntegerPointDecomposition we obtain necessary and sufficient constraints for the system to have integer solutions.
ipd≔IntegerPointDecomposition⁡pzp
ipd≔Relations:di=x−idj=y−j−i≤−2−j≤−2i−N≤−1j−N≤−1−y+j≤1y−j≤1−x−y+j≤−1−x+y−j≤−1−x+i−y+j≤1−x+i+y−j≤1x−i−y+j≤1x−i+y−j≤1x−y+j−N≤0x+y−j−N≤0Variables:di,dj,i,jParameters:x,y,NParameterConstraints:−N≤−3−x≤−1−y≤−1−x−y≤−3x−N≤0y−N≤0−x+y−N≤−2x−y−N≤−2x+y−2⁢N≤−1Lattice:ZSpan−101000−10101000001000001000001000001,,,0000000
Those constraints form the desired answer. We note that they define a Z-polyhedral set, which is two-dimensional in the variables x and y, as well as parametric in N.
GetParametersConstraints⁡ipd1
−N≤−3,−x≤−1,−y≤−1,−x−y≤−3,x−N≤0,y−N≤0,−x+y−N≤−2,x−y−N≤−2,x+y−2⁢N≤−1
Rui-Juan Jing and Marc Moreno Maza. "Computing the Integer Points of a Polyhedron, I: Algorithm." Proceedings of CASC 2017: 225-241, Springer.
Rui-Juan Jing and Marc Moreno Maza. "Computing the Integer Points of a Polyhedron, II: Complexity Estimates." Proceedings of CASC 2017: 242-256, Springer.
Rachid Seghir, Vincent Loechner, and Benoı̂t Meister. "Integer affine transformations of parametric Z-polytopes and applications to loop nest optimization." Proceedings of TACO, Vol. 9(2):8:1–8:27, 2012.
William Pugh. "The omega test: a fast and practical integer programming algorithm for dependence analysis." Proceedings Supercomputing ’91, pp 4–13. ACM, 1991.
William Pugh. "Counting solutions to presburger formulas: How and why." Proceedings of PLDI, pp 121–134. ACM, 1994.
The PolyhedralSets:-ZPolyhedralSets package was introduced in Maple 2023.
For more information on Maple 2023 changes, see Updates in Maple 2023.
See Also
EnumerateIntegerPoints
IntegerPointDecomposition
IsContained
IsEmpty
IsIntegerPointOf
Lattice
PlotIntegerPoints3d
SamplePoint
ZPolyhedralSet
Download Help Document