iscc: add affine hull operation
[barvinok.git] / doc / isl.tex
blob1b38e6a347f844e7b266516945f063399dca0fde
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
72 \label{t:iscc}
73 \tablehead{
74 Syntax & Meaning
76 \hline
78 \tabletail{
79 \multicolumn{2}{r}{\small\sl continued on next page}
82 \tablelasttail{}
83 \begin{supertabular}{lp{0.7\textwidth}}
84 $s_2$ := \ai[\tt]{aff} $s_1$ & affine hull of $s_1$
86 $m_2$ := \ai[\tt]{aff} $m_1$ & affine hull of $m_1$
88 $q$ := \ai[\tt]{card} $s$ &
89 number of elements in the set $s$
91 $q$ := \ai[\tt]{card} $m$ &
92 number of elements in the image of a domain element
94 $s$ := \ai[\tt]{dom} $m$ &
95 domain of map $m$
97 $s$ := \ai[\tt]{dom} $q$ &
98 domain of piecewise quasipolynomial $q$
100 $s$ := \ai[\tt]{dom} $f$ &
101 domain of piecewise quasipolynomial fold $f$
103 $s$ := \ai[\tt]{ran} $m$ &
104 range of map $m$
106 $s_2$ := \ai[\tt]{lexmin} $s_1$ &
107 lexicographically minimal element of $s_1$
109 $m_2$ := \ai[\tt]{lexmin} $m_1$ &
110 lexicographically minimal image element
112 $s_2$ := \ai[\tt]{lexmax} $s_1$ &
113 lexicographically maximal element of $s_1$
115 $m_2$ := \ai[\tt]{lexmax} $m_1$ &
116 lexicographically maximal image element
118 $s_2$ := \ai[\tt]{sample} $s_1$ &
119 a sample element of the set $s_1$
121 $m_2$ := \ai[\tt]{sample} $m_1$ &
122 a sample element of the map $m_1$
124 $q_2$ := \ai[\tt]{sum} $q_1$ &
125 sum $q_1$ over all integer points in the domain of $q_1$
127 $f$ := \ai[\tt]{ub} $q$ &
128 upper bound on the piecewise quasipolynomial $q$ over
129 all integer points in the domain of $q$.
130 This operation is only available if
131 \ai[\tt]{GiNaC} support was compiled in.
133 $s_3$ := $s_1$ \ai{$+$} $s_2$ & union
135 $m_3$ := $m_1$ \ai{$+$} $m_2$ & union
137 $q_3$ := $q_1$ \ai{$+$} $q_2$ & sum
139 $s_3$ := $s_1$ \ai{$-$} $s_2$ & set difference
141 $m_3$ := $m_1$ \ai{$-$} $m_2$ & set difference
143 $q_3$ := $q_1$ \ai{$-$} $q_2$ & difference
145 $s_3$ := $s_1$ \ai{$*$} $s_2$ & intersection
147 $m_3$ := $m_1$ \ai{$*$} $m_2$ & intersection
149 $q_3$ := $q_1$ \ai{$*$} $q_2$ & product
151 $m_2$ := $m_1$ \ai{$*$} $s$ & intersect domain of $m_1$ with $s$
153 $q_2$ := $q_1$ \ai{$*$} $s$ & intersect domain of $q_1$ with $s$
155 $f_2$ := $f_1$ \ai{$*$} $s$ & intersect domain of $f_1$ with $s$
157 $m_3$ := $m_1$ \ai[\tt]{.} $m_2$ & join of $m_1$ and $m_2$
159 $m$ := $s_1$ \ai[\tt]{->} $s_2$ & universal map with domain $s_1$
160 and range $s_2$
162 $q_2$ := $q_1$ \ai{@} $s$ &
163 evaluate the piecewise quasipolynomial $q_1$ in each element
164 of the set $s$ and return a piecewise quasipolynomial
165 mapping each of the individual elements to the resulting
166 constant
168 $q$ := $f$ \ai{@} $s$ &
169 evaluate the piecewise quasipolynomial fold $f$ in each element
170 of the set $s$ and return a piecewise quasipolynomial
171 mapping each of the individual elements to the resulting
172 constant
174 $l$ := $m$\ai[\tt]{\^{}+} &
175 compute an overapproximation of the transitive closure
176 of $m$ and return a list containing the overapproximation
177 and a boolean that is true if the overapproximation
178 is known to be exact
180 $l$[$i$] &
181 the element at position $i$ in the list $l$
183 \end{supertabular}