iscc: add some comparison operations
[barvinok.git] / doc / isl.tex
blob5eae623d723bc3b607cd17dd95fe0dfd6a98e677
1 \section{\protect\isl/ interface}
3 \subsection{Library}
5 The \barvinok/ library currently supports just two
6 functions that interface with the \isl/ library.
7 In time, this interface will grow and is set to replace
8 the \PolyLib/ interface.
9 For more information on the \isl/ data structures, see
10 the \isl/ user manual.
12 \begin{verbatim}
13 __isl_give isl_pw_qpolynomial *isl_set_card(__isl_take isl_set *set);
14 \end{verbatim}
15 Compute the number of elements in an \ai[\tt]{isl\_set}.
16 The resulting \ai[\tt]{isl\_pw\_qpolynomial} has purely parametric cells.
18 \begin{verbatim}
19 __isl_give isl_pw_qpolynomial *isl_map_card(__isl_take isl_map *map);
20 \end{verbatim}
21 Compute a closed form expression for the number of image elements
22 associated to any element in the domain of the given \ai[\tt]{isl\_map}.
23 The union of the cells in the resulting \ai[\tt]{isl\_pw\_qpolynomial}
24 is equal to the domain of the input \ai[\tt]{isl\_map}.
26 \begin{verbatim}
27 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sum(
28 __isl_take isl_pw_qpolynomial *pwqp);
29 \end{verbatim}
30 Compute the sum of the given piecewise quasipolynomial over
31 all integer points in the domain. The result is a piecewise
32 quasipolynomial that only involves the parameters.
34 \subsection{Calculator}
36 The \ai[\tt]{iscc} calculator offers an interface to some
37 of the functionality provided by the \isl/ and \barvinok/
38 libraries.
39 The supported operations are shown in \autoref{t:iscc}.
40 Here are some examples:
41 \begin{verbatim}
42 P := [n, m] -> { [i,j] : 0 <= i <= n and i <= j <= m };
43 card P;
45 f := [n,m] -> { [i,j] -> i*j + n*i*i*j : i,j >= 0 and 5i + 27j <= n+m };
46 sum f;
47 s := sum f;
48 s @ [n,m] -> { [] : 0 <= n,m <= 20 };
50 f := [n] -> { [i] -> 2*n*i - n*n + 3*n - 1/2*i*i - 3/2*i-1 :
51 (exists j : 0 <= i < 4*n-1 and 0 <= j < n and
52 2*n-1 <= i+j <= 4*n-2 and i <= 2*n-1 ) };
53 ub f;
54 u := ub f;
55 u @ [n] -> { [] : 0 <= n <= 10 };
57 m := [n] -> { [i,j] -> [i+1,j+1] : 1 <= i,j < n;
58 [i,j] -> [i+1,j-1] : 1 <= i < n and 2 <= j <= n };
59 m^+;
60 (m^+)[0];
61 \end{verbatim}
63 \bottomcaption{{\tt iscc} operations. The variables
64 have the following types,
65 $s$: set,
66 $m$: map,
67 $q$: piecewise quasipolynomial,
68 $f$: piecewise quasipolynomial fold,
69 $l$: list,
70 $i$: integer,
71 $b$: boolean
73 \label{t:iscc}
74 \tablehead{
75 Syntax & Meaning
77 \hline
79 \tabletail{
80 \multicolumn{2}{r}{\small\sl continued on next page}
83 \tablelasttail{}
84 \begin{supertabular}{lp{0.7\textwidth}}
85 $s_2$ := \ai[\tt]{aff} $s_1$ & affine hull of $s_1$
87 $m_2$ := \ai[\tt]{aff} $m_1$ & affine hull of $m_1$
89 $q$ := \ai[\tt]{card} $s$ &
90 number of elements in the set $s$
92 $q$ := \ai[\tt]{card} $m$ &
93 number of elements in the image of a domain element
95 $s$ := \ai[\tt]{dom} $m$ &
96 domain of map $m$
98 $s$ := \ai[\tt]{dom} $q$ &
99 domain of piecewise quasipolynomial $q$
101 $s$ := \ai[\tt]{dom} $f$ &
102 domain of piecewise quasipolynomial fold $f$
104 $s$ := \ai[\tt]{ran} $m$ &
105 range of map $m$
107 $s_2$ := \ai[\tt]{lexmin} $s_1$ &
108 lexicographically minimal element of $s_1$
110 $m_2$ := \ai[\tt]{lexmin} $m_1$ &
111 lexicographically minimal image element
113 $s_2$ := \ai[\tt]{lexmax} $s_1$ &
114 lexicographically maximal element of $s_1$
116 $m_2$ := \ai[\tt]{lexmax} $m_1$ &
117 lexicographically maximal image element
119 $s_2$ := \ai[\tt]{sample} $s_1$ &
120 a sample element of the set $s_1$
122 $m_2$ := \ai[\tt]{sample} $m_1$ &
123 a sample element of the map $m_1$
125 $q_2$ := \ai[\tt]{sum} $q_1$ &
126 sum $q_1$ over all integer points in the domain of $q_1$
128 $f$ := \ai[\tt]{ub} $q$ &
129 upper bound on the piecewise quasipolynomial $q$ over
130 all integer points in the domain of $q$.
131 This operation is only available if
132 \ai[\tt]{GiNaC} support was compiled in.
134 $s_3$ := $s_1$ \ai{$+$} $s_2$ & union
136 $m_3$ := $m_1$ \ai{$+$} $m_2$ & union
138 $q_3$ := $q_1$ \ai{$+$} $q_2$ & sum
140 $s_3$ := $s_1$ \ai{$-$} $s_2$ & set difference
142 $m_3$ := $m_1$ \ai{$-$} $m_2$ & set difference
144 $q_3$ := $q_1$ \ai{$-$} $q_2$ & difference
146 $s_3$ := $s_1$ \ai{$*$} $s_2$ & intersection
148 $m_3$ := $m_1$ \ai{$*$} $m_2$ & intersection
150 $q_3$ := $q_1$ \ai{$*$} $q_2$ & product
152 $m_2$ := $m_1$ \ai{$*$} $s$ & intersect domain of $m_1$ with $s$
154 $q_2$ := $q_1$ \ai{$*$} $s$ & intersect domain of $q_1$ with $s$
156 $f_2$ := $f_1$ \ai{$*$} $s$ & intersect domain of $f_1$ with $s$
158 $m_3$ := $m_1$ \ai[\tt]{.} $m_2$ & join of $m_1$ and $m_2$
160 $m$ := $s_1$ \ai[\tt]{->} $s_2$ & universal map with domain $s_1$
161 and range $s_2$
163 $q_2$ := $q_1$ \ai{@} $s$ &
164 evaluate the piecewise quasipolynomial $q_1$ in each element
165 of the set $s$ and return a piecewise quasipolynomial
166 mapping each of the individual elements to the resulting
167 constant
169 $q$ := $f$ \ai{@} $s$ &
170 evaluate the piecewise quasipolynomial fold $f$ in each element
171 of the set $s$ and return a piecewise quasipolynomial
172 mapping each of the individual elements to the resulting
173 constant
175 $m_2$ := $m_1$\ai[\tt]{\^{}-1} & inverse of $m_1$
177 $l$ := $m$\ai[\tt]{\^{}+} &
178 compute an overapproximation of the transitive closure
179 of $m$ and return a list containing the overapproximation
180 and a boolean that is true if the overapproximation
181 is known to be exact
183 $l$[$i$] &
184 the element at position $i$ in the list $l$
186 $b$ := $s_1$ \ai[\tt]{=} $s_2$ & is $s_1$ equal to $s_2$?
188 $b$ := $m_1$ \ai[\tt]{=} $m_2$ & is $m_1$ equal to $m_2$?
190 $b$ := $s_1$ \ai[\tt]{<=} $s_2$ & is $s_1$ a subset of $s_2$?
192 $b$ := $m_1$ \ai[\tt]{<=} $m_2$ & is $m_1$ a subset of $m_2$?
194 $b$ := $s_1$ \ai[\tt]{<} $s_2$ & is $s_1$ a proper subset of $s_2$?
196 $b$ := $m_1$ \ai[\tt]{<} $m_2$ & is $m_1$ a proper subset of $m_2$?
198 $b$ := $s_1$ \ai[\tt]{>=} $s_2$ & is $s_1$ a superset of $s_2$?
200 $b$ := $m_1$ \ai[\tt]{>=} $m_2$ & is $m_1$ a superset of $m_2$?
202 $b$ := $s_1$ \ai[\tt]{>} $s_2$ & is $s_1$ a proper superset of $s_2$?
204 $b$ := $m_1$ \ai[\tt]{>} $m_2$ & is $m_1$ a proper superset of $m_2$?
206 \end{supertabular}