iscc: add deltas operation
[barvinok.git] / doc / isl.tex
blob8ed00595fd5d4b5dfbe35d54fcba9d54d2f7419b
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_2$ := \ai[\tt]{coalesce} $s_1$ &
96 simplify the representation of set $s_1$ by trying
97 to combine pairs of basic sets into a single
98 basic set
100 $m_2$ := \ai[\tt]{coalesce} $m_1$ &
101 simplify the representation of map $m_1$ by trying
102 to combine pairs of basic maps into a single
103 basic map
105 $q_2$ := \ai[\tt]{coalesce} $q_1$ &
106 simplify the representation of $q_1$ by trying
107 to combine pairs of basic sets in the domain
108 of $q_1$ into a single basic set
110 $f_2$ := \ai[\tt]{coalesce} $f_1$ &
111 simplify the representation of $f_1$ by trying
112 to combine pairs of basic sets in the domain
113 of $f_1$ into a single basic set
115 $s_3$ := $s_1$ \ai[\tt]{cross} $s_2$ &
116 Cartesian product of $s_1$ and $s_2$
118 $m_3$ := $m_1$ \ai[\tt]{cross} $m_2$ &
119 Cartesian product of $m_1$ and $m_2$
121 $s$ := \ai[\tt]{deltas} $m$ &
122 the set $\{\, y - x \mid x \to y \in m \,\}$
124 $s$ := \ai[\tt]{dom} $m$ &
125 domain of map $m$
127 $s$ := \ai[\tt]{dom} $q$ &
128 domain of piecewise quasipolynomial $q$
130 $s$ := \ai[\tt]{dom} $f$ &
131 domain of piecewise quasipolynomial fold $f$
133 $s$ := \ai[\tt]{ran} $m$ &
134 range of map $m$
136 $s_2$ := \ai[\tt]{lexmin} $s_1$ &
137 lexicographically minimal element of $s_1$
139 $m_2$ := \ai[\tt]{lexmin} $m_1$ &
140 lexicographically minimal image element
142 $s_2$ := \ai[\tt]{lexmax} $s_1$ &
143 lexicographically maximal element of $s_1$
145 $m_2$ := \ai[\tt]{lexmax} $m_1$ &
146 lexicographically maximal image element
148 $s_2$ := \ai[\tt]{sample} $s_1$ &
149 a sample element of the set $s_1$
151 $m_2$ := \ai[\tt]{sample} $m_1$ &
152 a sample element of the map $m_1$
154 $q_2$ := \ai[\tt]{sum} $q_1$ &
155 sum $q_1$ over all integer points in the domain of $q_1$
157 $f$ := \ai[\tt]{ub} $q$ &
158 upper bound on the piecewise quasipolynomial $q$ over
159 all integer points in the domain of $q$.
160 This operation is only available if
161 \ai[\tt]{GiNaC} support was compiled in.
163 $s_3$ := $s_1$ \ai{$+$} $s_2$ & union
165 $m_3$ := $m_1$ \ai{$+$} $m_2$ & union
167 $q_3$ := $q_1$ \ai{$+$} $q_2$ & sum
169 $s_3$ := $s_1$ \ai{$-$} $s_2$ & set difference
171 $m_3$ := $m_1$ \ai{$-$} $m_2$ & set difference
173 $q_3$ := $q_1$ \ai{$-$} $q_2$ & difference
175 $s_3$ := $s_1$ \ai{$*$} $s_2$ & intersection
177 $m_3$ := $m_1$ \ai{$*$} $m_2$ & intersection
179 $q_3$ := $q_1$ \ai{$*$} $q_2$ & product
181 $m_2$ := $m_1$ \ai{$*$} $s$ & intersect domain of $m_1$ with $s$
183 $q_2$ := $q_1$ \ai{$*$} $s$ & intersect domain of $q_1$ with $s$
185 $f_2$ := $f_1$ \ai{$*$} $s$ & intersect domain of $f_1$ with $s$
187 $m_3$ := $m_1$ \ai[\tt]{.} $m_2$ & join of $m_1$ and $m_2$
189 $m$ := $s_1$ \ai[\tt]{->} $s_2$ & universal map with domain $s_1$
190 and range $s_2$
192 $q_2$ := $q_1$ \ai{@} $s$ &
193 evaluate the piecewise quasipolynomial $q_1$ in each element
194 of the set $s$ and return a piecewise quasipolynomial
195 mapping each of the individual elements to the resulting
196 constant
198 $q$ := $f$ \ai{@} $s$ &
199 evaluate the piecewise quasipolynomial fold $f$ in each element
200 of the set $s$ and return a piecewise quasipolynomial
201 mapping each of the individual elements to the resulting
202 constant
204 $s_3$ := $s_1$ \ai[\tt]{\%} $s_2$ &
205 simplify $s_1$ in the context of $s_2$, i.e., compute
206 the gist of $s_1$ given $s_2$
208 $m_3$ := $m_1$ \ai[\tt]{\%} $m_2$ &
209 simplify $m_1$ in the context of $m_2$, i.e., compute
210 the gist of $m_1$ given $m_2$
212 $q_2$ := $q_1$ \ai[\tt]{\%} $s$ &
213 simplify $q_1$ in the context of the domain $s$, i.e., compute
214 the gist of $q_1$ given $s$
216 $f_2$ := $f_1$ \ai[\tt]{\%} $s$ &
217 simplify $f_1$ in the context of the domain $s$, i.e., compute
218 the gist of $f_1$ given $s$
220 $m_2$ := $m_1$\ai[\tt]{\^{}-1} & inverse of $m_1$
222 $l$ := $m$\ai[\tt]{\^{}+} &
223 compute an overapproximation of the transitive closure
224 of $m$ and return a list containing the overapproximation
225 and a boolean that is true if the overapproximation
226 is known to be exact
228 $l$[$i$] &
229 the element at position $i$ in the list $l$
231 $b$ := $s_1$ \ai[\tt]{=} $s_2$ & is $s_1$ equal to $s_2$?
233 $b$ := $m_1$ \ai[\tt]{=} $m_2$ & is $m_1$ equal to $m_2$?
235 $b$ := $s_1$ \ai[\tt]{<=} $s_2$ & is $s_1$ a subset of $s_2$?
237 $b$ := $m_1$ \ai[\tt]{<=} $m_2$ & is $m_1$ a subset of $m_2$?
239 $b$ := $s_1$ \ai[\tt]{<} $s_2$ & is $s_1$ a proper subset of $s_2$?
241 $b$ := $m_1$ \ai[\tt]{<} $m_2$ & is $m_1$ a proper subset of $m_2$?
243 $b$ := $s_1$ \ai[\tt]{>=} $s_2$ & is $s_1$ a superset of $s_2$?
245 $b$ := $m_1$ \ai[\tt]{>=} $m_2$ & is $m_1$ a superset of $m_2$?
247 $b$ := $s_1$ \ai[\tt]{>} $s_2$ & is $s_1$ a proper superset of $s_2$?
249 $b$ := $m_1$ \ai[\tt]{>} $m_2$ & is $m_1$ a proper superset of $m_2$?
251 \end{supertabular}