~ubuntu-branches/ubuntu/trusty/cloog/trusty

« back to all changes in this revision

Viewing changes to test/published/Web/web1.cloog

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-01-13 04:29:53 UTC
  • mfrom: (3.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20130113042953-yffow2nvsub33dcd
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 !
 
4
#
 
5
################################################################################
 
6
# The problem here is to generate the scanning code for the integral points    #
 
7
# inside a 2-dimensional polyhedron (geometrically a square).                  #
 
8
#                                      |                                       #
 
9
#             j^                       |                                       #
 
10
#              | i>=2                  |                                       #
 
11
#              | |   i<=n              |                                       #
 
12
#              | |   |                 |                                       #
 
13
#            n-+-*****--j<=n           |       for (i=2;i<=n;i++) {            #
 
14
#              | *****                 |         for (j=2;j<=n;j++) {          #
 
15
#              | *****                ==>           S1 ;                       #
 
16
#              | *****                 |         }                             #
 
17
#            2-+-*****--j>=2           |       }                               #
 
18
#              | |   |                 |                                       #
 
19
#            0-+-+---+--->i            |                                       #
 
20
#              | |   |                 |                                       #
 
21
#              0 2   n                 |                                       #
 
22
#                                      |                                       #
 
23
#            Context : n>=2            |                                       #
 
24
#            System  : 2<=i<=n         |                                       #
 
25
#                      2<=j<=m         |                                       #
 
26
#                                      |                                       #
 
27
################################################################################
 
28
#
 
29
# Comments begin with a # and finish with the line.
 
30
# Typically, a ClooG input file has 7 points:
 
31
 
 
32
# 1. First we need to set the output language, here: C. You can also prefer to
 
33
#    set f for FORTRAN.
 
34
c
 
35
 
 
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
 
43
#  n  1
 
44
1  1 -2 # this means 1*n + -2*1 >= 0, i.e. n>=2
 
45
 
 
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).
 
49
1
 
50
n
 
51
 
 
52
# 4. Fourth we give the number of polyhedra to scan, here 1.
 
53
1
 
54
 
 
55
# 5. Fifth, we give the list of polyhedra. Each polyhedron is described using
 
56
#    three parts:
 
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
 
67
#   i   j   n   1
 
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
 
72
0   0   0         # 3 zeroes !
 
73
 
 
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).
 
77
0
 
78
 
 
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 !
 
81
0