1
# CLooG example file #1.
2
# Please read this example carefully to understand how the input file is made.
3
# Do not worry, it is quite easy !
5
################################################################################
6
# The problem here is to generate the scanning code for the integral points #
7
# inside a 2-dimensional polyhedron (geometrically a square). #
13
# n-+-*****--j<=n | for (i=2;i<=n;i++) { #
14
# | ***** | for (j=2;j<=n;j++) { #
17
# 2-+-*****--j>=2 | } #
24
# System : 2<=i<=n | #
27
################################################################################
29
# Comments begin with a # and finish with the line.
30
# Typically, a ClooG input file has 7 points:
32
# 1. First we need to set the output language, here: C. You can also prefer to
36
# 2. Second, we have to give the constraints on parameters (i.e. unknown values
37
# that are constant during scanning) here {n | n>=2}. The constraints are
38
# described using a matrix. First we give the row and column numbers. Then
39
# we give the constraints themselves. The first number is 0 if the constraint
40
# is an equality =0, it is 1 if the constraint is an inequality >=0. The
41
# other entries are the coefficients of the parameters and then the scalar.
42
1 3 # 1 row, 3 columns
44
1 1 -2 # this means 1*n + -2*1 >= 0, i.e. n>=2
46
# 3. Third, let us set the parameter names. We just put 0 if we want to let
47
# CLooG decide names, 1 otherwise. If we put 1, at the next line we give the
48
# space-separated parameter list (here we set only n).
52
# 4. Fourth we give the number of polyhedra to scan, here 1.
55
# 5. Fifth, we give the list of polyhedra. Each polyhedron is described using
57
# 5.1 Each co-called polyhedron may be actually an union of disjoint
58
# polyhedra, so we begin with precising the number of disjoint polyhedra
59
# of the union (here 1, there is only one part).
60
# 5.2 The constraint matrix, in the same way as in part 2. First column is
61
# the equality/inequality tag, then the variable coefficients, then the
62
# parameter coefficients, then the scalar. Here we want the following
63
# domain: {i, j | 2<=i<=n 2<=j<=n}.
64
# 5.3 A line with three zeroes, this is historical.
65
1 # 1 the union has only one element
66
4 5 # 4 rows, 5 columns
68
1 1 0 0 -2 # i-2>=0, i.e. i>=2
69
1 -1 0 1 0 # -i+n>=0, i.e. i<=n
70
1 0 1 0 -2 # j-2>=0, i.e. j>=2
71
1 0 -1 1 0 # -j+n>=0, i.e. j<=n
74
# 6. Sixth, let us set the iterator names. We just put 0 if we want to let CLooG
75
# decide names, 1 otherwise. If we put 1, at the next line we give the
76
# space-separated iterator list (here we let CLooG do).
79
# 7. Seventh, let us define a scanning order. But let us study it later and just
80
# put 0: CLoog can scan the polyhedra in the way it wants !