GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
\documentclass[12pt,a4paper]{scrartcl}1\usepackage{amsmath}2\usepackage{amsfonts}3\usepackage{amsthm}4\usepackage{amssymb}5\usepackage[latin1]{inputenc}6\usepackage{mathptmx}7\usepackage{}8\usepackage{array}9\usepackage{color}10\usepackage{hyperref}11\usepackage{url}12\usepackage{graphicx}13\usepackage{multicol}14\usepackage{dsfont}1516\usepackage{booktabs}1718%\usepackage[ignoreunlbld,nomsgs]{refcheck}1920\usepackage{pgf, tikz}21\usepackage{color}2223% !TeX spellcheck = en_US2425%\textwidth=15cm \textheight=22cm \topmargin=0.5cm26%\oddsidemargin=0.5cm \evensidemargin=0.5cm2728\usepackage[T1]{fontenc}2930\usepackage[scaled=0.8]{beramono}3132\usepackage{fancyvrb} \RecustomVerbatimEnvironment{Verbatim}{Verbatim}33{xleftmargin=15pt, frame=single, fontsize=\small}343536\newcounter{listi}37\newcommand{\stdli}{ \topsep0ex \partopsep0ex % .5ex plus.25ex minus.125ex%38\parsep.2ex plus.1ex minus.1ex \itemsep0ex% .5ex plus.25ex minus.125ex%39\leftmargin2.5em \labelwidth2em \labelsep.5em \rightmargin0em}% \samepage }40\newenvironment{arab}{\begin{list}{\textup{(\arabic{listi})}}%41{\usecounter{listi}\stdli}}{\end{list}}42\newenvironment{rome}{\begin{list}{\textup{(\roman{listi})}}%43{\usecounter{listi}\stdli}}{\end{list}}44\newenvironment{latin}{\begin{list}{\textup{(\alph{listi})}}%45{\usecounter{listi}\stdli}}{\end{list}}46\renewenvironment{itemize}{\begin{list}{{$\bullet$}}{\stdli}}{\end{list}}47\newenvironment{myverb}{\begin{small}}{\end{small}\pagebreak[2]} %%%%% \vspace{-0.8\baselineskip}484950\newtheorem{theorem}{Theorem}51\newtheorem{lemma}[theorem]{Lemma}52\newtheorem{corollary}[theorem]{Corollary}53\newtheorem{proposition}[theorem]{Proposition}545556\theoremstyle{definition}57\newtheorem{remark}[theorem]{Remark}58\newtheorem{definition}[theorem]{Definition}5960\let\phi=\varphi6162\def\CC{{\mathbb C}}63\def\ZZ{{\mathbb Z}}64\def\QQ{{\mathbb Q}}65\def\RR{{\mathbb R}}66\def\EE{{\mathbb E}}67\def\AA{{\mathbb A}}68\def\PP{{\mathbb P}}69\def\NN{{\mathbb N}}7071\def\cL{{\mathcal L}}7273\def\Ker{\operatorname{Ker}}74\def\Im{\operatorname{Im}}75\DeclareMathOperator{\gp}{gp}76\DeclareMathOperator{\rank}{rank}77\DeclareMathOperator{\conv}{conv}78\DeclareMathOperator{\aff}{aff}79\DeclareMathOperator{\cone}{cone}80\DeclareMathOperator{\rec}{rec}81\DeclareMathOperator{\mrank}{mrank}82\DeclareMathOperator{\Hilb}{Hilb}83\DeclareMathOperator{\vol}{vol}84\DeclareMathOperator{\Cl}{Cl}85\DeclareMathOperator{\para}{par}8687\DeclareMathOperator{\totdeg}{totdeg}888990\def\cG{{\mathcal G}}91\def\cR{{\mathcal R}}9293\let\hat=\widehat94\let\tilde=\widetilde95\let\Bar=\overline9697\let\iso=\cong9899\let\epsilon=\varepsilon100\def\discuss#1{\marginparsep=1em\marginparwidth=60pt101\marginpar{\tt \footnotesize \raggedright #1}}102103\definecolor{darkgray}{gray}{0.00}104105\addtokomafont{section}{\color{darkgray}}106107\setkomafont{sectionentry}{\large}108109\addtokomafont{subsection}{\color{darkgray}}110111\addtokomafont{subsubsection}{\normalsize}112113\parindent=0pt \parskip=4pt114115\setcounter{tocdepth}{3}116117%\def\Normaliz#1+{\textsf{Normaliz}}118%\def\jNormaliz#1+{\textsf{jNormaliz}}119%\def\NmzIntegrate#1+{\textsf{NmzIntegrate}}120121\def\itemtt[#1]{\item[\textbf{\ttt{#1}}]}122123\def\ttt{\texttt}124125\def\version{3.4.0}126\def\NmzDir{normaliz-\version}127128129\begin{document}130\vspace*{2cm}131132\centerline{\Large\textbf{Normaliz \version}} \vspace*{0.5cm}133134\centerline{\today}135136\vspace*{1cm}137138\begin{center}Winfried Bruns, Tim R�mer, Richard Sieg and Christof139S�ger\\[14pt]140Normaliz 2 team member: Bogdan Ichim\\[14pt]141\url{http://normaliz.uos.de}\qquad\qquad\qquad142\url{https://github.com/Normaliz}\\[14pt]143\url{mailto:normaliz@uos.de}144\end{center}145146147148\tableofcontents149150\newpage151152%%%%%%%%%%%%%%%%%%%%%%%%%%%%% INTRODUCTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%153\section{Introduction}\label{facil}154155\subsection{The objectives of Normaliz}156157The program Normaliz is a tool for computing158the Hilbert bases and enumerative data of rational cones and, more generally, sets of lattice points in rational polyhedra. The mathematical background and the terminology of this manual are explained in Appendix A. For a thorough treatment of the mathematics involved we refer the reader to159\cite{BG}. The terminology follows \cite{BG}. For160algorithms of Normaliz see \cite{BI}, \cite{BHIKS},161\cite{BIS}, \cite{BK02}, \cite{BSS}, and \cite{BS}. Some new developments are briefly explained in this manual.162163Both polyhedra and lattices can be given by164\begin{arab}165\item systems of generators and/or166\item constraints.167\end{arab}168Since version 3.1, cones need not be pointed and polyhedra need not have vertices, but are allowed to contain a positive-dimensional affine subspace.169170In addition to generators and constraints, affine monoids can be defined by lattice ideals, in other words, by binomial equations.171172In order to describe a rational polyhedron by \emph{generators}, one specifies a finite set of vertices $x_1,\dots,x_n\in\QQ^d$ and a set $y_1,\dots,y_m\in\ZZ^d$ generating a rational cone $C$. The polyhedron defined by these generators is173$$174P=\conv(x_1,\dots,x_n)+C,\qquad C=\RR_+y_1+\dots+\RR_+y_m.175$$176An affine lattice defined by generators is a subset of $\ZZ^d$ given as177$$178L=w+L_0,\qquad L_0=\ZZ z_1+\dots+\ZZ z_r, \qquad w,z_1,\dots,z_r\in \ZZ^d.179$$180\emph{Constraints} defining a polyhedron are affine-linear inequalities with integral coefficients, and the constraints for an affine lattice are affine-linear diophantine equations and congruences. The conversion between generators and constraints is an important task of Normaliz.181182183The first main goal of Normaliz is to compute a system of generators for184$$185P\cap L.186$$187The minimal system of generators of the monoid $M=C\cap L_0$ is the Hilbert basis $\Hilb(M)$ of $M$. The homogeneous case, in which $P=C$ and $L=L_0$, is undoubtedly the most important one, and in this case $\Hilb(M)$ is the system of generators to be computed. In the general case the system of generators consists of $\Hilb(M)$ and finitely many points $u_1,\dots,u_s\in P\cap L$ such that188$$189P\cap L=\bigcup_{j=1}^s u_j+M.190$$191192The second main goal are enumerative data that depend on a grading193of the ambient lattice. Normaliz computes the Hilbert series and194the Hilbert quasipolynomial of the monoid or set of lattice points in a polyhedron. In combinatorial terminology: Normaliz computes Ehrhart series and quasipolynomials of rational polyhedra. Normaliz also computes weighted195Ehrhart series and Lebesgue integrals of polynomials over196rational polytopes.197198Normaliz now has a variant called QNormaliz. Its basic number class are elements of a subfield of $\RR$ instead of integers. This extends the scope of Normaliz to certain nonrational polyhedra, but limits its applicability to convex hull computations and triangulations since finite generation of the lattice points in such polyhedra is no longer given.199200The computation goals of Normaliz can be set by the user. In particular, they can be restricted to subtasks, such as the lattice points in a polytope or the leading coefficient of the Hilbert (quasi)polynomial.201202Performance data of Normaliz can be found in \cite{BIS}.203204\emph{Acknowledgement.}\enspace In 2013--2016 the development of Normaliz has been supported by the DFG SPP 1489 ``Algorithmische und ex\-pe\-rimentelle Methoden in Algebra, Geometrie und Zahlentheorie''.205206\subsection{Platforms, implementation and access from other systems}207208Executables for Normaliz are provided for Mac OS, Linux and MS Windows. If the executables prepared cannot be run on your system, then you can compile Normaliz yourself (see Section \ref{Compile}). The statically linked Linux binaries provided by us can be run in the Linux subsystem that is available in MS Windows 10.209210Normaliz is written in C++, and should be compilable on every system that has a GCC compatible compiler. It uses the standard packages Boost and GMP (see Section \ref{Compile}). The parallelization is based on OpenMP.211212Normaliz consists of two parts: the front end ` normaliz'' for input and output and the C++ library ``libnormaliz'' that does the computations.213214Normaliz can be accessed from the interactive general purpose system \textsc{Python} via the interface \textsc{PyNormaliz} written by Sebastian Gutsche with contributions by Justin Shenk and Richard Sieg.215216Normaliz can also be accessed from the following systems:217\begin{itemize}218\item \textsc{Singular} via the library \ttt{normaliz.lib},219\item \textsc{Macaulay 2} via the package \ttt{Normaliz.m2},220\item \textsc{CoCoA} via an external library and libnormaliz,221\item \textsc{GAP} via the GAP package \textsc{NormalizInterface} \cite{GAP-NmzInterface} which uses libnormaliz,222\item \textsc{polymake} (thanks to the \textsc{polymake}223team),224\item \textsc{SageMath} via PyNormaliz (on preparation, thanks to Matthias K�ppe).225\end{itemize}226227The Singular and Macaulay 2 interfaces are contained in the228Normaliz distribution. At present, their functionality is limited to Normaliz 2.10. Nevertheless they profit from the newer versions.229230Furthermore, Normaliz is used by the B. Burton's system231\textsc{Regina} and in \textsc{SecDec} by S. Borowka et al.232233Normaliz does not have its own interactive shell. We recommend the access via PyNormaliz, GAP for SageMath (in preparation) for interactive use.234235\subsection{Major changes relative to version 3.1.1}236237In 3.2.0;238239\begin{arab}240241\item installation via \ttt{autotools} (written by Matthias K�ppe),242243% \item the Python interface PyNormaliz,244245\item automatic choice of algorithmic variants (can be switched off),246247\item sparse format for vectors and matrices,248249\item constraints in symbolic form,250251\item Hilbert series with denominator corresponding to a homogeneous system of parameters,252253\item choice of an output directory,254255\item improvements of \verb|libnormaliz|: extension of enumeration \verb|ConeProperty|, constructors based on \verb|Matrix<Integer>|, additional functions for retrieval of results,256257\item a better implementation of \verb|Approximate| and its use in the inhomogeneous case,258259\item option \verb|Symmetrize| that produces symmetrized input for nmzIntegrate and runs nmzIntegrate on this input,260261\item QNormaliz, a version of Normaliz using coordinates in an extension of $\QQ$ (restricted to convex hull computations and triangulation).262263\end{arab}264265In 3.3.0:266267\begin{arab}268\item inclusion of NmzIntegrate in Normaliz as a part of libnormaliz,269\item fractions in input files,270\item controlled interruption of Normaliz.271\end{arab}272273In 3.4.0:274275\begin{arab}276\item limit of parallelization via libnormaliz,277\item floating point numbers in input,278\item project-and-lift algorithm for lattice points in polytopes, also with a floating point variant,279\item significantly improved subdivision, equivalent replacement for Scip.280\item fast Gorenstein test,281\item restriction of number of significant coefficients of quasipolynomial,282\item definition of semi-open parallelepipeds in input and output of their lattice points.283\end{arab}284285286287See the file \verb|CHANGELOG| in the basic package for more information on the history of Normaliz.288289290\subsection{Future extensions}291292\begin{arab}293\item Computation and exploitation od automorphism groups,294\item multigraded Hilbert series,295\item access from further systems,296\item Gr�bner and Graver bases.297\end{arab}298299\subsection{Download and installation}300301Download302\begin{itemize}303\item the zip file with the Normaliz source, documentation,304examples and further platform independent components, and305306\item the zip file containing the executable for your system307\end{itemize}308from the Normaliz website\medskip309310\centerline{\url{http://normaliz.uos.de}}\medskip311312and unzip both in the same directory of your choice. In it, a313directory \ttt{\NmzDir} (called Normaliz directory in the314following) is created with several subdirectories.315316See Section \ref{Distr} for more details on the distribution and consult Section \ref{Compile} if you want to compile Normaliz yourself.317%\newpage318319\section{Normaliz by examples}\label{Examples}320321\subsection{Terminology}\label{Term}322323For the precise interpretation of parts of the Normaliz output some terminology is necessary, but this section can be skipped at first reading, and the user can come back to it when it becomes necessary. We will give less formal descriptions along the way.324325As pointed out in the introduction, Normaliz ``computes'' intersections $P\cap L$ where $P$ is a rational polyhedron in $\RR^d$ and $L$ is an affine sublattice of $\ZZ^d$. It proceeds as follows:326327\begin{arab}328\item If the input is inhomogeneous, then it is homogenized by introducing a homogenizing coordinate: the polyhedron $P$ is replaced by the cone $C(P)$: it is the closure of $\RR_+(P\times \{1\})$ in $\RR^{d+1}$. Similarly $L$ is replaced by $\widetilde L=\ZZ(L\times \{1\})$. In the homogeneous case in which $P$ is a cone and $L$ is a subgroup of $\ZZ^d$, we set $C(P)=P$ and $\widetilde L=L$.329330\item The computations take place in the \emph{efficient lattice}331$$332\EE=\widetilde{L}\cap \RR C(P).333$$334where $\RR C(P)$ is the linear subspace generated by $C(P)$. The internal coordinates are chosen with respect to a basis of $\EE$. The \emph{efficient cone} is335$$336\CC=\RR_+(C(P)\cap \EE).337$$338339\item Inhomogeneous computations are truncated using the dehomogenization (defined implicitly or explicitly).340341\item The final step is the conversion to the original coordinates. Note that we must use the coordinates of $\RR^{d+1}$ if homogenization has been necessary, simply because some output vectors may be non-integral.342\end{arab}343344Normaliz computes inequalities, equations and congruences defining $\EE$ and $\CC$. The output contains only those constraints that are really needed. They must always be used jointly: the equations and congruences define $\EE$, and the equations and inequalities define $\CC$. Altogether they define the monoid $M=\CC\cap\EE$. In the homogeneous case this is the monoid to be computed. In the inhomogeneous case we must intersect $M$ with the dehomogenizing hyperplane to obtain $P\cap L$.345346In this section, only pointed cones (and polyhedra with vertices) will be discussed. Nonpointed cones will be addressed in Section \ref{Nonpointed}.347348349\subsection{Practical preparations}350351You may find it comfortable to run Normaliz via the GUI jNormaliz \cite{AI}. In the Normaliz directory open jNormaliz by clicking352\ttt{jNormaliz.jar} in the appropriate way. (We assume that353Java is installed on your machine.)354\begin{figure}[bht]355\centering356\includegraphics[width = 80 mm, bb=0 0 690 560]{jNormaliz.jpg}\\%width = 80 mm, bb=0 0 689 430357\caption{jNormaliz}\label{new}358\end{figure}359In the jNormaliz file dialogue choose one of the input files360in the subdirectory \ttt{example}, say \ttt{small.in}, and361press \ttt{Run}. In the console window you can watch Normaliz362at work. Finally inspect the output window for the results.363364The menus and dialogues of jNormaliz are self explanatory, but you365can also consult the documentation \cite{AI} via the help menu.366367\emph{Remark}\enspace The jNormaliz drop down menus do presently not cover all options of Normaliz. But since all computation goals and algorithmic variants can be set in the input file, there is no real restriction in using jNormaliz. The only option not reachable by jNormaliz is the output directory (see Section \ref{outcontrol}).368369Moreover, one can, and often will, run Normaliz from the370command line. This is fully explained in Section \ref{options}. At this point it is enough to call Normaliz by typing371\begin{Verbatim}372normaliz -c <project>373\end{Verbatim}374where \ttt{<project>} denotes for the project to be computed. Normaliz will load the file \ttt{project.in}. The option \verb|-c| makes Normaliz to write a progress report on the terminal. Normaliz writes its results to \verb|<project>.out|.375376Note that you may have to prefix \ttt{normaliz} by a path name, and \ttt{<project>} must contain a path to the input file if it is not in the current directory. Suppose the Normaliz directory is the current directory and we are using a Linux or Mac system. Then377\begin{Verbatim}378./normaliz -c example/small379\end{Verbatim}380will run \ttt{small.in} from the directory \ttt{example}. On Windows we must change this to381\begin{Verbatim}382.\normaliz -c example\small383\end{Verbatim}384385The commands given above will run Normaliz with the at most $8$ parallel threads. For the very small examples in this tutorial you may want to add \ttt{-x=1} to suppress parallelization. For large examples, you can increase the number of parallel threads by \verb|-x=<N>| where \verb|<N>| is the number of threads that you want to suggest. See Section \ref{exec}.386387As long as you don't specify a computation goal on the command line or in the input file, Normaliz will use the \emph{default computation goals}:388\begin{verbatim}389HilbertBasis390HilbertSeries391ClassGroup392\end{verbatim}393The computation of the Hilbert series requires the explicit or implicit definition of a grading. Normaliz does only complain that a computation goal cannot be reached if the goal has been set explicitly.394For example, if you say \verb|HilbertSeries| and there is no grading, an exception will be thrown and Normaliz terminates, but an output file with the already computed data will be written.395396Normaliz will always print the results that are obtained on the way to the computation goals and do not require extra effort.397398Appendix \ref{Console} helps you to read the console output that you have demanded by the option \verb|-c|.399\subsection{A cone in dimension $2$}\label{cone_ex}400401We want to investigate the cone $C=\RR_+(2,1)+\RR_+(1,3)\subset \RR^2$:402\begin{center}403\begin{tikzpicture}[scale=0.7]404\filldraw[yellow] (0,0) -- (1.833,5.5) -- (4.5,5.5) -- (4.5,2.25) -- cycle;405\draw (0,0) -- (1.833,5.5);406\draw (0,0) -- (4.5,2.25) node at (-0.3,-0.3){\small $0$};407\foreach \x in {0,...,4}408\foreach \y in {0,...,5}409{410\filldraw[fill=black] (\x,\y) circle (1.5pt);411}412\draw[red,thick] (1,1) circle (4pt);413\draw[red,thick] (1,2) circle (4pt);414\draw[red,thick] (1,3) circle (4pt);415\draw[red,thick] (2,1) circle (4pt);416\end{tikzpicture}417\end{center}418419This cone is defined in the input file \verb|2cone.in|:420\begin{Verbatim}421amb_space 2422cone 24231 34242 1425\end{Verbatim}426The input tells Normaliz that the ambient space is $\RR^2$, and then a cone with 2 generators is defined, namely the cone $C$ from above.427428The figure indicates the Hilbert basis, and this is our first computation goal.429430If you prefer to consider the columns of a matrix as input vectors (or have a matrix in this format from another system) you can use the input431\begin{Verbatim}432amb_space 2433cone transpose 24341 24353 1436\end{Verbatim}437Note that the number \verb|2| following \verb|transpose| is now the number of \emph{columns}. Later on we will also show the use of formatted matrices.438439\subsubsection{The Hilbert basis}440In order to compute the Hilbert basis, we run Normaliz from jNormaliz or by441\begin{Verbatim}442./normaliz -c example/2cone443\end{Verbatim}444and inspect the output file:445\begin{Verbatim}4464 Hilbert basis elements4472 extreme rays4482 support hyperplanes449\end{Verbatim}450Self explanatory so far.451\begin{Verbatim}452embedding dimension = 2453rank = 2 (maximal)454external index = 1455internal index = 5456original monoid is not integrally closed457\end{Verbatim}458The embedding dimension is the dimension of the space in which the computation is done. The rank is the rank of the lattice $\EE$ (notation as in Section \ref{Term}). In fact, in our example $\EE=\ZZ^2$, and therefore has rank $2$.459460For subgroups $G\subset U\subset \ZZ^d$ we denote the order of the torsion subgroup of $U/G$ by the \emph{index} of $G$ in $U$. The \emph{external index} is the index of the lattice $\EE$ in $\ZZ^d$. In our case $\EE=\ZZ^d$, and therefore the external index is $1$. Note: the external index is $1$ exactly when $\EE$ is a direct summand of $\ZZ^d$.461462For this example and many others the \emph{original monoid} is well defined: the generators of the cone used as input are contained in $\EE$. (This need not be the case if $\EE$ is a proper sublattice of $\ZZ^d$, and we let the original monoid be undefined in inhomogeneous computations.) Let $G$ be the subgroup generated by the original monoid. The \emph{internal index} is the index of $G$ in $\EE$.463464The original monoid is \emph{integrally closed} if and only if the it contains the Hilbert basis, and this is evidently false for our example. We go on.465466\begin{Verbatim}467size of triangulation = 1468resulting sum of |det|s = 5469\end{Verbatim}470The primal algorithm of Normaliz relies on a (partial) triangulation. In our case the triangulation consists of a single simplicial cone, and (the absolute value of) its determinant is~$5$.471\begin{Verbatim}472No implicit grading found473\end{Verbatim}474If you do not define a grading explicitly, Normaliz tries to find one itself: the grading is defined if and only if there is a linear form $\gamma$ on $\EE$ under which all extreme rays of the efficient cone $\CC$ have value $1$, and if so, $\gamma$ is the implicit grading. Such does not exist in our case.475476The last information before we come to the vector lists:477\begin{Verbatim}478rank of class group = 0479finite cyclic summands:4805: 1481\end{Verbatim}482The class group of the monoid $M$ has rank $0$, in other words, it is finite. It has one finite cyclic summand of order $5$.483484This is the first instance of a multiset of integers displayed as a sequence of pairs485\begin{quote}486\verb|<n>: <m>|487\end{quote}488Such an entry says: the multiset contains the number \verb|<n>| with multiplicity \verb|<m>.|489490491Now we look at the vector lists (typeset in two columns to save space):492\begin{Verbatim}4934 Hilbert basis elements: 2 extreme rays:4941 1 1 34951 2 2 14961 34972 1 2 support hyperplanes:498-1 24993 -1500\end{Verbatim}501502The support hyperplanes are given by the linear forms (or inner normal vectors):503\begin{align*}504-x_1+2x_2&\ge 0,\\5053x_1-x_2&\ge 0.506\end{align*}507508If the order is not fixed for some reason, Normaliz sorts vector lists as follows : (1) by degree if a grading exists and the application makes sense, (2) lexicographically.509510511\subsubsection{The cone by inequalities}\label{ineq_ex}512513Instead by generators, we can define the cone by the inequalities just computed (\verb|2cone_ineq.in|). We use this example to show the input of a formamtted matrix:514\begin{Verbatim}515amb_space auto516inequalities517[[-1 2] [3 -1]]518\end{Verbatim}519A matrix of input type \verb|inequalities| contains \emph{homogeneous} inequalities. Normaliz can determine the dimension of the ambient space from the formatted matrix. Therefore we can declare the ambient space as being ``auto determined'' (but \verb|amb_space 2| is not forbidden).520521We get the same result as with \verb|2cone.in| except that the data depending on the original monoid cannot be computed: the internal index and the information on the original monoid are missing since there is no original monoid.522523\subsubsection{The interior}\label{strict_ex}524Now we want to compute the lattice points in the interior of our cone. If the cone $C$ is given by the inequalities $\lambda_i(x)\ge0$ (within $\aff(C)$), then the interior is given by the inequalities $\lambda_i(x)>0$. Since we are interested in lattice points, we work with the inequalities $\lambda_i(x)\ge 1$.525526527The input file \verb|2cone_int.in| says528\begin{Verbatim}529amb_space 2530strict_inequalities 2531-1 25323 -1533\end{Verbatim}534The strict inequalities encode the conditions535\begin{align*}536-x_1+2x_2&\ge 1,\\5373x_1-x_2&\ge 1.538\end{align*}539This is our first example of inhomogeneous input.540\begin{center}541\begin{tikzpicture}[scale=0.7]542\filldraw[yellow] (0,0) -- (1.833,5.5) -- (4.5,5.5) -- (4.5,2.25) -- cycle;543\filldraw[lightgray] (0.6,0.8) -- (2.166,5.5) --(4.5,5.5) -- (4.5,2.75) -- cycle;544\draw (0,0) -- (1.833,5.5);545\draw (0,0) -- (4.5,2.25) node at (-0.3,-0.3){\small $0$};546\draw (0,-1) -- (2.166,5.5);547\draw (0,0.5) -- (4.5,2.75);548\foreach \x in {0,...,4}549\foreach \y in {0,...,5}550{551\filldraw[fill=black] (\x,\y) circle (1.5pt);552}553\draw[red,thick] (1,1) circle (4pt);554\draw[red,thick] (1,2) circle (4pt);555\draw[blue,thick] (0.6,0.8) circle (4pt);556\end{tikzpicture}557\end{center}558Alternatively we could use the following two equivalent input files, in a more intuitive notation:559\begin{Verbatim}560amb_space 2561constraints 2562-1 2 > 05633 -1 > 0564\end{Verbatim}565\begin{Verbatim}566amb_space 2567constraints 2568-1 2 >= 15693 -1 >= 1570\end{Verbatim}571There is an even more intuitive way to type the input file using symbolic constraints that we will introduce in Section \ref{cong_ex}.572573Normaliz homogenizes inhomogeneous computations by introducing an auxiliary homogenizing coordinate $x_{d+1}$. The polyhedron is obtained by intersecting the homogenized cone with the hyperplane $x_{d+1}=1$. The recession cone is the intersection with the hyperplane $x_{d+1}=0$. The recession monoid is the monoid of lattice points in the recession cone, and the set of lattice points in the polyhedron is represented by its system of module generators over the recession monoid.574575Note that the homogenizing coordinate serves as the denominator for rational vectors. In our example the recession cone is our old friend that we have already computed, and therefore we need not comment on it.576577\begin{Verbatim}5782 module generators5794 Hilbert basis elements of recession monoid5801 vertices of polyhedron5812 extreme rays of recession cone5823 support hyperplanes of polyhedron (homogenized)583584embedding dimension = 3585affine dimension of the polyhedron = 2 (maximal)586rank of recession monoid = 2587\end{Verbatim}588The only surprise may be the embedding dimension: Normaliz always takes the dimension of the space in which the computation is done. It is the number of components of the output vectors. Because of the homogenization it has increased by $1$.589\begin{Verbatim}590size of triangulation = 1591resulting sum of |det|s = 25592\end{Verbatim}593In this case the homogenized cone has stayed simplicial, but the determinant has changed.594\begin{Verbatim}595dehomogenization:5960 0 1597\end{Verbatim}598The dehomogenization is the linear form $\delta$ on the homogenized space that defines the hyperplanes from which we get the polyhedron and the recession cone by the equations $\delta(x)=1$ and $\delta(x)=0$, respectively. It is listed since one can also work with a user defined dehomogenization.599\begin{Verbatim}600module rank = 1601\end{Verbatim}602This is the rank of the module of lattice points in the polyhedron over the recession monoid. In our case the module is an ideal, and so the rank is $1$.603604The output of inhomogeneous computations is always given in homogenized form. The last coordinate is the value of the dehomogenization on the listed vectors, $1$ on the module generators, $0$ on the vectors in the recession monoid:605\begin{Verbatim}6062 module generators: 4 Hilbert basis elements of recession monoid:6071 1 1 1 1 06081 2 1 1 2 06091 3 06102 1 0611\end{Verbatim}612The module generators are $(1,1)$ and $(1,2)$.613\begin{Verbatim}6141 vertices of polyhedron:6153 4 5616\end{Verbatim}617Indeed, the polyhedron has a single vertex, namely $(3/5,4/5)$.618\begin{Verbatim}6192 extreme rays of recession cone: 3 support hyperplanes of polyhedron (homogenized):6201 3 0 -1 2 -16212 1 0 0 0 16223 -1 -1623\end{Verbatim}624Two support hyperplanes are exactly those that we have used to define the polyhedron -- and it has only $2$. But Normaliz always outputs the support hyperplanes that are needed for the cone that one obtains by homogenizing the polyhedron, as indicated by `homogenized''. The homogenizing variable is always $\ge 0$. In this case the support hyperplane $(0,0,1)$ is essential for the description of the cone. Note that it need not always appear.625626627\subsection{A lattice polytope}\label{lattice_polytope}\label{polytope_ex}628629\begin{minipage}[b]{0.5\textwidth}630The file \ttt{polytope.in} contains631632\begin{Verbatim}633amb_space 4634polytope 46350 0 06362 0 06370 3 06380 0 5639\end{Verbatim}640\end{minipage}641\hspace{1cm}642\begin{minipage}[t]{0.4\textwidth}643\tikzset{facet style/.style={opacity=1.0,very thick,line,join=round}}644\begin{tikzpicture}[x = {(-0.5cm,-0.5cm)},645y = {(0.9659cm,-0.25882cm)},646z = {(0cm,1cm)},647scale = 0.8]648\draw [->,dashed] (-0.5, 0, 0) -- (3.0,0,0);649650\draw [->,dashed] (0, -0.5, 0) -- (0,6.0,0);651652\draw [->,dashed] (0, 0, -0.5) -- (0,0,3.5);653654\draw[thin] (0,0,0) -- (2,0,0) -- (0,5,0) -- cycle;655\draw[thin] (0,0,0) -- (2,0,0) -- (0,0,3) -- cycle;656\draw[thin] (0,0,0) -- (0,5,0) -- (0,0,3) -- cycle;657\draw[thick] (2,0,0) -- (0,5,0) -- (0,0,3) -- cycle;658659\filldraw[fill=white] (0,0,0) circle (2pt);660\filldraw[fill=white] (2,0,0) circle (2pt);661\filldraw[fill=white] (0,5,0) circle (2pt);662\filldraw[fill=white] (0,0,3) circle (2pt);663\end{tikzpicture}664\end{minipage}665666This is a good place to mention that Normaliz also accepts matrices (and vectors) in sparse format:667668\begin{Verbatim}669amb_space 4670polytope 4671;6721:2;6732:3;6743:5;675\end{Verbatim}676Each input row, concluded by \verb|;|, lists the indices and the corresponding nonzero values in that row of the matrix.677678The Ehrhart monoid of the integral polytope with the $4$679vertices680$$681(0,0,0)\,,\quad (2,0,0)\,,\quad (0,3,0)\quad\text{ and }\quad (0,0,5)682$$683in $\RR^3$ is to be computed. The generators of the Ehrhart monoid are obtained by attaching a further coordinate $1$ to the vertices, and this explains \verb|amb_space 4|. In fact, the input type \verb|polytope| is nothing but a convenient (perhaps superfluous) version of684\begin{Verbatim}685amb_space 4686cone 46870 0 0 16882 0 0 16890 3 0 16900 0 5 1691\end{Verbatim}692693Running \ttt{normaliz} produces the file \ttt{polytope.out}:694\begin{Verbatim}69519 Hilbert basis elements69618 Hilbert basis elements of degree 16974 extreme rays6984 support hyperplanes699700embedding dimension = 4701rank = 4 (maximal)702external index = 1703internal index = 30704original monoid is not integrally closed705\end{Verbatim}706Perhaps a surprise: the lattice points of the polytope do not yield all Hilbert basis elements.707\begin{Verbatim}708size of triangulation = 1709resulting sum of |det|s = 30710\end{Verbatim}711Nothing really new so far. But now Normaliz finds a grading given by the last coordinate. See \ref{grading} below for general information on gradings.712\begin{Verbatim}713grading:7140 0 0 1715716degrees of extreme rays:7171: 4718\end{Verbatim}719Again we encounter the notation \verb|<n>: <m>|: we have $4$ extreme rays, all of degree $1$.720\begin{Verbatim}721Hilbert basis elements are not of degree 1722\end{Verbatim}723Perhaps a surprise: the polytope is not integrally closed as defined in \cite{BG}. Now we see the enumerative data defined by the grading:724\begin{Verbatim}725multiplicity = 30726727Hilbert series:7281 14 15729denominator with 4 factors:7301: 4731732degree of Hilbert Series as rational function = -2733734Hilbert polynomial:7351 4 8 5736with common denominator = 1737\end{Verbatim}738The polytope has $\ZZ^3$-normalized volume $30$ as indicated by the multiplicity. The Hilbert (or Ehrhart) function counts the lattice points in $kP$, $k\in\ZZ_+$. The corresponding generating function is a739rational function $H(t)$. For our polytope it is740$$741\frac{1+14t+15t^2}{(1-t)^4}.742$$743The denominator is given in multiset notation: \verb|1: 4| say that the factor $(1-t^1)$ occurs with multiplicity $4$.744745The Ehrhart polynomial (again we use a more general term in746the output file) of the polytope is747$$748p(k)=1+4k+8k^2+5k^3\,.749$$750In our case it has integral coefficients, a rare exception. Therefore one usually needs a denominator.751752Everything that follows has already been explained.753\begin{Verbatim}754755rank of class group = 0756finite cyclic summands:75730: 1758759***********************************************************************76076118 Hilbert basis elements of degree 1:7620 0 0 1763...7642 0 0 17657661 further Hilbert basis elements of higher degree:7671 2 4 27687694 extreme rays: 4 support hyperplanes:7700 0 0 1 -15 -10 -6 307710 0 5 1 0 0 1 07720 3 0 1 0 1 0 07732 0 0 1 1 0 0 0774\end{Verbatim}775776The support hyperplanes give us a description of the polytope777by inequalities: it is the solution of the system of the $4$778inequalities779$$ x_3\ge0\,,\quad780x_2\ge0\,,\quad x_1\ge0\quad\text{ and }\quad78115x_1+10x_2+6x_3\le30\,.782$$783784\subsubsection{Only the lattice points}\label{only_lattpoints}785786Suppose we want to compute only the lattice points in our polytope. In the language of graded monoids these are the degree $1$ elements, and so we add \verb|Deg1Elements| to our input file (\verb|polytope_deg1.in|):787\begin{Verbatim}788amb_space 4789polytope 47900 0 07912 0 07920 3 07930 0 5794Deg1Elements795/* This is our first explicit computation goal*/796\end{Verbatim}797We have used this opportunity to include a comment in the input file. The computation of lattice points in a polytope will be taken up again in Sections \ref{project_example} and \ref{LattPoints}.798799We lose all information on the Hilbert series, and from the Hilbert basis we only retain the degree $1$ elements.800801\subsection{A rational polytope}\label{rational}802803The type \verb|polytope| can (now) be used for rational polytopes as well.804\begin{center}805\begin{tikzpicture}[scale=3.0]806\filldraw[yellow] (0.5,0.5) -- (-0.333,-0.333) -- (0.25,-0.5) -- cycle;807\draw (0.5,0.5) -- (-0.333,-0.333) -- (0.25,-0.5) -- cycle;808\draw[->] (0,-0.6) --(0,0.6);809\draw[-> ] (-0.6,0) -- (0.6,0);810\filldraw[fill=white] (0.5,0.5) circle (0.5pt);811\filldraw[fill=white] (-0.333,-0.333) circle (0.5pt);812\filldraw[fill=white] (0.25,-0.5) circle (0.5pt);813\end{tikzpicture}814\end{center}815816We want to investigate the Ehrhart series of the triangle $P$817with vertices818$$819(1/2,1/2),\ (-1/3,-1/3),\ (1/4,-1/2).820$$821For this example the procedure above yields the input file \ttt{rational.in}:822823\begin{Verbatim}824amb_space 3825polytope 38261/2 1/2827-1/3 -1/38281/4 -1/2829HilbertSeries830\end{Verbatim}831This is the first time that we used the shortcut \verb|unit_vector <n>| which represents the $n$th unit vector $e_n\in\RR^d$ and is only allowed for input types which require a single vector.832833From the output file we only list the data of the Ehrhart series.834\begin{Verbatim}835multiplicity = 5/8836837Hilbert series:8381 0 0 3 2 -1 2 2 1 1 1 1 2839denominator with 3 factors:8401: 1 2: 1 12: 1841842degree of Hilbert Series as rational function = -3843844Hilbert series with cyclotomic denominator:845-1 -1 -1 -3 -4 -3 -2846cyclotomic denominator:8471: 3 2: 2 3: 1 4: 1848849Hilbert quasi-polynomial of period 12:8500: 48 28 15 7: 23 22 158511: 11 22 15 8: 16 28 158522: -20 28 15 9: 27 22 158533: 39 22 15 10: -4 28 158544: 32 28 15 11: 7 22 158555: -5 22 15 with common denominator = 488566: 12 28 15857\end{Verbatim}858The multiplicity is a rational number. Since in dimension $2$859the normalized area (of full-dimensional polytopes) is twice860the Euclidean area, we see that $P$ has Euclidean area $5/16$.861862Unlike in the case of a lattice polytope, there is no canonical choice of the denominator of the Ehrhart series. Normaliz gives it in $2$ forms. In the first form the numerator polynomial is863$$8641+3t^3+2t^4-t^5+2t^6+2t^7+t^8+t^9+t^{10}+t^{11}+2t^{12}865$$866and the denominator is867$$868(1-t)(1-t^2)(1-t^{12}).869$$870As a rational function, $H(t)$ has degree $-3$. This implies871that $3P$ is the smallest integral multiple of $P$ that872contains a lattice point in its interior.873874Normaliz gives also a representation as a quotient of coprime875polynomials with the denominator factored into cyclotomic876polynomials. In this case877we have878$$879H(t)=-\frac{1+t+t^2+t^3+4t^4+3t^5+2t^6}{\zeta_1^3\zeta_2^2\zeta_3\zeta_4}880$$881where $\zeta_i$ is the $i$-th cyclotomic polynomial882($\zeta_1=t-1$, $\zeta_2=t+1$, $\zeta_3=t^2+t+1$,883$\zeta_4=t^2+1$).884885Normaliz transforms the representation with cyclotomic886denominator into one with denominator of type887$(1-t^{e_1})\cdots(1-t^{e_r})$, $r=\textup{rank}$, by choosing888$e_r$ as the least common multiple of all the orders of the889cyclotomic polynomials appearing, $e_{r-1}$ as the lcm of those890orders that have multiplicity $\ge 2$ etc.891892There are other ways to form a suitable denominator with $3$893factors $1-t^e$, for example894$g(t)=(1-t^2)(1-t^3)(1-t^4)=-\zeta_1^3\zeta_2^2\zeta_3\zeta_4$.895Of course, $g(t)$ is the optimal choice in this case. However,896$P$ is a simplex, and in general such optimal choice may not897exist. We will explain the reason for our standardization898below.899900Let $p(k)$ be the number of lattice points in $kP$. Then $p(k)$901is a quasipolynomial:902$$903p(k)=p_0(k)+p_1(k)k+\dots+p_{r-1}(k)k^{r-1},904$$905where the coefficients depend on $k$, but only to the extent906that they are periodic of a certain period $\pi\in\NN$. In our907case $\pi=12$ (the lcm of the orders of the cyclotomic908polynomials).909910The table giving the quasipolynomial is to be read as follows:911The first column denotes the residue class $j$ modulo the912period and the corresponding line lists the coefficients913$p_i(j)$ in ascending order of $i$, multiplied by the common914denominator. So915$$916p(k)=1+\frac{7}{12}k+\frac{5}{16}k^2, \qquad k\equiv 0\pod{12},917$$918etc. The leading coefficient is the same for all residue919classes and equals the Euclidean volume.920921Our choice of denominator for the Hilbert series is motivated922by the following fact: $e_i$ is the common period of the923coefficients $p_{r-i},\dots,p_{r-1}$. The user should prove924this fact or at least verify it by several examples.925926Especially in the case of a simplex the representation of the Hilbert series shown so far may not be the expected one. In fact, there is a representation in which the exponents of $t$ in the denominator are the degrees of the integral extreme generators. So one would expect the denominator to be $(1-t^2)(1-t^3)(1-t^4)$ in our case. The generalization to the nonsimplicial case uses the degrees of a homogeneous system of parameters (see \cite[p. 200]{BG}). Normaliz can compute such a denominator if the computation goal \verb|HSOP| is set (\verb|rationalHSOP.in|):927\begin{Verbatim}928Hilbert series (HSOP):9291 1 1 3 4 3 2930denominator with 3 factors:9312: 1 3: 1 4: 1932\end{Verbatim}933934Note that the degrees of the elements in a homogeneous system of parameters are by no means unique and that there is no optimal choice in general. To find a suitable sequence of degrees Normaliz must compute the face lattice of the cone to some extent. Therefore be careful not to ask for \verb|HSOP| if the cone has many support hyperplanes.935936\emph{Warning}: It is tempting, but not a good idea to define the polytope by the input type \verb|vertices|. It would make Normaliz compute the lattice points in the polytope, but not in the cone over the polytope, and we need these to determine the Ehrhart series.937938\subsubsection{The rational polytope by inequalities}\label{rat_ineq}939940We extract the support hyperplanes of our polytope from the output file and use them as input (\verb|poly_ineq.in|):941\begin{Verbatim}942amb_space 3943inequalities 3944-8 2 39451 -1 09462 7 3947grading948unit_vector 3949HilbertSeries950\end{Verbatim}951At this point we have to help Normaliz because it has no way to guess that we want to investigate the polytope defined by the inequalities and the choice $x_3=1$. This is achieved by the specification of the grading that maps every vector to its third coordinate.952953These data tell us that the polytope, as a subset of $\RR^2$, is defined by the inequalities954\begin{align*}955-8x_1+2x_2+3&\ge0,\\956x_1-x_2+0&\ge0,\\9572x_1+7x_2+3&\ge 0.958\end{align*}959These inequalities are inhomogeneous, but we are using the homogeneous input type \verb|inequalities| which amounts to introducing the grading variable $x_3$ as explained above..960961Why don't we define it by the ``natural'' inhomogeneous inequalities using \verb|inhom_inequalities|? We could do it, but then only the polytope itself would be the object of computation, and we would have no access to the Ehrhart series. We could just compute the lattice points in the polytope. (Try it.)962963The inequalities as written above look somewhat artificial. It is certainly more natural to write them in the form964\begin{align*}9658x_1-2x_2&\le 3,\\966x_1-x_2&\ge0,\\9672x_1+7x_2&\ge -3.968\end{align*}969and for the direct transformation into Normaliz input we have introduced the type \verb|constraints|. But Normaliz would then interpret the input as inhomogeneous and we run into the same problem as with \verb|inhom_inequalities|. The way out: we tell Normaliz that we want a homogeneous computation (\verb|poly_hom_const.in|):970\begin{Verbatim}971amb_space 3972hom_constraints 39738 -2 <= 39741 -1 >= 09752 7 >= -3976grading977unit_vector 3978HilbertSeries979\end{Verbatim}980981982\subsection{Magic squares}\label{eq_ex}983984Suppose that you are interested in the following type of ``square''985\begin{center}986\begin{tabular}{|l|l|l|}987\hline988$x_1$ & $x_2$ & $x_3$\\989\hline990$x_4$ & $x_5$ & $x_6$\\991\hline992$x_7$ & $x_8$ & $x_9$\\993\hline994\end{tabular}995\end{center}996and the problem is to find nonnegative values for $x_1,\dots,x_9$997such that the 3 numbers in all rows, all columns, and both998diagonals sum to the same constant $\mathcal{M}$. Sometimes999such squares are called \emph{magic} and $\mathcal M$ is the1000\emph{magic constant}. This leads to a linear system of1001equations1002\begin{align*}1003& x_1+x_2+x_3=x_4+x_5+x_6;\\1004& x_1+x_2+x_3=x_7+x_8+x_9;\\1005& x_1+x_2+x_3=x_1+x_4+x_7;\\1006& x_1+x_2+x_3=x_2+x_5+x_8;\\1007& x_1+x_2+x_3=x_3+x_6+x_9;\\1008& x_1+x_2+x_3=x_1+x_5+x_9;\\1009& x_1+x_2+x_3=x_3+x_5+x_7.\\1010\end{align*}1011This system is encoded in the file1012\ttt{3x3magic.in}:1013\begin{Verbatim}1014amb_space 91015equations 710161 1 1 -1 -1 -1 0 0 010171 1 1 0 0 0 -1 -1 -110180 1 1 -1 0 0 -1 0 010191 0 1 0 -1 0 0 -1 010201 1 0 0 0 -1 0 0 -110210 1 1 0 -1 0 0 0 -110221 1 0 0 -1 0 -1 0 01023grading1024sparse 1:1 2:1 3:1;1025\end{Verbatim}10261027The input type \verb|equations| represents \emph{homogeneous} equations. The first equation reads1028$$1029x_1+x_2+x_3-x_4-x_5-x_6=0,1030$$1031and the other equations are to be interpreted analogously. The magic constant is a natural choice for the grading. It is given in sparse form, equivalent to the dense form1032\begin{Verbatim}1033grading10341 1 1 0 0 0 0 0 01035\end{Verbatim}10361037It seems that we have forgotten to define the cone. This may indeed be the case, but doesn't matter: if there is no input type that defines a cone, Normaliz chooses the positive orthant, and this is exactly what we want in this case.10381039The output file contains the following:10401041\begin{Verbatim}10425 Hilbert basis elements10435 Hilbert basis elements of degree 110444 extreme rays10454 support hyperplanes10461047embedding dimension = 91048rank = 31049external index = 110501051size of triangulation = 21052resulting sum of |det|s = 410531054grading:10551 1 1 0 0 0 0 0 01056with denominator = 31057\end{Verbatim}1058The input degree is the magic constant. However, as the1059denominator $3$ shows, the magic constant is always divisible1060by $3$, and therefore the effective degree is $\mathcal M/3$.1061This degree is used for the multiplicity and the Hilbert1062series.1063\begin{Verbatim}1064degrees of extreme rays:10651: 410661067Hilbert basis elements are of degree 11068\end{Verbatim}1069This was not to be expected (and is no longer true for $4\times 4$ squares).1070\begin{Verbatim}1071multiplicity = 410721073Hilbert series:10741 2 11075denominator with 3 factors:10761: 310771078degree of Hilbert Series as rational function = -110791080Hilbert polynomial:10811 2 21082with common denominator = 11083\end{Verbatim}1084The Hilbert series is1085$$1086\frac{1+2t+t^2}{(1-t)^3}.1087$$1088The Hilbert polynomial is1089$$1090P(k)=1+2k+2k^2,1091$$1092and after substituting $\mathcal M/3$ for $k$ we obtain the1093number of magic squares of magic constant $\mathcal M$, provided $3$ divides $\mathcal M$. (If $3\nmid \mathcal M$, there is no magic square of magic constant $\mathcal M$.)1094\begin{Verbatim}1095rank of class group = 11096finite cyclic summands:10972: 21098\end{Verbatim}1099So the class group is $\ZZ\oplus (\ZZ/2\ZZ)^2$.1100\begin{Verbatim}11015 Hilbert basis elements of degree 1:11020 2 1 2 1 0 1 0 211031 0 2 2 1 0 0 2 111041 1 1 1 1 1 1 1 111051 2 0 0 1 2 2 0 111062 0 1 0 1 2 1 2 0110711080 further Hilbert basis elements of higher degree:1109\end{Verbatim}1110The $5$ elements of the Hilbert basis represent the magic1111squares1112\begin{center}1113\begin{tabular}{|l|l|l|}1114\hline11152 & 0 & 1\\1116\hline11170 & 1 & 2\\1118\hline11191 & 2 & 0\\1120\hline1121\end{tabular}1122\hspace{10mm}1123\begin{tabular}{|l|l|l|}1124\hline11251 & 0 & 2\\1126\hline11272 & 1 & 0\\1128\hline11290 & 2 & 1\\1130\hline1131\end{tabular}1132\hspace{10mm}1133\begin{tabular}{|l|l|l|}1134\hline11351 & 1 & 1\\1136\hline11371 & 1 & 1\\1138\hline11391 & 1 & 1\\1140\hline1141\end{tabular}1142\hspace{10mm}1143\begin{tabular}{|l|l|l|}1144\hline11451 & 2 & 0\\1146\hline11470 & 1 & 2\\1148\hline11492 & 0 & 1\\1150\hline1151\end{tabular}1152\hspace{10mm}1153\begin{tabular}{|l|l|l|}1154\hline11550 & 2 & 1\\1156\hline11572 & 1 & 0\\1158\hline11591 & 0 & 2\\1160\hline1161\end{tabular}1162\end{center}1163All other solutions are linear combinations of these squares1164with nonnegative integer coefficients.1165One of these $5$ squares is clearly in the interior:1166\begin{Verbatim}11674 extreme rays: 4 support hyperplanes:11680 2 1 2 1 0 1 0 2 -2 -1 0 0 4 0 0 0 011691 0 2 2 1 0 0 2 1 0 -1 0 0 2 0 0 0 011701 2 0 0 1 2 2 0 1 0 1 0 0 0 0 0 0 011712 0 1 0 1 2 1 2 0 2 1 0 0 -2 0 0 0 01172\end{Verbatim}1173These $4$ support hyperplanes cut out the cone generated by the magic squares from the linear subspace they generate. Only one is reproduced as a sign inequality. This is due to the fact that the linear subspace has submaximal dimension and there is no unique lifting of linear forms to the full space.1174\begin{Verbatim}11756 equations: 3 basis elements of lattice:11761 0 0 0 0 1 -2 -1 1 1 0 -1 -2 0 2 1 0 -111770 1 0 0 0 1 -2 0 0 0 1 -1 -1 0 1 1 -1 011780 0 1 0 0 1 -1 -1 0 0 0 3 4 1 -2 -1 2 211790 0 0 1 0 -1 2 0 -211800 0 0 0 1 -1 1 0 -111810 0 0 0 0 3 -4 -1 21182\end{Verbatim}1183So one of our equations has turned out to be superfluous (why?). Note that also the equations are not reproduced exactly. Finally, Normaliz lists a basis of the efficient lattice $\EE$ generated by the magic squares.11841185\subsubsection{With even corners}\label{magiceven}\label{cong_ex}11861187We change our definition of magic square by requiring that the1188entries in the $4$ corners are all even. Then we have to1189augment the input file by the following (\ttt{3x3magiceven.in}):1190\begin{Verbatim}1191congruences 4 sparse11921:1 10:2;11933:1 10:2;11947:1 10:2;11959:1 10:2;1196\end{Verbatim}1197This sparse form is equivalent to the dense form1198\begin{Verbatim}1199congruences 412001 0 0 0 0 0 0 0 0 212010 0 1 0 0 0 0 0 0 212020 0 0 0 0 0 1 0 0 212030 0 0 0 0 0 0 0 1 21204\end{Verbatim}1205The first $9$ entries in each row represent the coefficients of the coordinates in the homogeneous congruences, and the last is the modulus:1206$$1207x_1\equiv 0\mod 21208$$1209is the first congruence etc.12101211We could also define these congruences as symbolic constraints:1212\begin{Verbatim}1213constraints 4 symbolic1214x[1] ~ 0(2);1215x[3] ~ 0(2);1216x[7] ~ 0(2);1217x[9] ~ 0(2);1218\end{Verbatim}12191220The output changes accordingly:122112221223\begin{Verbatim}12249 Hilbert basis elements12250 Hilbert basis elements of degree 112264 extreme rays12274 support hyperplanes12281229embedding dimension = 91230rank = 31231external index = 412321233size of triangulation = 21234resulting sum of |det|s = 812351236grading:12371 1 1 0 0 0 0 0 01238with denominator = 312391240degrees of extreme rays:12412: 412421243multiplicity = 112441245Hilbert series:12461 -1 3 11247denominator with 3 factors:12481: 1 2: 212491250degree of Hilbert Series as rational function = -212511252Hilbert series with cyclotomic denominator:1253-1 1 -3 -11254cyclotomic denominator:12551: 3 2: 212561257Hilbert quasi-polynomial of period 2:12580: 2 2 112591: -1 0 11260with common denominator = 21261\end{Verbatim}1262After the extensive discussion in Section \ref{rational} it should be easy for you to write down the Hilbert series and the Hilbert quasipolynomial. (But keep in mind that the grading has a denominator.)1263\begin{Verbatim}1264rank of class group = 11265finite cyclic summands:12664: 212671268***********************************************************************126912700 Hilbert basis elements of degree 1:127112729 further Hilbert basis elements of higher degree:1273...127412754 extreme rays:12760 4 2 4 2 0 2 0 412772 0 4 4 2 0 0 4 212782 4 0 0 2 4 4 0 212794 0 2 0 2 4 2 4 01280\end{Verbatim}1281We have listed the extreme rays since they have changed after the introduction of the congruences, although the cone has not changed. The reason is that Normaliz always chooses the extreme rays from the efficient lattice $\EE$.1282\begin{Verbatim}128312844 support hyperplanes:1285...128612876 equations:1288... 3 basis elements of lattice:12892 0 -2 -4 0 4 2 0 -212902 congruences: 0 1 2 3 1 -1 0 1 212911 0 0 0 0 0 0 0 0 2 0 0 6 8 2 -4 -2 4 412920 1 0 0 1 0 0 0 0 21293\end{Verbatim}1294The rank of the lattice has of course not changed, but after the introduction of the congruences the basis has changed.12951296\subsubsection{The lattice as input}\label{latt_ex}12971298It is possible to define the lattice by generators. We demonstrate this for the magic squares with even corners. The lattice has just been computed (\verb|3x3magiceven_lat.in|):12991300\begin{Verbatim}1301amb_space 91302lattice 313032 0 -2 -4 0 4 2 0 -213040 1 2 3 1 -1 0 1 213050 0 6 8 2 -4 -2 4 41306grading13071 1 1 0 0 0 0 0 01308\end{Verbatim}1309It produces the same output as the version starting from equations and congruences.13101311\verb|lattice| has a variant that takes the saturation of the sublattice generated by the input vectors (\verb|3x3magic_sat.in|):13121313\begin{Verbatim}1314amb_space 91315saturation 313162 0 -2 -4 0 4 2 0 -213170 1 2 3 1 -1 0 1 213180 0 6 8 2 -4 -2 4 41319grading13201 1 1 0 0 0 0 0 01321\end{Verbatim}1322Clearly, we remove the congruences by this choice and arrive at the output of \verb|3x3magic.in|.13231324\subsection{Decomposition in a numerical semigroup}\label{inhom_eq_ex}13251326Let $S=\langle 6,10,15\rangle$, the numerical semigroup generated by $6,10,15$. How can $97$ be written as a sum in the generators?\medskip13271328In other words: we want to find all nonnegative integral solutions to the equation1329$$13306x_1+10x_2+15x_3=971331$$133213331334\begin{minipage}[b]{0.5\textwidth}1335Input (\verb|NumSemi.in|):1336\begin{Verbatim}1337amb_space 31338constraints 1 symbolic13396x[1] + 10x[2] + 15x[3] = 97;1340\end{Verbatim}1341\end{minipage}1342\hspace{1cm}1343\begin{minipage}[t]{0.4\textwidth}1344\tikzset{facet style/.style={opacity=1.0,very thick,line,join=round}}1345\begin{tikzpicture}[x = {(0.8cm,-0.5cm)},1346y = {(0.9659cm,0.20cm)},1347z = {(0cm,1cm)},1348scale = 0.5]1349\draw [->,dashed] (-0.5, 0, 0) -- (3.0,0,0);13501351\draw [->,dashed] (0, -0.5, 0) -- (0,6.0,0);13521353\draw [->,dashed] (0, 0, -0.5) -- (0,0,3.5);13541355%\draw[thin] (0,0,0) -- (2,0,0) -- (0,5,0) -- cycle;1356%\draw[thin] (0,0,0) -- (2,0,0) -- (0,0,3) -- cycle;1357%\draw[thin] (0,0,0) -- (0,5,0) -- (0,0,3) -- cycle;1358\filldraw[color=yellow] (2,0,0) -- (0,5,0) -- (0,0,3) -- cycle;1359\draw[thick] (2,0,0) -- (0,5,0) -- (0,0,3) -- cycle;13601361\filldraw[fill=white] (0,0,0) circle (2pt);1362\filldraw[fill=white] (2,0,0) circle (2pt);1363\filldraw[fill=white] (0,5,0) circle (2pt);1364\filldraw[fill=white] (0,0,3) circle (2pt);1365\end{tikzpicture}1366\end{minipage}13671368\medskip1369The equation cuts out a triangle from the positive orthant.13701371The set of solutions is a module over the monoid $M$ of solutions of the homogeneous equation $6x_1+10x_2+15x_3=0$. So $M=0$ in this case.1372\begin{Verbatim}13736 module generators:13742 1 5 113752 4 3 113762 7 1 113777 1 3 113787 4 1 1137912 1 1 1138013810 Hilbert basis elements of recession monoid:1382\end{Verbatim}1383The last line is as expected, and the $6$ module generators are the goal of the computation.13841385Normaliz is smart enough to recognize that it must compute the lattice points in a polygon, and does exactly this. You can recognize it in the console output: Normaliz \version\ has used the project-and-lift algorithm. We will discuss it further in Section \ref{project_example} and Section \ref{project}.13861387For those who like to play: add the option \verb|--NoProjection| to the command line. Then the terminal output will change; Normaliz computes the lattice points as a truncated Hilbert basis via a triangulation (only one simplicial cone in this case).13881389\subsection{A job for the dual algorithm}\label{job_dual}13901391We increase the size of the magic squares to $5\times 5$. Normaliz can do the same computation as for $3\times 3$ squares, but this will take some minutes. Suppose we are only interested in the Hilbert basis, we should use the dual algorithm for this example. (The dual algorithm goes back to Pottier \cite{Po}.) The input file is \ttt{5x5dual.in}:13921393\begin{Verbatim}1394amb_space 251395equations 1113961 1 1 1 1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 01397...13981 1 1 1 0 0 0 0 -1 0 0 0 -1 0 0 0 -1 0 0 0 -1 0 0 0 01399grading14001 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 01401HilbertBasis1402\end{Verbatim}1403The input file does not say anything about the dual algorithm mentioned in the section title. With this input it is chosen automatically. See Section \ref{div_labor} for a discussion of when this happens. But you can insist on the dual algorithm by adding \verb|DualMode| to the input (or \verb|-d| to the command line). Or, if you want to compare it to the primal algorithm add \verb|PrimalMode| (or \verb|-P| to the command line).140414051406The Hilbert basis contains $4828$ elements, too many to be listed here.14071408With the file \verb|5x5.in| you can compute the Hilbert basis and the Hilbert series, and the latter with HSOP:1409\begin{Verbatim}1410Hilbert series (HSOP):14111 15 356 4692 36324 198467 ... 198467 36324 4692 356 15 11412denominator with 15 factors:14131: 5 2: 3 6: 2 12: 1 60: 2 420: 1 1260: 114141415degree of Hilbert Series as rational function = -514161417The numerator of the Hilbert Series is symmetric.1418\end{Verbatim}1419In view of the length of the numerator of the Hilbert series it may be difficult to observe the symmetry. So Normaliz does it for you. The symmetry shows that the monoid is Gorenstein, but if you are only interested in the Gorenstein property, there is a much faster way to check it (see Section \ref{Gorenstein}).14201421The size $6\times 6$ is out of reach for the Hilbert series, but the Hilbert basis can be computed (in the automatically chosen dual mode). It takes some hours.14221423\subsection{A dull polyhedron}\label{inhom_ineq_ex}14241425We want to compute the polyhedron defined by the inequalities1426\begin{align*}1427\xi_2 &\ge -1/2,\\1428\xi_2 &\le 3/2,\\1429\xi_2 &\le \xi_1+3/2.1430\end{align*}1431They are contained in the input file \verb|InhomIneq.in|:1432\begin{Verbatim}1433amb_space 21434constraints 314350 1 >= -1/214360 1 <= 3/21437-1 1 <= 3/21438grading1439unit_vector 11440\end{Verbatim}1441The grading says that we want to count points by the first coordinate.1442\begin{center}1443\begin{tikzpicture}[scale=0.7]14441445\filldraw[yellow] (5,-0.5) -- (-2,-0.5) -- (0,1.5) -- (5,1.5) -- cycle;14461447\foreach \x in {-2,...,5}1448\foreach \y in {-1,...,2}1449{1450\filldraw[fill=black] (\x,\y) circle (1.5pt);1451}1452\draw[->] (-2.5,0) -- (5.5,0);1453\draw[->] (0,-1.5) -- (0,2.5);1454\draw[thick] (5,-0.5) -- (-2,-0.5) -- (0,1.5) -- (5,1.5);1455\end{tikzpicture}1456\end{center}14571458It yields the output1459\begin{Verbatim}14602 module generators14611 Hilbert basis elements of recession monoid14622 vertices of polyhedron14631 extreme rays of recession cone14643 support hyperplanes of polyhedron (homogenized)14651466embedding dimension = 31467affine dimension of the polyhedron = 2 (maximal)1468rank of recession monoid = 114691470size of triangulation = 11471resulting sum of |det|s = 814721473dehomogenization:14740 0 114751476grading:14771 0 01478\end{Verbatim}1479The interpretation of the grading requires some care in the inhomogeneous case. We have extended the input grading vector by an entry $0$ to match the embedding dimension. For the computation of the degrees of \emph{lattice points} in the ambient space you can either use only the first $2$ coordinates or take the full scalar product of the point in homogenized coordinates and the extended grading vector.14801481\begin{Verbatim}1482module rank = 21483multiplicity = 21484\end{Verbatim}1485The module rank is $2$ in this case since we have two ``layers'' in the solution module that are parallel to the recession monoid. This is of course also reflected in the Hilbert series.1486\begin{Verbatim}1487Hilbert series:14881 11489denominator with 1 factors:14901: 114911492shift = -11493\end{Verbatim}1494We haven't seen a shift yet. It is always printed (necessarily) if the Hilbert series does not start in degree $0$. In our case it starts in degree $-1$ as indicated by the shift $-1$. We thus get the Hilbert series1495$$1496t^{-1}\,\frac{t+t}{1-t}=\frac{t^{-1}+1}{1-t}.1497$$14981499Note: We used the opposite convention for the shift in Normaliz 2.15001501Note that the Hilbert (quasi)polynomial is always computed for the unshifted monoid defined by the input data. (This was different in previous versions of Normaliz.)1502\begin{Verbatim}1503degree of Hilbert Series as rational function = -115041505Hilbert polynomial:150621507with common denominator = 115081509***********************************************************************151015112 module generators:1512-1 0 115130 1 1151415151 Hilbert basis elements of recession monoid:15161 0 0151715182 vertices of polyhedron:1519-4 -1 215200 3 2152115221 extreme rays of recession cone:15231 0 0152415253 support hyperplanes of polyhedron (homogenized):15260 -2 315270 2 115282 -2 31529\end{Verbatim}15301531The dual algorithm that was used in Section \ref{job_dual} can also be applied to inhomogeneous computations. We would of course loose the Hilbert series. In certain cases it may be preferable to suppress the computation of the vertices of the polyhedron if you are only interested in the integer points; see Section \ref{InhomDual}.15321533\subsubsection{Defining it by generators}\label{polyh_ex}15341535If the polyhedron is given by its vertices and the recession cone, we can define it by these data (\verb|InhomIneq_gen.in|):1536\begin{Verbatim}1537amb_space 21538vertices 21539-4 -1 215400 3 21541cone 115421 01543grading1544unit_vector 11545\end{Verbatim}1546The output is identical to the version starting from the inequalities.15471548\subsection{The Condorcet paradox}\label{Condorcet}15491550In this section we assume that you use an executable of Normaliz that was built with CoCoALib (ee Section \ref{Compile}), for example an executable for Linux or Mac OS from the Normaliz web site. If not, then simply disregard any remark on symmetrization. Everything runs very quickly also without it.15511552In social choice elections each of the $k$ voters picks a linear preference order of the $n$ candidates. There are $n!$ such orders. The election result is the vector $(x_1,\dots,x_N), $N=n!, in which $x_i$ is the number of voters that have chosen the $i$-th preference order in, say, lexicographic enumeration of these orders. In the following we assume the \emph{impartial anonymous culture} according to which every preference order has the same basic weight of $1/n!$.1553\medskip15541555We say that candidate $A$ \emph{beats} candidate $B$ if the majority of the voters prefers $A$ to $B$. As the Marquis de \emph{Condorcet} (and others) observed, ``beats'' is not transitive, and an election may exhibit the \emph{Condorcet paradox}: there is no Condorcet winner. (See \cite{BS} and the references given there for more information.)15561557We want to find the probability for $k\to\infty$ that there is a Condorcet winner for $n=4$ candidates. The event that $A$ is the Condorcet winner can be expressed by linear inequalities on the election outcome (a point in $24$-space). The wanted probability is the lattice normalized volume of the polytope cut out by the inequalities at $k=1$. The file \verb|Condorcet.in|:15581559\begin{Verbatim}1560amb_space 241561inequalities 315621 1 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 1 -115631 1 1 1 1 1 1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -115641 1 1 1 1 1 1 1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -11565nonnegative1566total_degree1567Multiplicity1568\end{Verbatim}1569The first inequality expresses that $A$ beats $B$, the second and the third say that $A$ beats $C$ and $D$. (So far we do not exclude ties, and they need not be excluded for probabilities as $k\to\infty$.)15701571In addition to these inequalities we must restrict all variables to nonnegative values, and this is achieved by adding the attribute \verb|nonnegative|. The grading is set by \verb|total_degree|. It replaces the grading vector with $24$ entries $1$. Finally \verb|Multiplicity| sets the computation goal.15721573From the output file we only mention the quantity we are out for:1574\begin{Verbatim}1575multiplicity = 1717/81921576\end{Verbatim}1577Since there are $4$ candidates, the probability for the existence of a Condorcet winner is $1717/2048$.15781579We can refine the information on the Condorcet paradox by computing the Hilbert series. Either we delete \verb|Multiplicity| from the input file or, better, we add \verb|--HilbertSeries| (or simply \verb|-q|) on the command line. The result:1580\begin{Verbatim}1581Hilbert series:15821 5 133 363 4581 8655 69821 100915 ... 12346 890 481 15 61583denominator with 24 factors:15841: 1 2: 14 4: 915851586degree of Hilbert Series as rational function = -251587\end{Verbatim}15881589Normaliz automatically uses symmetrization for this example , but it is too small to demonstrate the power of symmetrization. For others, symmetrization can convert days into seconds.15901591Since symmetrization has been used, you will also find a file \verb|Condorcet.symm.out| in your directory. It contains the data computed for the symmetrization. You need not care at this point. We take continue the discussion of symmetrization in Section \ref{symmetrize}.15921593\subsubsection{Excluding ties}\label{excluded_ex}15941595Now we are more ambitious and want to compute the Hilbert series for the Condorcet paradox, or more precisely, the number of election outcomes having $A$ as the Condorcet winner depending on the number $k$ of voters. Moreover, as it is customary in social choice theory, we want to exclude ties. The input file changes to \verb|CondorcetSemi.in|:1596\begin{Verbatim}1597amb_space 241598excluded_faces 315991 1 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 1 -116001 1 1 1 1 1 1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -116011 1 1 1 1 1 1 1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -11602nonnegative1603total_degree1604HilbertSeries1605\end{Verbatim}1606We could omit \verb|HilbertSeries|, and the computation would include the Hilbert basis. The type \verb|excluded_faces| only affects the Hilbert series. In every other respect it is equivalent to \verb|inequalities|.16071608From the file \verb|CondorcetSemi.out| we only display the Hilbert series:1609\begin{Verbatim}1610Hilbert series:16116 15 481 890 12346 ... 100915 69821 8655 4581 363 133 5 11612denominator with 24 factors:16131: 1 2: 14 4: 916141615shift = 116161617degree of Hilbert Series as rational function = -241618\end{Verbatim}1619Surprisingly, this looks like the Hilbert series in the previous section read backwards, roughly speaking. This is true, and one can explain it as we will see below.16201621It is justified to ask why we don't use \verb|strict_inequalities| instead of \verb|excluded_faces|. It does of course give the same Hilbert series. However, Normaliz cannot (yet) apply symmetrization in inhomogeneous computations. Moreover, the algorithmic approach is different, and according to our experience \verb|excluded_faces| is more efficient, independently of symmetrization.16221623\subsubsection{At least one vote for every preference order}\label{strict_signs_ex}16241625Suppose we are only interested in elections in which every preference order is chosen by at least one voter. This can be modeled as follows (\verb|Condorcet_one.in|):1626\begin{Verbatim}1627amb_space 241628inequalities 316291 1 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 1 -116301 1 1 1 1 1 1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -116311 1 1 1 1 1 1 1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -11632strict_signs16331 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11634total_degree1635HilbertSeries1636\end{Verbatim}1637The entry $1$ at position $i$ of the vector \verb|strict_signs| imposes the inequality $x_i\ge1$. A $-1$ would impose the inequality $x_i\le -1$, and the entry $0$ imposes no condition on the $i$-th coordinate.16381639\begin{Verbatim}1640Hilbert series:16411 5 133 363 4581 8655 69821 100915 ... 12346 890 481 15 61642denominator with 24 factors:16431: 1 2: 14 4: 916441645shift = 2416461647degree of Hilbert Series as rational function = -11648\end{Verbatim}1649Again we encounter (almost) the Hilbert series of the Condorcet paradox (without side conditions). It is time to explain this coincidence. Let $C$ be the Condorcet cone defined by the nonstrict inequalities, $M$ the monoid of lattice points in it, $I_1\subset M$ the ideal of lattice points avoiding the $3$ facets defined by ties, $I_2$ the ideal of lattice points with strictly positive coordinates, and finally $I_3$ the ideal of lattice points in the interior of $C$. Moreover, let $\mathds{1}\in\ZZ^{24}$ be the vector with all entries $1$.16501651Since $\mathds{1}$ lies in the three facets defining the ties, it follows that $I_2=M+\mathds{1}$. This explains why we obtain the Hilbert series of $I_2$ by multiplying the Hilbert series of $M$ by $t^{24}$, as just observed. Generalized Ehrhart reciprocity (see \cite[Theorem 6.70]{BG}) then explains the Hilbert series of $I_1$ that we observed in the previous section. Finally, the Hilbert series of $I_3$ that we don't have displayed is obtained from that of $M$ by ``ordinary'' Ehrhart reciprocity. But we can also obtain $I_1$ from $I_3$: $I_1=I_3-\mathds{1}$, and generalized reciprocity follows from ordinary reciprocity in this very special case.16521653The essential point in these arguments (apart from reciprocity) is that $\mathds{1}$ lies in all support hyperplanes of $C$ except the coordinate hyperplanes.16541655You can easily compute the Hilbert series of $I_3$ by making all inequalities strict.16561657As the terminal output shows, symmetrization has not been applied for the reason mentioned above: \verb|strict_signs| is an inhomogeneous input type. It would of course be possible to encode the strict signs as \verb|excluded_faces|. Then the sparse format of matrices is very handy:1658\begin{Verbatim}1659excluded_faces 2416601:1;16611:2;1662...16631:24;1664\end{Verbatim}1665This is a shorthand for the unit matrix.16661667\subsection{Testing normality}\label{normalization_ex}16681669We want to test the monoid $A_{4\times 4\times 3}$ defined by $4\times4\times3$ contingency tables for normality (see \cite{BHIKS} for the background). The input file is \ttt{A443.in}:1670\begin{Verbatim}1671amb_space 401672cone_and_lattice 4816731 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 01674...16750 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 11676HilbertBasis1677\end{Verbatim}1678Why \verb|cone_and_lattice|? Well, we want to find out whether the monoid is normal, i.e., whether $M=C(M)\cap\gp(M)$. If $M$ is even integrally closed in $\ZZ^{24}$, then it is certainly integrally closed in the evidently smaller lattice $\gp(M)$, but the converse does not hold in general, and therefore we work with the lattice generated by the monoid generators.16791680It turns out that the monoid is indeed normal:1681\begin{Verbatim}1682original monoid is integrally closed1683\end{Verbatim}1684Actually the output file reveals that $M$ is even integrally closed in $\ZZ^{24}$: the external index is $1$, and therefore $\gp(M)$ is integrally closed in $\ZZ^{24} $.16851686The output files also shows that there is a grading on $\ZZ^{24}$ under which all our generators have degree $1$. We could have seen this ourselves: Every generator has exactly one entry $1$ in the first $16$ coordinates. (This is clear from the construction of $M$.)16871688A noteworthy detail from the output file:1689\begin{Verbatim}1690size of partial triangulation = 481691\end{Verbatim}1692It shows that Normaliz uses only a partial triangulation in Hilbert basis computations; see \cite{BHIKS}.16931694It is no problem to compute the Hilbert series as well if you are interested in it. Simply add \verb|-q| to the command line or remove \verb|HilbertBasis| from the input file. Then a full triangulation is needed (size $2,654,272$).16951696Similar examples are \verb|A543|, \verb|A553| and \verb|A643|. The latter is not normal, as we will see below. Even on a standard PC or laptop, the Hilbert basis computation does not take very long because Normaliz uses only a partial triangulation. The Hilbert series can still be determined, but the computation time will grow considerably since the it requires a full triangulation. See \cite{BIS} for timings.16971698\subsubsection{Computing just a witness}\label{IsIC}16991700If the Hilbert basis is large and there are many support hyperplanes, memory can become an issue for Normaliz, as well as computation time. Often one is only interested in deciding whether the given monoid is integrally closed (or normal). In the negative case it is enough to find a single element that is not in the original monoid -- a witness disproving integral closedness. As soon as such a witness is found, Normaliz stops the Hilbert basis computation (but will continue to compute other data if they are asked for). We look at the example \verb|A643.in| (for which the full Hilbert basis is not really a problem):170117021703\begin{Verbatim}1704amb_space 541705cone_and_lattice 7217061 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 ...1707...17080 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 ...1709IsIntegrallyClosed1710\end{Verbatim}1711Don't add \verb|HilbertBasis| because it will overrule \verb|IsIntegrallyClosed|!17121713The output:1714\begin{Verbatim}171572 extreme rays1716153858 support hyperplanes17171718embedding dimension = 541719rank = 421720external index = 11721internal index = 11722original monoid is not integrally closed1723witness for not being integrally closed:17240 0 1 0 1 1 1 1 0 0 1 0 0 1 0 1 0 1 1 0 1 1 0 0 1 1 1 0 0 1 1 0 0 1 1 ...17251726grading:17271 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 ...17281729degrees of extreme rays:17301: 7217311732***********************************************************************1733173472 extreme rays:17350 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 ...1736...1737\end{Verbatim}17381739If you repeat such a computation, you may very well get a different witness if several parallel threads find witnesses. Only one of them is delivered.17401741\subsection{Convex hull computation/vertex enumeration}17421743Normaliz computes convex hulls as should be very clear by now, and the only purpose of this section is to emphasize that Normaliz can be restricted to this task by setting an explicit computation goal. By convex hull computation we mean the determination of the support hyperplanes of a polyhedron is given by generators (or vertices). The converse operation is vertex enumeration. Both amount to the dualization of a cone, and can therefore be done by the same algorithm.17441745As an example we take the input file \verb|cyclicpolytope30-15.in|, the cyclic polytope of dimension 15 with 30 vertices (suggested by D. Avis and Ch. Jordan):1746\begin{Verbatim}1747/* cyclic polytope of dimension 15 with 30 vertices */1748amb_space 161749polytope 3017501 1 1 1 1 1 1 1 1 1 1 1 1 1 117512 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 327681752...175330 900 27000 810000 ... 478296900000000000000 143489070000000000000001754SupportHyperplanes1755\end{Verbatim}1756Already the entries of the vertices show that the computation cannot be done in 64 bit arithmetic. But you need not be worried. Just start Normaliz as usual. It will simply switch to infinite precision by itself, as shown by the terminal output (use the option \verb|-c| or \verb|--Verbose|).1757\begin{Verbatim}1758\.....|1759Normaliz 3.2.0 \....|1760\...|1761(C) The Normaliz Team, University of Osnabrueck \..|1762January 2017 \.|1763\|1764************************************************************1765Compute: SupportHyperplanes1766Could not convert 15181127029874798299.1767Arithmetic Overflow detected, try a bigger integer type!1768Restarting with a bigger type.1769************************************************************1770starting primal algorithm (only support hyperplanes) ...1771Generators sorted lexicographically1772Start simplex 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 161773gen=17, 72 hyp1774gen=18, 240 hyp1775gen=19, 660 hyp1776gen=20, 1584 hyp1777gen=21, 3432 hyp1778gen=22, 6864 hyp1779gen=23, 12870 hyp1780gen=24, 22880 hyp1781gen=25, 38896 hyp1782gen=26, 63648 hyp1783gen=27, 100776 hyp1784gen=28, 155040 hyp1785gen=29, 232560 hyp1786gen=30, 341088 hyp1787Pointed since graded1788Select extreme rays via comparison ... done.1789------------------------------------------------------------1790transforming data... done.1791\end{Verbatim}1792Have a look at the output file if you are not afraid of $341088$ linear forms.17931794If you have looked closely at the terminal output above, you should have stumbled on the lines1795\begin{Verbatim}1796Could not convert 15181127029874798299.1797Arithmetic Overflow detected, try a bigger integer type!1798\end{Verbatim}1799They show that Normaliz has tried the computation in 64 bit integers, but encountered a number that is too large for this precision. It has automatically switched to infinite precision. (See Section \ref{Integer} for more information on integer types.)18001801\subsection{Lattice points in a polytope}\label{project_example}18021803The computation of lattice points in a polytope can be viewed as a truncated Hilbert basis computation, and we have seen in preceding examples. But Normaliz can be restricted to their computation, with homogeneous as well as with inhomogeneous input. Let us look at \verb|ChF_8_1024.in|:18041805\begin{Verbatim}1806amb_space 81807constraints 1618080.10976576 0.2153132834 ... 0.04282847494 >= -1/21809...18100.10976576 -0.2153132834 ... -0.04282847494 >= -1/218110.10976576 0.2153132834 ... 0.04282847494 <= 1/218120.10976576 -0.2153132834 ...-0.04282847494 <= 1/21813ProjectionFloat1814\end{Verbatim}18151816This example comes from numerical analysis; see Ch. Kacwin, J. Oettershagen and T. Ullrich (\url{arXiv:1606.00492}, Math. Monatshefte, to appear). This explains the decimal fractions in the input. Normaliz converts them immediately into ordinary fractions of type numerator/denominator, and then makes the input integral as usual.18171818In the output file you can see to what integer vectors Normaliz has converted the inequalities of the input file:1819\begin{Verbatim}182016 support hyperplanes of polyhedron (homogenized):18215488288000 10765664170 ... 2141423747 250000000001822...1823-5488288000 10765664170 ... 2141423747 250000000001824\end{Verbatim}18251826The option \verb|ProjectionFloat| indicates that we want to compute only the lattice points in the polytope defined by the inequalities and that we want to use the floating point variant of the project-and-lift algorithm; \verb|Projection| would make Normaliz use its ordinary arithmetic in this algorithm. For our example the difference in time is not really significant, but when you try \verb|ChF_16_1048576.in|, it becomes very noticeable. Let us have a look at the relevant part of then terminal output:1827\begin{Verbatim}1828Computing lattice points by project-and-lift1829Projection1830embdim 9 inequalities 161831embdim 8 inequalities 561832embdim 7 inequalities 1121833embdim 6 inequalities 1401834embdim 5 inequalities 1121835embdim 4 inequalities 561836embdim 3 inequalities 161837embdim 2 inequalities 21838Lifting1839embdim 2 Deg1Elements 51840embdim 3 Deg1Elements 211841embdim 4 Deg1Elements 731842embdim 5 Deg1Elements 1991843embdim 6 Deg1Elements 3971844embdim 7 Deg1Elements 6291845embdim 8 Deg1Elements 9071846embdim 9 Deg1Elements 10671847Project-and-lift complete1848\end{Verbatim}18491850We start with embedding dimension $9$ since we need a homogenizing coordinate in inhomogeneous computations. Then the polytope is successively projected onto a coordinate hyperplane until we reach a line segment given by $2$ inequalities. In the second part Normaliz lifts the lattice points back through all projections. The following figure illustrates the procedure for a polygon that is projected to a line segment.1851\begin{center}1852\begin{tikzpicture}[scale=0.7]18531854\filldraw[yellow] (-1.5,-0.7) -- (1,2) -- (4.3,3) -- (3,0.3) -- cycle;1855\draw (-1.5,-0.7) -- (1,2) -- (4.3,3) -- (3,0.3) -- cycle;18561857\foreach \x in {-1,...,4}1858{1859\draw[green] (\x,-1.5) -- (\x,3.5);1860}1861\draw[->] (-2.5,0) -- (5.5,0);1862\draw[->] (0,-1.5) -- (0,3.5);1863%\draw (-1.5,-1.5) -- (-1.5,3.5);1864\draw[color=red,thick] (-1.5,0) -- (4.3,0);18651866\foreach \x in {-2,...,5}1867\foreach \y in {-1,...,3}1868{1869\filldraw[fill=black] (\x,\y) circle (1.5pt);1870}1871\draw (-1.5,-0.7) -- (1,2) -- (4.3,3) -- (3,0.3) -- cycle;1872%\draw[thick] (5,0) -- (-1,-0) -- (0,1) -- (5,1);1873\end{tikzpicture}1874\end{center}1875The green lines show the fibers over the lattice points in the (red) line segment. Note that not every lattice point in the projection must be liftable to a lattice point in the next higher dimension.18761877In \verb|ChF_8_1024.in| we see1878\begin{Verbatim}18791067 module generators:1880-4 0 0 0 0 0 0 0 11881-3 0 0 0 -1 0 0 0 11882-3 0 0 0 0 0 0 0 11883...18843 0 0 0 0 0 0 0 118853 0 0 0 1 0 0 0 118864 0 0 0 0 0 0 0 11887\end{Verbatim}1888These are the lattice points that we wanted to compute.18891890Normaliz finds out that our polytope is in fact a parallelotope. This allows Normaliz to suppress the computation of its vertices. We are not interested in them, and they look frightening when written as ordinary fractions (computed with the additional option \verb|SupportHyperplanes|). This is only the first vertex, the denominator is the number in the last row:1891\begin{Verbatim}1892256 vertices of polyhedron:1893-78319721553077081732391672580859742558458697790513296519063367715824218751894-2560494334732147696394408175864650673712115229853232268085759500000000000189524119329241174482500360412416832370837428600051424471712956748450000000001896-2170682283899852950367663781367299946065844697990214478942400250000000000189718460135400776217505622323335696515515596592076594380747609228005000000001898-145040353166280163458776558695633828794386588673702458271863175000000000018999990553287187733163035192686290910388936567846542394440240612200000000001900-509313990522468215816366827427428831508901797188810249435062450000000000190122924863358031696573168236156024616254222835710896034086720920121298425061902...1903\end{Verbatim}19041905Not all polytopes are parallelotopes, and in most cases Normaliz must compute the vertices or extreme rays as an auxiliary step, even if we are not interested in them. You can always add the option1906\begin{itemize}1907\itemtt [NoExtRaysOutput]1908\end{itemize}1909if you want to suppress their output. (The numerical information on the number of extreme rays etc. will however been included in the output file if it is available.)19101911On the other hand, the information provided by the vertices may be important. Instead of the unreadable integer output shown above, you can ask for1912\begin{itemize}1913\itemtt [VerticesFloat]1914\end{itemize}1915Then the vertices of polyhedra are printed in floating point format:1916\begin{Verbatim}1917256 vertices of polyhedron:1918-3.41637 -1.11691 1.0521 ... 0.435796 -0.222167 11919-3.41637 -0.946868 0.435796 ... -1.0521 0.632677 11920...1921\end{Verbatim}1922Notre that they can only be printed if a polyhedron is defined. This is always the case in inhomogeneous computations, but in the homogeneous case a grading is necessary.19231924\subsection{The integer hull}\label{IntHull}19251926The integer hull of a polyhedron $P$ is the convex hull of the set of lattice points in $P$ (despite of its name, it usually does not contain $P$). Normaliz computes by first finding the lattice points and then computing the convex hull. The computation of the integer hull is requested by the computation goal \verb|IntegerHull|.19271928The computation is somewhat special since it creates a second cone (and lattice) $C_\textup{int}$. In homogeneous computations the degree $1$ vectors generate $C_\textup{int}$ by an input matrix of type \verb|cone_and_lattice|. In inhomogeneous computations the module generators and the Hilbert basis of the recession cone are combined and generate $C_\textup{int}$. Therefore the recession cone is reproduced, even if the polyhedron should not contain a lattice point.19291930The integer hull computation itself is always inhomogeneous. The output file for $C_\textup{int}$ is \verb|<project>.IntHull.out|.19311932As a very simple example we take \verb|rationalIH.in| (\verb|rational.in| augmented by \verb|IntegerHull|):1933\begin{Verbatim}1934amb_space 31935cone 319361 1 21937-1 -1 319381 -2 41939grading1940unit_vector 31941HilbertSeries1942IntegerHull1943\end{Verbatim}1944It is our rational polytope from Section \ref{rational}. We know already that the origin is the only lattice point it contains. Nevertheless let us have a look at \verb|rationalIH.IntHull.out|:19451946\begin{Verbatim}19471 vertices of polyhedron19480 extreme rays of recession cone19491 support hyperplanes of polyhedron (homogenized)19501951embedding dimension = 31952affine dimension of the polyhedron = 01953rank of recession monoid = 01954internal index = 1195519561957***********************************************************************195819591 vertices of polyhedron:19600 0 1196119620 extreme rays of recession cone:196319641 support hyperplanes of polyhedron (homogenized):19650 0 1196619672 equations:19681 0 019690 1 0197019711 basis elements of lattice:19720 0 11973\end{Verbatim}1974Since the lattice points in $P$ are already known, the goal was to compute the constraints defining the integer hull. Note that all the constraints defining the integer hull can be different from those defining $P$. In this case the integer hull is cit out by the $2$ equations.19751976As a second example we take the polyhedron of Section \ref{inhom_ineq_ex}. The integer hull is the ''green'' polyhedron:1977\begin{center}1978\begin{tikzpicture}[scale=0.7]19791980\filldraw[yellow] (5,-0.5) -- (-2,-0.5) -- (0,1.5) -- (5,1.5) -- cycle;1981\filldraw[green] (5,0) -- (-1,-0) -- (0,1) -- (5,1) -- cycle;19821983\foreach \x in {-2,...,5}1984\foreach \y in {-1,...,2}1985{1986\filldraw[fill=black] (\x,\y) circle (1.5pt);1987}1988\draw[->] (-2.5,0) -- (5.5,0);1989\draw[->] (0,-1.5) -- (0,2.5);1990\draw (5,-0.5) -- (-2,-0.5) -- (0,1.5) -- (5,1.5);1991\draw[thick] (5,0) -- (-1,-0) -- (0,1) -- (5,1);1992\end{tikzpicture}1993\end{center}19941995The input is \verb|InhomIneqIH.in| ( \verb|InhomIneq.in| augmented by \verb|IntegerHull|). The data of the integer hull are found in \verb|InhomIneqIH.IntHull.out|:1996\begin{Verbatim}1997...19982 vertices of polyhedron:1999-1 0 120000 1 1200120021 extreme rays of recession cone:20031 0 0200420053 support hyperplanes of polyhedron (homogenized):20060 -1 120070 1 020081 -1 12009\end{Verbatim}20102011\subsection{Inhomogeneous congruences}\label{ChinRem}20122013We want to compute the nonnegative solutions of the simultaneous inhomogeneous congruences2014\begin{align*}2015x_1 + 2x_2 &\equiv 3\pod 7,\\20162x_1 + 2x_2 &\equiv 4\pod{13}2017\end{align*}2018in two variables. The input file \verb|InhomCong.in| is2019\begin{Verbatim}2020amb_space 22021constraints 2 symbolic2022x[1] + 2x[2] ~ 3 (7);20232x[1] + 2x[2] ~ 4 (13);2024\end{Verbatim}2025This is an example of input of symbolic constraints. We use \verb|~| as the best ASCII character for representing the congruence sign $\equiv$.20262027Alternatively one can use a matrix in the input As for which we must move the right hand side over to the left.2028\begin{Verbatim}2029amb_space 22030inhom_congruences 220311 2 -3 720322 2 -4 132033\end{Verbatim}2034It is certainly harder to read.20352036The first vector list in the output:20372038\begin{Verbatim}20393 module generators:20400 54 120411 1 1204280 0 12043\end{Verbatim}2044Easy to check: if $(1,1)$ is a solution, then it must generate the module of solutions together with the generators of the intersections with the coordinate axes. Perhaps more difficult to find:2045\begin{Verbatim}20466 Hilbert basis elements of recession monoid:20470 91 020481 38 020493 23 0 1 vertices of polyhedron:20505 8 0 0 0 91205112 1 0205291 0 02053\end{Verbatim}2054Strange, why is $(0,0,1)$, representing the origin in $\RR^2$, not listed as a vertex as well?2055Well the vertex shown represents an extreme ray in the lattice $\EE$, and $(0,0,1)$ does not belong to $\EE$.20562057\begin{Verbatim}20582 extreme rays of recession cone:20590 91 0206091 0 0206120623 support hyperplanes of polyhedron (homogenized)20630 0 120640 1 020651 0 0206620671 congruences:206858 32 1 912069\end{Verbatim}2070Normaliz has simplified the system of congruences to a single one.2071\begin{Verbatim}20723 basis elements of lattice:20731 0 3320740 1 -3220750 0 912076\end{Verbatim}2077Again, don't forget that Normaliz prints a basis of the efficient lattice $\EE$.20782079\subsubsection{Lattice and offset}\label{offset_ex}20802081The set of solutions to the inhomogeneous system is an affine lattice in $\RR^2$. The lattice basis of $\EE$ above does not immediately let us write down the set of solutions in the form $w+L_0$ with a subgroup $L_0$, but we can easily transform the basis of $\EE$: just add the first and the second vector to obtain $(1,1,1)$ -- we already know that it belongs to $\EE$ and any element in $\EE$ with last coordinate $1$ would do. Try the file \verb|InhomCongLat.in|:20822083\begin{Verbatim}2084amb_space 22085offset20861 12087lattice 2208832 33208991 912090\end{Verbatim}209120922093\subsubsection{Variation of the signs}\label{sign_ex}20942095Suppose we want to solve the system of congruences under the condition that both variables are negative (\verb|InhomCongSigns.in|):20962097\begin{Verbatim}2098amb_space 22099inhom_congruences 221001 2 -3 721012 2 -4 132102signs2103-1 -12104\end{Verbatim}2105The two entries of the sign vector impose the sign conditions $x_1\le 0$ and $x_2\le 0$.21062107From the output we see that the module generators are more complicated now:2108\begin{Verbatim}21094 module generators:2110-11 0 12111-4 -7 12112-2 -22 121130 -37 12114\end{Verbatim}2115The Hilbert basis of the recession monoid is simply that of the nonnegative case multiplied by $-1$.21162117\subsection{Integral closure and Rees algebra of a monomial ideal}\label{Rees}21182119Next, let us discuss the example \ttt{MonIdeal.in} (typeset in two columns):21202121\begin{Verbatim}2122amb_space 52123rees_algebra 921241 2 1 2 1 0 3 421253 1 1 3 5 1 0 121262 5 1 0 2 4 1 521270 2 4 3 2 2 2 421280 2 3 42129\end{Verbatim}2130The input vectors are the exponent vectors of a monomial ideal $I$ in the ring $K[X_1,X_2,X_3,X_4]$. We want to compute the normalization of the Rees algebra of the ideal. In particular we can extract from it the integral closure of the ideal. Since we must introduce an extra variable $T$, we have \verb|amb_space 5|.21312132In the Hilbert basis we see the exponent vectors of the $X_i$, namely the unit vectors with last component $0$. The vectors with last component $1$ represent the integral closure $\overline I$ of the ideal. There is a vector with last component $2$, showing that the integral closure of $I^2$ is larger than~$\overline I^2$.2133\begin{Verbatim}213416 Hilbert basis elements:21350 0 0 1 02136...21375 1 0 1 121386 5 2 2 22139214011 generators of integral closure of the ideal:21410 2 3 42142...21435 1 0 12144\end{Verbatim}2145The output of the generators of $\overline I$ is the only place where we suppress the homogenizing variable for ``historic'' reasons. If we extract the vectors with last component $1$ from the extreme rays, then we obtain the smallest monomial ideal that has the same integral closure as $I$.2146\begin{Verbatim}214710 extreme rays:21480 0 0 1 02149...21505 1 0 1 12151\end{Verbatim}2152The support hyperplanes which are not just sign conditions describe primary decompositions of all the ideals $\overline{I^k}$ by valuation ideals. It is not hard to see that none of them can be omitted for large $k$ (for example, see: W. Bruns and G. Restuccia, Canonical modules of Rees algebras. J. Pure Appl. Algebra 201, 189--203 (2005)).2153\begin{Verbatim}215423 support hyperplanes:21550 0 0 0 121560 ...21576 0 1 3 -132158\end{Verbatim}21592160\subsubsection{Only the integral closure of the ideal}21612162If only the integral closure of the ideal is to be computed, one can choose the input as follows (\verb|IntClMonId.in|):2163\begin{Verbatim}2164amb_space 42165vertices 921661 2 1 2 12167...21682 2 2 4 12169cone 421701 0 0 021710 1 0 021720 0 1 021730 0 0 12174\end{Verbatim}21752176The generators of the integral closure appear as module generators in the output and the generators of the smallest monomial ideal with this integral closure are the vertices of the polyhedron.21772178\subsection{Starting from a binomial ideal}\label{binom_ex}21792180As an example, we consider the binomial ideal generated by2181$$2182X_1^2X_2-X_4X_5X_6,\ \ X_1X_4^2-X_3X_5X_6,\ \ X_1X_2X_3-X_5^2X_6.2183$$2184We want to find an embedding of the toric ring it defines and2185the normalization of the toric ring. The input vectors are obtained as the differences of the two exponent vectors in the binomials. So the input ideal \verb+lattice_ideal.in+ is2186\begin{Verbatim}2187amb_space 62188lattice_ideal 321892 1 0 -1 -1 -121901 0 -1 2 -1 -121911 1 1 0 -2 -12192\end{Verbatim}2193In order to avoid special input rules for this case in which our object is not defined as a subset of an ambient space, but as a quotient of type \emph{generators/relations}, we abuse the name \verb|amb_space|: it determines the space in which the input vectors live.21942195We get the output2196\begin{Verbatim}21976 original generators of the toric ring2198\end{Verbatim}2199namely the residue classes of the indeterminates.2200\begin{Verbatim}22019 Hilbert basis elements22029 Hilbert basis elements of degree 12203\end{Verbatim}2204So the toric ring defined by the binomials is not normal. Normaliz found the standard grading on the toric ring. The normalization is generated in degree $1$, too (in this case).2205\begin{Verbatim}22065 extreme rays22075 support hyperplanes22082209embedding dimension = 32210rank = 3 (maximal)2211external index = 12212internal index = 12213original monoid is not integrally closed2214\end{Verbatim}2215We saw that already.2216\begin{Verbatim}2217size of triangulation = 52218resulting sum of |det|s = 1022192220grading:2221-2 1 12222\end{Verbatim}2223This is the grading on the ambient space (or polynomial ring) defining the standard grading on our subalgebra. The enumerative data that follow are those of the normalization!2224\begin{Verbatim}2225degrees of extreme rays:22261: 522272228Hilbert basis elements are of degree 122292230multiplicity = 1022312232Hilbert series:22331 6 32234denominator with 3 factors:22351: 322362237degree of Hilbert Series as rational function = -122382239Hilbert polynomial:22401 3 52241with common denominator = 122422243rank of class group = 22244class group is free22452246***********************************************************************224722486 original generators:22490 0 122503 5 222510 1 022521 2 122531 3 022541 0 32255\end{Verbatim}2256This is an embedding of the toric ring defined by the binomials. There are many choices, and Normaliz has taken one of them. You should check that the generators in this order satisfy the binomial equations. Turning to the ring theoretic interpretation, we can say that the toric ring defined by the binomial equations can be embedded into $K[Y_1,Y_2,Y_3]$ as a monomial subalgebra that is generated by $Y_1^0Y_2^0Y_3^1$,\dots,$Y_1^1Y_2^0Y_3^3$.22572258Now the generators of the normalization:2259\begin{Verbatim}22609 Hilbert basis elements of degree 1: 5 extreme rays:22610 0 1 0 0 122620 1 0 0 1 022631 0 3 1 0 322641 1 2 1 3 022651 2 1 3 5 222661 3 022672 3 2 5 support hyperplanes:22682 4 1 -15 7 522693 5 2 -3 1 222700 0 122710 1 022721 0 0227322740 further Hilbert basis elements of higher degree:2275\end{Verbatim}227622772278%%%%%%%%%%%%%%%%%%%%%%%%%%%%% INPUT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%2279\section{The input file}\label{input}22802281The input file \ttt{<project>.in} consists of one or2282several items. There are several types of items:22832284\begin{arab}2285\item definition of the ambient space,2286\item matrices with integer or rational entries (depending on the type),2287\item vectors with integer entries,2288\item constraints in or symbolic format,2289\item a polynomial,2290\item computation goals and algorithmic variants,2291\item numerical parameters,2292\item comments.2293\end{arab}22942295An item cannot include another item. In particular, comments can only be included between other items, but not within another item. Matrices and vectors can have two different formats, plain and formatted.22962297Matrices and vectors are classified by the following attributes:2298\begin{arab}2299\item generators, constraints, accessory,2300\item cone/polyhedron, (affine) lattice,2301\item homogeneous, inhomogeneous.2302\end{arab}2303In this classification, equations are considered as constraints on the lattice because Normaliz treats them as such -- for good reason: it is very easy to intersect a lattice with a hyperplane.23042305The line structure is irrelevant for the interpretation of the input, but it is advisable to use it for the readability of the input file.23062307The input syntax of Normaliz 2 can still be used. It is explained in Appendix \ref{OldSyntax}.23082309\subsection{Input items}23102311\subsubsection{The ambient space and lattice}23122313The ambient space is specified as follows:2314\begin{Verbatim}2315amb_space <d>2316\end{Verbatim}2317where \ttt{<d>} stands for the dimension $d$ of the ambient vector space $\RR^d$ in which the geometric objects live. The \emph{ambient lattice} $\AA$ is set to $\ZZ^d$.23182319Alternatively one can define the ambient space implicitly by2320\begin{Verbatim}2321amb_space auto2322\end{Verbatim}2323In this case the dimension of the ambient space is determined by Normaliz from the first formatted vector or matrix in the input file. It is clear that any input item that requites the knowledge of the dimension can only follow the first formatted vector or matrix.23242325\emph{In the following the letter $d$ will always denote the dimension set with} \verb|amb_space|.232623272328An example:2329\begin{Verbatim}2330amb_space 52331\end{Verbatim}2332indicates that polyhedra and lattices are subobjects of $\RR^5$. The ambient lattice is $\ZZ^5$.23332334\emph{The first non-comment input item must specify the ambient space.}23352336\subsubsection{Plain vectors}23372338A plain vector is built as follows:2339\begin{Verbatim}2340<T>2341<x>2342\end{Verbatim}2343Again \ttt{<T>} denotes the type and \ttt{<x>} is the vector itself. The number of components is determined by the type of the vector and the dimension of the ambient space. At present, all vectors have length $d$.23442345Example:2346\begin{Verbatim}2347grading23481 0 02349\end{Verbatim}23502351Normaliz allows also the input of sparse vectors. Sparse input is signalized by the key word \verb|sparse| as the first entry. It is followed by entries of type \verb|<col>:<val>| where \verb|<pos>| denotes the column and \verb|<val>| the value in that column. (The unspecified columns have entry $0$.) A sparse vector is terminated by the character \verb|;| .23522353Example:2354\begin{Verbatim}2355grading2356sparse 1:1;2357\end{Verbatim}235823592360For certain vectors there also exist shortcuts. Examples:2361\begin{Verbatim}2362total_degree2363unit_vector 252364\end{Verbatim}236523662367\subsubsection{Formatted vectors}23682369A formatted vector is built as follows:2370\begin{Verbatim}2371<T>2372[ <x> ]2373\end{Verbatim}2374where \ttt{<T>} denotes the type and \ttt{<x>} is the vector itself. The components can be separated by white space, commas or semicolons. An example showing all possibilities (not recommended):2375\begin{Verbatim}2376grading2377[1,0; 0 5]2378\end{Verbatim}23792380\subsubsection{Plain matrices}23812382A plain matrix is built as follows:2383\begin{Verbatim}2384<T> <m>2385<x_1>2386...2387<x_m>2388\end{Verbatim}2389Here \ttt{<T>} denotes the type of the matrix, \ttt{<m>} the number of rows, and \ttt{<x\_1>},...,\ttt{<x\_m>} are the rows. Some types allow rational and floating point matrix entries, others are restricted to integers; see Sections \ref{rational_input} and \ref{decimal_input}.23902391The number of columns is implicitly defined by the dimension of the ambient space and the type of the matrix. Example (with \verb|amb_space 3|):2392\begin{Verbatim}2393cone 323941/3 2 323954 5 6239611 12/7 13/212397\end{Verbatim}23982399Normaliz allows the input of matrices in transposed form:2400\begin{Verbatim}2401<T> transpose <n>2402<x_1>2403...2404<x_m>2405\end{Verbatim}2406Note that \verb|<n>| is now the number of \emph{columns} of the matrix that follows it (assumed to be the number of input vectors). The number of rows is determined by the dimension of the ambient space and the type of the matrix. Example:2407\begin{Verbatim}2408cone transpose 324091 0 3/224100 1/9 42411\end{Verbatim}2412is equivalent to2413\begin{Verbatim}2414cone 324151 024160 1/924173/2 42418\end{Verbatim}24192420Like vectors, matrices have a sparse input variant, again signalized by the key word \verb|sparse|. The rows are sparse vectors with entries \verb|<col>:<val>|, and each row is concluded by the character \verb|;|.24212422Example:2423\begin{Verbatim}2424inequalities 3 sparse24251:1;24262:1;24273:1;2428\end{Verbatim}2429chooses the $3\times 3$ unit matrix as a matrix of type \verb|inequalities|. Note that also in case of transposed matrices, sparse entry is row by row.24302431\emph{Matrices may have zero rows.} Such empty matrices like2432\begin{Verbatim}2433inhom_inequalities 02434\end{Verbatim}24352436can be used to make the input inhomogeneous (Section \ref{inhom_inp}) or to avoid the automatic choice of the positive orthant in certain cases (Section \ref{default}). (The empty \verb|inhom_inequalities| have both effects simultaneously.) Apart from these effects, empty matrices have no influence on the computation.24372438\subsubsection{Formatted matrices}24392440A formatted matrix is built as follows:2441\begin{Verbatim}2442<T>2443[ [<x_1>]2444...2445[<x_m>] ]2446\end{Verbatim}2447Here \ttt{<T>} denotes the type of the matrix and \verb|<x_1>|,\dots,\verb|<x_m>| are vectors. Legal separators are white space, commas and semicolons. An example showing all possibilities (not really recommended):2448\begin{Verbatim}2449cone [2450[ 2 1][3/7 4];2451[0 1],2452[9 10] [11 12/13]2453]2454\end{Verbatim}2455Similarly as plain matrices, formatted matrices can be given in transposed form, and they can be empty.24562457\subsubsection{Constraints in tabular format}\label{const_syntax}24582459This input type is somewhat closer to standard notation than the encoding of constraints in matrices. The general type of equations and inequalities is2460\begin{Verbatim}2461<x> <rel> <int>;2462\end{Verbatim}2463where \verb|<x>| denotes a vector of length $d$, \verb|<rel>| is one of the relations \verb|=, <=, >=, <, >| and \verb|<int>| is an integer.24642465Congruences have the form2466\begin{Verbatim}2467<x> ~ <int> (<mod>);2468\end{Verbatim}2469where \verb|<mod>| is a nonzero integer.24702471Examples:2472\begin{Verbatim}24731/2 -2 >= 524741 -1/7 = 02475-1 1 ~ 7 (9)2476\end{Verbatim}24772478Note: all numbers and relation signs must be separated by white space.24792480\subsubsection{Constraints in symbolic format}\label{symb_syntax}24812482This input type is even closer to standard notation than the encoding of constraints in matrices or in tabular format. It is especially useful if the constraints are sparse. Instead of assigning a value to a coordinate via its position in a vector, it uses coordinates named \verb|x[<n>]| where \verb|<n>| is the index of the coordinate. The index is counted from $1$.24832484The general type of equations and inequalities is2485\begin{Verbatim}2486<lhs> <rel> <rhs>;2487\end{Verbatim}2488where \verb|<lhs>| and \verb|<rhs>| denote linear function of the \verb|x<n>| with integer coefficients.2489As above, \verb|<rel>| is one of the relations \verb|=, <=, >=, <, >|. (An empty \verb|<lhs>| or \verb|<rhs>| has the value $0$.) Note the terminating semicolon.24902491Congruences have the form2492\begin{Verbatim}2493<lhs> ~ <rhs> (<mod>);2494\end{Verbatim}2495where \verb|<mod>| is a nonzero integer.24962497Examples:2498\begin{Verbatim}24991/3x[1] >= 2x[2] + 5;2500x[1]+1=1/4x[2] ;2501-x[1] + x[2] ~ 7 (9);2502\end{Verbatim}25032504There is no need to insert white space for separation, but it may be inserted anywhere where it does not disrupt numbers or relation signs.25052506\subsubsection{Polynomials}\label{poly_input}25072508For the computation of weighted Ehrhart series and integrals Normaliz needs the input of a polynomial with rational coefficients. The polynomial is first read as a string. For the computation the string is converted by the input function of CoCoALib \cite{CoCoA}. Therefore any string representing a valid CoCoA expression is allowed. However the names of the indeterminates are fixed: \verb|x[1]|,\dots,\verb|x[<N>| where \verb|<N>]| is the value of \verb|amb_space|. The polynomial must be concluded by a semicolon.25092510Example:2511\begin{Verbatim}2512(x[1]+1)*(x[1]+2)*(x[1]+3)*(x[1]+4)*(x[1]+5)*2513(x[2]+1)*(x[3]+1)*(x[4]+1)*(x[5]+1)*(x[6]+1)*(x[7]+1)*2514(x[8]+1)*(x[8]+2)*(x[8]+3)*(x[8]+4)*(x[8]+5)*1/14400;25152516(x[1]*x[2]*x[3]*x[4])^2*(x[1]-x[2])^2*(x[1]-x[3])^2*2517(x[1]-x[4])^2*(x[2]-x[3])^2*(x[2]-x[4])^2*(x[3]-x[4])^2;2518\end{Verbatim}25192520\subsubsection{Rational numbers}\label{rational_input}25212522Rational numbers are allowed in input matrices, but not in all. They are \emph{not} allowed in vectors and in matrices containing lattice generators and in congruences, namely in2523\begin{Verbatim}2524lattice cone_and_lattice normalization offset open_facets2525congruences inhom_congruences rees_algebra lattice_ideal2526grading dehomogenization signs strict_signs2527\end{Verbatim}2528They are allowed in \verb|saturation| since it defines the intersection of the vector space generated by the rows of the matrix with the integral lattice.25292530Note: Only positive numbers are allowed as denominators. Negative denominators may result in a segmentation fault. Illegal formats may result in25312532\begin{Verbatim}2533std::exception caught... "mpz_set_str" ... exiting.2534\end{Verbatim}25352536Normaliz first reduces the input numbers to lowest terms. Then each row of a matrix is multiplied by the least common multiple of the denominators of its entries. In all applications in which the original monoid generators play a role, one should use only integers in input matrices to avoid any ambiguity.25372538\subsubsection{Decimal fractions and floating point numbers}\label{decimal_input}25392540Normaliz accepts decimal fractions and floating point numbers in its input files. These are precisely converted to ordinary fractions (or integers). Examples:2541\begin{Verbatim}25421.1 --> 11/10 0.5 --> 1/2 -.1e1 --> -12543\end{Verbatim}2544It is not allowed to combine an ordinary fraction and a decimal fraction in the same number. In other words, expressions like \verb|1.0/2| are not allowed.25452546\subsubsection{Computation goals and algorithmic variants}\label{subsecGoals}25472548These are single or compound words, such as2549\begin{Verbatim}2550HilbertBasis2551Multiplicity2552\end{Verbatim}2553The file can contain several computation goals, as in this example.25542555\subsubsection{Comments}25562557A comment has the form2558\begin{Verbatim}2559/* <text> */2560\end{Verbatim}2561where \ttt{<text>} stands for the text of the comment. It can have arbitrary length and stretch over several lines. Example:2562\begin{Verbatim}2563/* This is a comment2564*/2565\end{Verbatim}2566Comments are only allowed at places where also a new keyword would be allowed, especially not between the entries of a matrix or a vector. Comments can not be nested.25672568\subsubsection{Restrictions}25692570Input items can almost freely be combined, but there are some restrictions:25712572\begin{arab}2573\item Every input type can appear only once.2574\item The types2575\begin{center}2576\ttt {cone, cone\_and\_lattice, polytope, rees\_algebra}2577\end{center}2578exclude each other mutually.2579\item The input type \verb|subspace| excludes \verb|polytope| and \verb|rees_algebra|.2580\item The types2581\begin{center}2582\ttt {lattice}, \ttt{saturation}, \ttt{cone\_and\_lattice}2583\end{center}2584exclude each other mutually.2585\item \verb|polytope| can not be combined with \verb|grading|.2586\item The only type that can be combined with \ttt{lattice\_ideal} is \ttt{grading}.2587\item The following types cannot be combined with inhomogeneous types or \verb|dehomogenization|:2588\begin{center}2589\ttt{polytope, rees\_algebra, excluded\_faces}2590\end{center}25912592\item The following types cannot be combined with inhomogeneous types:2593\begin{center}2594\ttt{dehomogenization, support\_hyperplanes}2595\end{center}25962597\item Special restrictions apply for the input type \verb|open_facets|; see Section \ref{open_facets}.2598\end{arab}25992600\subsubsection{Homogeneous and inhomogeneous input}\label{inhom_inp}26012602Apart from the restrictions listed in the previous section, homogeneous and inhomogeneous types can be combined as well as generators and constraints. A single inhomogeneous type or \verb|dehomogenization| in the input triggers an inhomogeneous computation. The input item of inhomogeneous type may be an empty matrix.26032604\subsubsection{Default values}\label{default}26052606If there is no lattice defining item, Normaliz (virtually) inserts the the unit matrix as an input item of type \ttt{lattice}. If there is no cone defining item, the unit matrix is (additionally) inserted as an input item of type \ttt{cone}.26072608If the input is inhomogeneous, then Normaliz provides default values for vertices and the offset as follows:2609\begin{arab}2610\item If there is an input matrix of lattice type lattice, but no \ttt{offset}, then the offset $0$ is inserted.2611\item If there is an input matrix of type cone, but no \ttt{vertices}, then the vertex $0$ is inserted.2612\end{arab}26132614\textbf{An important point.}\enspace If the input does not contain any cone generators or inequalities, Normaliz automatically assumes that you want to compute in the positive orthant. In order to avoid this choice you can add an empty matrix of inequalities. This will not affect the results, but avoid the sign restriction.2615261626172618\subsubsection{Normaliz takes intersections (almost always)}26192620The input may contain several cone defining items and several lattice defining items.26212622The sublattice $L$ defined by the lattice input items is the \emph{intersection} of the sublattices defined by the single items. The polyhedron $P$ is defined as the intersection of all polyhedra defined by the single polyhedron defining items. The object then computed by Normaliz is2623$$2624P\cap L.2625$$26262627There are three notable exceptions to the rule that Normaliz takes intersections:2628\begin{arab}2629\item \verb|vertices| and \verb|cone| form a unit. Together they define a polyhedron.2630\item The same applies to \verb|offset| and \verb|lattice| that together define an affine lattice.2631\item The \verb|subspace| is added to \verb|cone| or \verb|cone_and_lattice|.2632\end{arab}26332634\subsection{Homogeneous generators}26352636\subsubsection{Cones}\label{cone_synt}26372638The main type is \verb|cone|. The other two types are added for special computations.26392640\begin{itemize}2641\itemtt[cone] is a matrix with $d$ columns. Every row represents a vector, and they define the cone generated by them. Section \ref{cone_ex}, \verb|2cone.in|26422643\itemtt[subspace] is a matrix with $d$ columns. The linear subspace generated by the rows is added to the cone. Section \ref{subspace}.26442645\itemtt[polytope] is a matrix with $d-1$ columns. It is internally converted to \verb|cone| extending each row by an entry $1$. Section \ref{polytope_ex}, \verb|polytope.in|26462647\itemtt[rees\_algebra] is a matrix with $d-1$ columns. It is internally converted to type \verb|cone| in two steps: (i) each row is extended by an entry $1$ to length $d$. (ii) The first $d-1$ unit vectors of length $d$ are appended. Section \ref{Rees}, \verb|MonIdeal.in|.2648\end{itemize}26492650Moreover, it is possible to define a cone and a lattice by the same matrix:26512652\begin{itemize}2653\itemtt[cone\_and\_lattice] The vectors of the matrix with $d$ columns define both a cone and a lattice. Section \ref{normalization_ex}, \verb|A443.in|.26542655If \verb|subspace| is used in combination with \verb|cone_and_lattice|, then the sublattice generated by its rows is added to the lattice generated by \verb|cone_and_lattice|.2656\end{itemize}265726582659The Normaliz 2 types \verb|integral_closure| and \verb|normalization| can still be used. They are synonyms for \verb|cone| and \verb|cone_and_lattice|, respectively.26602661\subsubsection{Lattices}26622663There are $3$ types:26642665\begin{itemize}2666\itemtt[lattice] is a matrix with $d$ columns. Every row represents a vector, and they define the lattice generated by them. Section \ref{latt_ex}, \verb|3x3magiceven_lat.in|26672668\itemtt[saturation] is a matrix with $d$ columns. Every row represents a vector, and they define the \emph{saturation} of the lattice generated by them. Section \ref{latt_ex}, \verb|3x3magic_sat.in|.26692670\itemtt[cone\_and\_lattice] See Section \ref{cone_synt}.2671\end{itemize}267226732674\subsection{Homogeneous Constraints}26752676\subsubsection{Cones} \label{HomConstrCone}26772678\begin{itemize}2679\itemtt[inequalities] is a matrix with $d$ columns. Every row $(\xi_1,\dots,\xi_d)$ represents a homogeneous inequality2680$$2681\xi_1x_1+\dots+\xi_dx_d\ge 0, \qquad \xi_i\in\ZZ,2682$$2683for the vectors $(x_1,\dots,x_d)\in\RR^d$. Sections \ref{ineq_ex}, \ref{rat_ineq} , \verb|2cone_ineq.in|, \verb|poly_ineq.in|26842685\itemtt[signs] is a vector with $d$ entries in $\{-1,0,1\}$.2686It stands for a matrix of type \verb|inequalities| composed of the sign inequalities $x_i\ge 0$ for the entry $1$ at the $i$-th component and the inequality $x_i\le 0$ for the entry $-1$. The entry $0$ does not impose an inequality. See \ref{sign_ex}, \verb|InhomCongSigns.in|.26872688\itemtt[nonnegative] It stands for a vector of type \verb|sign| with all entries equal to $1$. See Section \ref{Condorcet}, \verb|Condorcet.in|.26892690\itemtt[excluded\_faces] is a matrix with $d$ columns. Every row $(\xi_1,\dots,\xi_d)$ represents an inequality2691$$2692\xi_1x_1+\dots+\xi_dx_d> 0, \qquad \xi_i\in\ZZ,2693$$2694for the vectors $(x_1,\dots,x_d)\in\RR^d$. It is considered as a homogeneous input type though it defines inhomogeneous inequalities. The faces of the cone excluded by the inequalities are excluded from the Hilbert series computation, but \verb|excluded_faces| behaves like \verb|inequalities| in every other respect .2695Section \ref{excluded_ex}, \verb|CondorcetSemi.in|.26962697\itemtt[support\_hyperplanes] is a matrix with $d$ columns. It requires homogeneous input. It is the input type for precomputed support hyperplanes. Therefore Normaliz checks if all input generators satisfy the inequalities defined by them. Apart from this extra check, it behaves like \verb|inequalities|. Note that it overrides all other inequalities in the input, but \verb|excluded_faces| still exclude the faces defined by them. Section \ref{supphyp_ex}, \verb|2cone_supp.in|.2698\end{itemize}26992700\subsubsection{Lattices}27012702\begin{itemize}2703\itemtt[equations] is a matrix with $d$ columns. Every row $(\xi_1,\dots,\xi_d)$ represents an equation2704$$2705\xi_1x_1+\dots+\xi_dx_d= 0, \qquad \xi_i\in\ZZ,2706$$2707for the vectors $(x_1,\dots,x_d)\in\RR^d$. Section \ref{eq_ex}, \verb|3x3magic.in|27082709\itemtt[congruences] is a matrix with $d+1$ columns. Each row $(\xi_1,\dots,\xi_d,c)$ represents a congruence2710$$2711\xi_1z_1+\dots+\xi_dz_d\equiv 0 \mod c, \qquad \xi_i,c\in\ZZ,2712$$2713for the elements $(z_1,\dots,z_d)\in\ZZ^d$. Section \ref{cong_ex}, \verb|3x3magiceven.in|.2714\end{itemize}27152716\subsection{Inhomogeneous generators}27172718\subsubsection{Polyhedra}27192720\begin{itemize}2721\itemtt[vertices] is a matrix with $d+1$ columns. Each row $(p_1,\dots,p_d,q)$, $q>0$, specifies a generator of a polyhedron (not necessarily a vertex), namely2722$$2723v_i=\biggl(\frac{p_{1}}{q},\dots,\frac{p_{n}}{q}\biggr), \qquad p_i\in\ZZ,q\in\ZZ_{>0},2724$$2725Section \ref{polyh_ex}, \verb|InhomIneq_gen.in|27262727\textbf{Note:}\enspace \verb|vertices| and \verb|cone| together define a polyhedron. If \verb|vertices| is present in the input, then the default choice for \verb|cone| is the empty matrix.2728\end{itemize}27292730The Normaliz 2 input type \verb|polyhedron| can still be used.27312732\subsubsection{Lattices}27332734\begin{itemize}2735\itemtt[offset] is a vector with $d$ entries. It defines the origin of the affine lattice.2736Section \ref{offset_ex}, \verb|InhomCongLat.in|.2737\end{itemize}27382739\textbf{Note:}\enspace \verb|offset| and \verb|lattice| (or \verb|saturation|) together define an affine lattice. If \verb|offset| is present in the input, then the default choice for \verb|lattice| is the empty matrix.27402741\subsection{Inhomogeneous constraints}27422743\subsubsection{Cones}27442745\begin{itemize}2746\itemtt[inhom\_inequalities] is a matrix with $d+1$ columns. We consider inequalities2747$$2748\xi_1x_1+\dots+\xi_dx_d\ge \eta, \qquad \xi_i,\eta\in\ZZ,2749$$2750rewritten as2751$$2752\xi_1x_1+\dots+\xi_dx_d+(-\eta) \ge 02753$$2754and then represented by the input vectors2755$$2756(\xi_1,\dots,\xi_d,-\eta).2757$$2758Section \ref{inhom_ineq_ex}, \verb|InhomIneq.in|.27592760\itemtt[strict\_inequalities] is a matrix with $d$ columns. We consider inequalities2761$$2762\xi_1x_1+\dots+\xi_dx_d\ge 1, \qquad \xi_i\in\ZZ,2763$$2764represented by the input vectors2765$$2766(\xi_1,\dots,\xi_d).2767$$2768Section \ref{strict_ex}, \verb|2cone_int.in|.27692770\itemtt[strict\_signs] is a vector with $d$ components in $\{-1,0,1\}$. It is the ''strict'' counterpart to \verb|signs|. An entry $1$ in component $i$ represents the inequality $x_i>0$, an entry $-1$ the opposite inequality, whereas $0$ imposes no condition on $x_i$. \ref{strict_signs_ex}, \verb|Condorcet_one.in|2771\end{itemize}27722773\subsubsection{Lattices}27742775\begin{itemize}2776\itemtt[inhom\_equations] is a matrix with $d+1$ columns. We consider equations2777$$2778\xi_1x_1+\dots+\xi_dx_d= \eta, \qquad \xi_i,\eta\in\ZZ,2779$$2780rewritten as2781$$2782\xi_1x_1+\dots+\xi_dx_d+(-\eta) = 02783$$2784and then represented by the input vectors2785$$2786(\xi_1,\dots,\xi_d,-\eta).2787$$2788See \ref{inhom_eq_ex}\verb|NumSemi.in|.27892790\itemtt[inhom\_congruences] We consider a matrix with $d+2$ columns. Each the row $(\xi_1,\dots,\xi_d,-\eta,c)$ represents a congruence2791$$2792\xi_1z_1+\dots+\xi_dz_d\equiv \eta \mod c, \qquad \xi_i,\eta,c\in\ZZ,2793$$2794for the elements $(z_1,\dots,z_d)\in\ZZ^d$. Section \ref{ChinRem}, \verb|InhomCongSigns.in|.2795\end{itemize}27962797\subsection{Tabular constraints}27982799\begin{itemize}2800\itemtt[constraints] allows the input of equations, inequalities and congruences in a format that is close to standard notation. As for matrix types the keyword \verb|constraints| is followed by the number of constraints. The syntax of tabular constraints has been described in Section \ref{cone_synt}. If $(\xi_1,\dots,\xi_d)$ is the vector on the left hand side and $\eta$ the integer on the right hand side, then the constraint defines the set of vectors $(x_1,\dots,x_d)$ such that the relation2801$$2802\xi_1x_1+\dots \xi_dx_d \texttt{ rel } \eta2803$$2804is satisfied, where \verb|rel| can take the values $=,\leq,\geq,<,>$ with the represented by input strings \verb|=,<=,>=,<,>|, respectively.28052806The input string \verb|~| represents a congruence $\equiv$ and requires the additional input of a modulus. It represents the congruence2807$$2808\xi_1x_1+\dots \xi_dx_d \equiv \eta \pmod c.2809$$2810Sections \ref{strict_ex}, \verb|2cone_int.in|, \ref{cong_ex}, \ttt{3x3magiceven.in}, \ref{inhom_ineq_ex}, \verb|InhomIneq.in|.2811\end{itemize}28122813A right hand side $\neq 0$ makes the input inhomogeneous, as well as the relations $<$ and $>$. Strict inequalities are always understood as conditions for integers. So2814$$2815\xi_1x_1+\dots +\xi_dx_d < \eta2816$$2817is interpreted as2818$$2819\xi_1x_1+\dots \xi_dx_d \le \eta-1,2820$$282128222823\subsubsection{Forced homogeneity}28242825It is often more natural to write constraints in inhomogeneous form, even when one wants the computation to be homogeneous. The type \verb|constraints| does not allow this. Therefore we have introduced2826\begin{itemize}2827\itemtt[hom\_constraints] for the input of equations, non-strict inequalities and congruences in the same format as \verb|constraints|, except that these constraints are meant to be for a homogeneous computation. It is clear that the left hand side has only $d-1$ entries now. See Section \ref{rat_ineq}, \verb|poly_hom_const.in|.2828\end{itemize}28292830\subsection{Symbolic constraints}28312832The input syntax is28332834\begin{itemize}2835\itemtt[constraints <n> symbolic] where \verb|<n>| is the number of constraints in symbolic form that follow.2836\end{itemize}28372838The constraints have the form described in Section \ref{symb_syntax}. Note that every symbolic constraint (including the last) must be terminated by a semicolon.28392840See \ref{inhom_eq_ex}, \verb|NumSemi.in|, \ref{ChinRem}, \verb|InhomCong.in|.28412842The interpretation of homogeneity follows the same rules as for tabular constraints. The variant \verb|hom_constraints| is allowed and works as for tabular constraints.284328442845\subsection{Relations}\label{relations}28462847Relations do not select a2848sublattice of $\ZZ^d$ or a subcone of $\RR^d$, but define a2849monoid as a quotient of $\ZZ_+^d$ modulo a system of2850congruences (in the semigroup sense!).28512852The rows of the input matrix of this type are interpreted as2853generators of a subgroup $U\subset\ZZ^d$, and Normaliz computes an affine monoid and its normalization as explained in Section \ref{binomials}.28542855Set $G=\ZZ^d/U$ and $L=G/\textup{torsion}(G)$. Then the ambient lattice2856is $\AA=\ZZ^r$, $r=\rank L$, and the efficient lattice is $L$, realized2857as a sublattice of $\AA$. Normaliz computes the image of $\ZZ^d_+$ in $L$ and its normalization.28582859\begin{itemize}2860\itemtt[lattice\_ideal] is a matrix with $d$ columns containing the generators of the subgroup $U$. Section \ref{binom_ex}, \verb|lattice_ideal.in|.2861\end{itemize}28622863The type \ttt{lattice\_ideal} cannot be combined with any other input type (except2864\ttt{grading})---such a combination would not make sense. (See Section \ref{grad_lattid} for the use of a grading in this case.)28652866\subsection{Unit vectors}\label{unit_vectors}28672868A grading or a dehomogenization is often given by a unit vector:2869\begin{itemize}2870\itemtt[unit\_vector <n>] represents the $n$th unit vector in $\RR^d$ where $n$ is the number given by \verb|<n>|.2871\end{itemize}2872This shortcut cannot be used as a row of a matrix. It can be used whenever a single vector is asked for, namely after \verb|grading|, \verb|dehomogenization|, \verb|signs| and \verb|strict_signs|. See Section \ref{rational}, \verb|rational.in|28732874\subsection{Grading}\label{grading}28752876This type is accessory. A $\ZZ$-valued grading can be specified in two ways:2877\begin{arab}2878\item \emph{explicitly} by including a grading in the input, or2879\item \emph{implicitly}. In this case Normaliz checks whether2880the extreme integral generators of the monoid lie in an2881(affine) hyperplane $A$ given by an equation $\lambda(x)=1$ with a $\ZZ$-linear form $\lambda$. If so, then $\lambda$ is used as the grading.\smallskip28822883\emph{Implicit gradings are only possible for homogeneous computations.}\smallskip28842885If the attempt to find an implicit grading causes an arithmetic overflow and \texttt{verbose} has been set (say, by the option\texttt{-c}), then Normaliz issues the warning2886\begin{Verbatim}2887Giving up the check for a grading2888\end{Verbatim}2889If you really need this check, rerun Normaliz with a bigger integer type.2890\end{arab}28912892Explicit definition of a grading:2893\begin{itemize}2894\itemtt[grading] is a vector of length $d$ representing the linear form that gives the grading. Section \ref{rational}, \verb|rational.in|.28952896\itemtt[total\_degree] represents a vector of length $d$ with all entries equal to $1$. Section \ref{Condorcet}, \verb|Condorcet.in|.2897\end{itemize}28982899Before Normaliz can apply the degree, it must be restricted2900to the effective lattice $\EE$. Even if the entries of the2901grading vector are coprime, it often happens that all degrees2902of vectors in $\EE$ are divisible by a greatest common divisor2903$ g>1$. Then $g$ is extracted from the degrees, and it will2904appear as \ttt{denominator} in the output file.29052906Normaliz checks whether all generators of the (recession) monoid have2907positive degree (after passage to the quotient modulo the unit group in the nonpointed case).2908Vertices of polyhedra may have degrees $\le 0$.29092910\subsubsection{\ttt{lattice\_ideal}} \label{grad_lattid}29112912In this case the unit vectors correspond to generators of the2913monoid. Therefore the degrees assigned to them must be2914positive. Moreover, the vectors in the input represent binomial2915relations, and these must be homogeneous. In other words, both2916monomials in a binomial must have the same degree. This amounts2917to the condition that the input vectors have degree $0$.2918Normaliz checks this condition.29192920\subsection{Dehomogenization}29212922Like \verb|grading| this is an accessory type.29232924Inhomogeneous input for objects in $\RR^d$ is homogenized by an additional coordinate and then computed in $\RR^{d+1}$, but with the additional condition $x_{d+1}\ge 0$, and then dehomogenizing all results: the substitution $x_{d+1}=1$ acts as the \emph{dehomogenization}, and the inhomogeneous input types implicitly choose this dehomogenization.29252926Like the grading, one can define the dehomogenization explicitly:2927\begin{itemize}2928\itemtt[dehomogenization] is a vector of length $d$ representing the linear form $\delta$.2929\end{itemize}29302931The dehomogenization can be any linear form $\delta$ satisfying the condition $\delta(x)\ge 0$ on the cone that is truncated. (In combination with constraints, the condition $\delta(x)\ge 0$ is automatically satisfied since $\delta$ is added to the constraints.)29322933The input type \verb|dehomogenization| can only be combined with homogeneous input types, but makes the computation inhomogeneous, resulting in inhomogeneous output. The polyhedron computed is the intersection of the cone $\CC$ (and the lattice $\EE$) with the hyperplane given by $\delta(x)=1$, and the recession cone is $\CC\cap\{x:\delta(x)=0\}$.29342935A potential application is the adaptation of other input formats to Normaliz. The output must then be interpreted accordingly.29362937Section \ref{dehom_ex}, \verb|dehomogenization.in|.29382939\subsection{Open facets}\label{open_facets}29402941The input type \verb|open_facets| is similar to \verb|strict_inequalities|. However, it allows to apply strict inequalities that are not yet known. This makes only sense for simplicial polyhedra where a facet can be identified by the generator that does \emph{not} lie in it.29422943\verb|open_facets| is a vector with entries $\in \{0,1\}$.29442945The restrictions for the use of open facets are the following:2946\begin{arab}2947\item Only the input types \verb|cone,| \verb|vertices| and \verb|grading| can appear together with \verb|open_facets|.2948\item The vectors in \verb|cone| are linearly independent.2949\item There is at most one vertex.2950\end{arab}2951The number of vectors in \verb|cone| may be smaller than $d$, but \verb|open_facets| must have $d$ entries.295229532954\verb|open_facets| make the computation inhomogeneous. They are interpreted as follows. Let $v$ be the vertex---if there are no \verb|vertices|, then $v$ is the origin. The shifted $C'=v+C$ is cut out by affine-linear inequalities $\lambda_i(x)\ge 0$ with coprime integer coefficients. We number these in such a way that $\lambda_i(v+c_i)\neq 0$ for the generators $c_i$ of $C$ (in the input order), $i=1,\dots,n$. Then all subsequent computations are applied to the shifted cone $C''=v'+C$ defined by the inequalities2955$$2956\lambda_i(x)\ge u_i2957$$2958where the vector $(u_1,\dots,u_d)$ is given by \verb|open_facets|. (If $\dim C<d$, then the entries $u_j$ with $j> \dim C$ are ignored.)29592960That $1$ indicates `open'' is in accordance with its use for the disjoint decomposition; see Section \ref{Disjoint}. Section \ref{LattPointsFPE} discusses an example.29612962\subsection{Numerical parameters}29632964Certain numerical parameters used by Normaliz can be set in the input file. Presently only:29652966\subsubsection{Number of significant coefficients of the quasipolynomial}29672968It can be set by2969\begin{Verbatim}2970nr_coeff_quasipol <n>2971\end{Verbatim}2972where \verb|<n>| is the number of highest coefficients to be printed. See Section \ref{highest_coeff}.29732974\subsection{Pointedness}29752976Since version 3.1 Normaliz can also compute nonpointed cones and polyhedra without vertices.29772978\subsection{The zero cone}\label{zero}29792980The zero cone with an empty Hilbert basis is a legitimate2981object for Normaliz. Nevertheless a warning message is issued2982if the zero cone is encountered.29832984\section{Computation goals and algorithmic variants}\label{Goals}29852986The library \verb|libnormaliz| contains a class \verb|ConeProperties| that collects computation goals, algorithmic variants and additional data that are used to control the work flow in \verb|libnormaliz| as well as the communication with other programs. The latter are not important for the Normaliz user, but are listed as a reference for \verb|libnormaliz|. See Appendix \ref{libnorm} for a description of \verb|libnormaliz|.29872988All computation goals and algorithmic variants can be communicated to Normaliz in two ways:2989\begin{arab}2990\item in the input file, for example \verb|HilbertBasis|,2991\item via a verbatim command line option, for example \verb|--HilbertBasis|.2992\end{arab}2993For the most important choices there are single letter command line options, for example \verb|-N| for \verb|HilbertBasis|. The single letter options ensure backward compatibility to Normaliz 2. In jNormaliz they are also accessible via their full names.29942995Some computation goals apply only to homogeneous computations, and some others make sense only for inhomogeneous computations.29962997Some single letter command line options combine two or more computation goals, and some algorithmic variants imply computation goals.29982999\subsection{Default choices and basic rules}30003001If several computation goals are set, all of them are pursued. In particular, computation goals in the input file and on the command line are accumulated. But3002\begin{itemize}3003\itemtt[-{}-ignore, -i] on the command line switches off the computation goals and algorithmic variants set in the input file.3004\end{itemize}30053006The default computation goal is set if neither the input file nor the command line contains a computation goal or an algorithmic variant that implies a computation goal. It is3007\begin{center}3008\verb|HilbertBasis| + \verb|HilbertSeries| + \verb|ClassGroup|.3009\end{center}30103011If set explicitly in the input file or on the command line the following adds these computation goals:3012\begin{itemize}3013\itemtt[DefaultMode]3014\end{itemize}30153016It is possible to set \verb|DefaultMode| explicitly in addition to other computation goals. If it is set, implicitly or explicitly, Normaliz will not complain about unreachable computation goals.30173018\subsection{The choice of algorithmic variants}30193020For its main computation goals Normaliz has algorithmic variants. It tries to choose the variant that seems best for the given input data. This automatic choice may however be a bad one. Therefore the user can completely control which algorithmic variant is used.30213022\subsubsection{Primal vs.\ dual}30233024For the computation of Hilbert bases Normaliz has two algorithms, the primal algorithm that is based on triangulations, and the dual algorithm that is of type ``pair completion''. We have seen both in Section \ref{Examples}. Roughly speaking, the primal algorithm is the first choice for generator input, and the dual algorithm is usually better for constraints input. The choice also applies to the computation of degree $1$ elements. However, for them the default choice is project-and-lift. See Section \ref{project}. The conditions under which the dual algorithm is chosen are specified in Section \ref{div_labor}.30253026The choice of the algorithm can be fixed or blocked:3027\begin{itemize}3028\itemtt[DualMode, -d] activates the dual algorithm for the computation of the Hilbert basis and degree $1$ elements. Includes \verb|HilbertBasis|, unless \verb|Deg1Elements| is set. It overrules \verb|IsIntegrallyClosed|.30293030\itemtt[PrimalMode, -P] blocks the use of the dual algorithm.3031\end{itemize}30323033The automatic choice can of course fail. See Section \ref{div_labor} for an example for which it is bad.30343035\subsubsection{Lattice points in polytopes}\label{approximate}30363037For this task Normaliz has several methods. They are discussed in Section \ref{LattPoints}. The default choice is the project-and-lift algorithm. It can be chosen explicitly:3038\begin{itemize}3039\itemtt[Projection, -j] ; it implies \verb|Deg1Elements|,30403041\itemtt[NoProjection] blocks it.3042\end{itemize}30433044Alternative choices are3045\begin{itemize}3046\itemtt[ProjectionFloat, -J], project-and-lift with floating point arithmetic,3047\itemtt[PrimalMode, -P], triangulation based method,3048\itemtt [Approximate, -r], approximation of rational polytopes followed by triangulation and3049\itemtt[DualMode, -d], dual algorithm.3050\end{itemize}3051\verb|PrimalMode| and \verb|DualMode| do not imply \verb|Deg1Elements| since they can also be used for Hilbert bases.3052\subsubsection{Bottom decomposition}30533054Bottom decomposition is a way to produce an optimal triangulation for a given set of generators. It is discussed in Section \ref{bottom_dec}. The criterion for its automatic choice is explained there. It can be forced or blocked:3055\begin{itemize}3056\itemtt[BottomDecomposition, -b] tells Normaliz to use bottom decomposition in the primal algorithm.30573058\itemtt[NoBottomDec, -o] forbids Normaliz to use bottom decomposition in the primal algorithm, even if it would otherwise be chosen because of large roughness (see Section \ref{bottom_dec}).3059\end{itemize}30603061An option to be mentioned in this context is3062\begin{itemize}3063\itemtt[KeepOrder, -k] forbids Normaliz to reorder the generators of the efficient cone $\CC$. Only useful if original monoid generators are defined. Also blocks \verb|BottomDecomposition|.3064\end{itemize}3065\verb|KeepOrder| is only allowed if \verb|OriginalMonoidGenerators| are defined.3066It is rarely a good idea to set \verb|KeepOrder| (try it). It is primarily used internally when data must be computed in an auxiliary cone.30673068\subsubsection{Symmetrization}30693070In rare cases Normaliz can use symmetrization in the computation of multiplicities or Hilbert series. If applicable, this is a very strong tool. We have mentioned it in Section \ref{Condorcet} and will discuss it in Section \ref{symmetrize}. It will be chosen automatically, but can also be forced or blocked:3071\begin{itemize}3072\itemtt[Symmetrize, -Y] lets Normaliz compute the multiplicity and/or the Hilbert series via symmetrization (or just compute the symmetrized cone).30733074\itemtt[NoSymmetrization] blocks symmetrization.3075\end{itemize}30763077\subsubsection{Subdivision of simplicial cones}30783079Normaliz tries to subdivide ''large'' simplicial cones; see Section \ref{subdiv}. If your executable is built with SCIP, you can set3080\begin{itemize}3081\itemtt[SCIP]3082\end{itemize}3083However, in general, Normaliz' own method is faster and more reliable.30843085Subdivision requires enlarging the set of generators and can lead to a nested triangulation (see Sections \ref{subdiv} and \ref{nested}). The subdivision can be blocked by3086\begin{itemize}3087\itemtt[NoSubdivision]3088\end{itemize}308930903091\subsection{Computation goals}\label{goals}30923093The computation goal \verb|Sublattice| does not imply any other computation goal. All other computation goals include \verb|Sublattice| and \verb|SupportHyperplanes|, apart from certain computation goals based on the dual algorithm or if \verb|Projection| or \verb|ProjectionFloat| is used for parallelotopes; see Section \ref{InhomDual}.30943095\subsubsection{Lattice data}30963097\begin{itemize}3098\itemtt[Sublattice, -S] (upper case S) asks Normaliz to compute the coordinate transformation to and from the efficient sublattice.3099\end{itemize}31003101\subsubsection{Support hyperplanes and extreme rays}31023103\begin{itemize}3104\itemtt[SupportHyperplanes, -s] triggers the computation of support hyperplanes and extreme rays.3105\end{itemize}31063107Normaliz tries to find a grading.31083109\begin{itemize}3110\itemtt[VerticesFloat] converts the format of vertices to floating point. It implies \texttt{SupportHyperplanes}.3111\end{itemize}31123113Note that \texttt{VerticesFloat} is not a pure output option. It is a computation goal, and therefore breaks \texttt{DefaultMode}.3114311531163117\subsubsection{Hilbert basis and related data}31183119\begin{itemize}31203121\itemtt[HilbertBasis, -N] triggers the computation of the Hilbert basis. In inhomogeneous computations it asks for the Hilbert basis of the recession monoid \emph{and} the module generators.31223123\itemtt[Deg1Elements, -1] restricts the computation to the degree $1$ elements of the Hilbert basis. Requires the presence of a grading. Forbidden in inhomogeneous computations.31243125\itemtt[ModuleGeneratorsOverOriginalMonoid, -M] computes a minimal system of generators of the integral closure over the original monoid (see Section \ref{MinMod}). Requires the existence of original monoid generators.3126\end{itemize}31273128The boolean valued computation goal \verb|IsIntegrallyClosed| is also related to the Hilbert basis; see Section \ref{bool}.31293130\subsubsection{Enumerative data}31313132The computation goals in this section require a grading. They include \verb|SupportHyperplanes|.31333134\begin{itemize}3135\itemtt [HilbertSeries,-q] triggers the computation of the Hilbert series.31363137\itemtt[Multiplicity, -v] restricts the computation to the multiplicity.31383139\itemtt[HSOP] lets Normaliz compute the degrees in a homogeneous system of parameters and the induced representation of the Hilbert series.3140\itemtt[NoPerodBound] This option removes the period bound that Normaliz sets for the computation of the Hilbert quasipolynomial (presently $10^6$).3141\end{itemize}31423143\subsubsection{Combined computation goals}31443145Can only be set by single letter command line options:31463147\begin{itemize}3148\itemtt[-n] \verb|HilbertBasis| + \verb|Multiplicity|31493150\itemtt[-h] \verb|HilbertBasis| + \verb|HilbertSeries|31513152\itemtt[-p] \verb|Deg1Elements| + \verb|HilbertSeries|31533154\end{itemize}31553156\subsubsection{The class group}31573158\begin{itemize}3159\itemtt [ClassGroup, -C] is self explanatory, includes \verb|SupportHyperplanes|. Not allowed in inhomogeneous computations.3160\end{itemize}31613162\subsubsection{Integer hull}31633164\begin{itemize}3165\itemtt [IntegerHull, -H] computes the integer hull of a polyhedron. Implies the computation of the lattice points in it.3166\end{itemize}31673168More precisely: in homogeneous computations it implies \verb|Deg1Elements|, in inhomogeneous computations it implies \verb|HilbertBasis|. See Section \ref{IntHull}.31693170\subsubsection{Triangulation and Stanley decomposition}31713172\begin{itemize}31733174\itemtt[Triangulation, -T] makes Normaliz compute, store and export the full triangulation.31753176\itemtt[ConeDecomposition, -D] Normaliz computes a disjoint decomposition of the cone into semiopen simplicial cones. Implies \verb|Triangulation|.31773178\itemtt[TriangulationSize, -t] makes Normaliz count the simplicial cones in the full triangulation.31793180\itemtt[TriangulationDetSum] makes Normaliz additionally sum the absolute values of their determinants.31813182\itemtt[StanleyDec, -y] makes Normaliz compute, store and export the Stanley decomposition. Only allowed in homogeneous computations.31833184\end{itemize}31853186The triangulation and the Stanley decomposition are treated3187separately since they can become very large and may exhaust3188memory if they must be stored for output.31893190\subsubsection{Weighted Ehrhart series and integrals}31913192\begin{itemize}31933194\itemtt[WeightedEhrhartSeries, -E] makes Normaliz compute a generalized Ehrhart series.31953196\itemtt[VirtualMultiplicity, -L] makes Normaliz compute the virtual multiplicity of a weighted Ehrhart series.31973198\itemtt[Integral, -I] makes Normaliz compute an integral.3199\end{itemize}32003201These computation goals require a homogeneous computation.32023203Don't confuse these options with symmetrization. The latter symmetrizes (if possible) the given data and uses \verb|-E| or \verb|-L| internally on the symmetrized object. The options \verb|-E,-I,L| ask for the input of a polynomial. See Section \ref{poly_input}.32043205\subsubsection{Boolean valued computation goals}\label{bool}32063207They tell Normaliz to find out the answers to the questions they ask. Two of them are more important than the others since they may influence the course of the computations:32083209\begin{itemize}3210\itemtt[IsIntegrallyClosed, -w]: is the original monoid integrally closed? Normaliz stops the Hilbert basis computation as soon as it can decide whether the original monoid contains the Hilbert basis (see Section \ref{IsIC}). If the answer is `no'', Normaliz computes a witness, an element of the integral closure that is not contained in the original monoid.32113212\itemtt[IsPointed]: is the efficient cone $\CC$ pointed? This computation goal is sometimes useful to give Normaliz a hint that a nonpointed cone is to be expected. See Section \ref{IsPointed}.3213\end{itemize}32143215For the following we only need the support hyperplanes and the lattice:32163217\begin{itemize}3218\itemtt[IsGorenstein, -G]: is the monoid of lattice points Gorenstein? In addition to answering this question, Normaliz also computes the generator of the interior of the monoid (the canonical module) if the monoid is Gorenstein.3219\end{itemize}32203221The remaining ones:32223223\begin{itemize}32243225\itemtt[IsDeg1ExtremeRays]: do the extreme rays have degree $1$?32263227\itemtt[IsDeg1HilbertBasis]: do the Hilbert basis elements have degree 1?32283229\itemtt[IsReesPrimary]: for the input type \verb|rees_algebra|, is the monomial ideal primary to the irrelevant maximal ideal?32303231\end{itemize}32323233The last three computation goals are not really useful for Normaliz since they will be answered automatically. Note that they may trigger extensive computations.32343235\subsection{Integer type}\label{Integer}32363237There is no need to worry about the integer type chosen by Normaliz. All preparatory computations use infinite precision. The main computation is then tried with $64$ bit integers. If it fails, it will be restarted with infinite precision.32383239Infinite precision does not mean that overflows are completely impossible. In fact, Normaliz requires numbers of type `degree'' fit the type \verb|long| (typically 64 bit on 64 bit systems). If an overflow occurs in the computation of such a number, it cannot be remedied.32403241The amount of computations done with infinite precision is usually very small, but the transformation of the computation results from 64 bit integers to infinite precision may take some time. If you need the highest possible speed, you can suppress infinite precision completely by3242\begin{itemize}3243\itemtt[LongLong]3244\end{itemize}3245With this option, Normaliz cannot restart a failed computation.32463247On the other hand, the $64$ bit attempt can be bypassed by3248\begin{itemize}3249\itemtt[BigInt, -B]3250\end{itemize}32513252Note that Normaliz tries to avoid overflows by intermediate results (even if \verb|LongLong| is set). If such overflow should happen, the computation is repeated locally with infinite precision. (The number of such GMP transitions is shown in the terminal output.) If a final result is too large, Normaliz must restart the computation globally.32533254\verb|LongLong| is not a cone property.32553256\subsection{Control of computations and communication with interfaces}32573258In addition to the computation goals in Section \ref{goals},3259the following elements of \verb|ConeProperties| control the work flow in \verb|libnormaliz| and can be used by programs calling Normaliz to ensure the availability of the data that are controlled by them.32603261\begin{itemize}32623263\itemtt[Generators] controls the generators of the efficient cone.32643265\itemtt[OriginalMonoidGenerators] controls the generators of the original monoid.32663267\itemtt[ModuleGenerators] controls the module generators in inhomogeneous computation.32683269\itemtt[ExtremeRays] controls the extreme rays.32703271\itemtt[VerticesOfPolyhedron] controls the vertices of the polyhedron in the inhomogeneous case.32723273\itemtt[MaximalSubspace] controls the maximal linear subspace of the (homogenized) cone.32743275\itemtt [EmbeddingDim] controls the embedding dimension.3276\itemtt [Rank] controls the rank.32773278\itemtt[RecessionRank] controls the rank of the recession monoid in inhomogeneous computations.32793280\itemtt[AffineDim] controls the affine dimension of the polyhedron in inhomogeneous computations.32813282\itemtt[ModuleRank] in inhomogeneous computations it controls the rank of the module of lattice points in the polyhedron as a module over the recession monoid.32833284\itemtt[ExcludedFaces] controls the excluded faces.32853286\itemtt[InclusionExclusionData] controls data derived from the excluded faces.32873288\itemtt[Grading] controls the grading.3289\itemtt[GradingDenom] controls its denominator.32903291\itemtt[Dehomogenization] controls the dehomogenization.32923293\itemtt[ReesPrimaryMultiplicity] controls the multiplicity of a monomial ideal, provided it is primary to the maximal ideal generated by the indeterminates. Used only with the input type \verb|rees_algebra|.32943295\itemtt [WitnessNotIntegrallyClosed] controls witness against integral closedness.3296\itemtt [GeneratorOfInterior] controls the generator of the interior if the monoid is Gorenstein.32973298\itemtt[Equations] controls the equations.3299\itemtt[Congruences] controls the congruences.3300\itemtt[ExternalIndex] controls the external index.3301\itemtt[InternalIndex] controls the internal index.3302\itemtt[UnitGroupIndex] controls the unit group index.330333043305\itemtt[IsInhomogeneous] controls the inhomogeneous case..33063307\itemtt[HilbertQuasiPolynomial] controls the Hilbert quasipolynomial.33083309\itemtt[WeightedEhrhartQuasiPolynomial] controls the weighted Ehrhart quasipolynomial.33103311\itemtt[IsTriangulationNested] controls the indicator of this property.3312\itemtt[IsTriangulationPartial] similar.33133314\end{itemize}33153316\subsection{Rational and integer solutions in the inhomogeneous case}\label{InhomDual}33173318The integer solutions of a homogeneous diophantine system generate the rational solutions as well: every rational solution has a multiple that is an integer solution. Therefore the rational solutions do not need an extra computation. If you prefer geometric language: a rational cone is generated by its lattice points.33193320This is no longer true in the inhomogeneous case where the computation of the rational solutions is an extra task for Normaliz. This extra step is inevitable for the primal algorithm, but not for the dual algorithm. In general, the computation of the rational solutions is much faster than the computation of the integral solutions, but this by no means always the case.33213322Therefore we have decoupled the two computations if the dual algorithm is applied to inhomogeneous systems or to the computation of degree $1$ points in the homogeneous case. The combinations3323\begin{itemize}3324\itemtt [DualMode HilbertBasis, -dN]33253326\itemtt [DualMode Deg1Elements, -d1]33273328\itemtt [DualMode ModuleGenerators]3329\end{itemize}3330do not imply the computation goal \verb|SupportHyperplanes| (and not even \verb|Sublattice|) which would trigger the computation of the rational solutions (geometrically: the vertices of the polyhedron). If you want to compute them, you must add one of3331\begin{itemize}3332\itemtt[SupportHyperplanes, -s]33333334\itemtt[ExtremeRays]33353336\itemtt[VerticesOfPolyhedron]3337\end{itemize}3338The last choice is only possible in the inhomogeneous case. Another possibility in the inhomogeneous case is is to use \verb|DualMode| without \verb|-N|.33393340If \verb|Projection| or \verb|ProjectionFloat| is used for parallelotopes defined by inequalities, then Normaliz does not compute the vertices, unless asked for by one of the three computation goals just mentioned.3341%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RUNNING %%%%%%%%%%%%%%%%%%%%%%%%%%%%%3342\section{Running Normaliz}\label{options}33433344The standard form for calling Normaliz is3345\begin{quote}3346\verb|normaliz [options]| <project>3347\end{quote}3348where \verb|<project>| is the name of the project, and the corresponding input file is \verb|<project>.in|. Note that \verb|normaliz| may require to be prefixed by a path name, and the same applies to \verb|<project>|. A typical example on a Linux or Mac system:3349\begin{quote}3350\verb|./normaliz --verbose -x=5 example/big|3351\end{quote}3352that for MS Windows must be converted to3353\begin{quote}3354\verb|.\normaliz --verbose -x=5 example\big|3355\end{quote}33563357Normaliz uses the standard conventions for calls from the command line:3358\begin{arab}3359\item the order of the arguments on the command line is arbitrary.3360\item Single letter options are prefixed by the character \verb|-| and can be grouped into one string.3361\item Verbatim options are prefixed by the characters \verb|--|.3362\end{arab}33633364The options for computation goals and algorithmic variants have been described in Section \ref{Goals}. In this section the remaining options for the control of execution and output are discussed, together with some basic rules for the use of the options.33653366\subsection{Basic rules}3367The options for computation goals and algorithms variants have been explained in Section \ref{Goals}. The options that control the execution and the amount of output will be explained in the following. Basic rules for the use of options:33683369\begin{enumerate}3370\item If no \ttt{<project>} is given, the3371program will terminate.33723373\item The option \ttt{-x} differs from the other ones: \ttt{<T>} in \verb|-x=<T>|3374represents a positive number assigned to \ttt{-x}; see3375Section \ref{exec}.33763377\item Similarly the option \ttt{---OutputDir=<outdir>} sets the output directory; see \ref{outcontrol}.33783379\item Normaliz will look for \ttt{<project>.in} as input3380file.33813382If you inadvertently typed \ttt{rafa2416.in} as the project3383name, then Normaliz will first look for \ttt{rafa2416.in.in}3384as the input file. If this file doesn't exist,3385\ttt{rafa2416.in} will be loaded.33863387\item The options can be given in arbitrary order. All options, including those in the input file, are accumulated, and syntactically there is no mutual exclusion. However, some options may block others during the computation. For example, \verb|KeepOrder| blocks \verb|BottomDecomposition|.33883389\item If Normaliz cannot perform a computation explicitly asked for by the3390user, it will terminate. Typically this happens if no grading is given although3391it is necessary.33923393\item In the options include \verb|DefaultMode|, Normaliz does not complain about missing data3394(anymore). It will simply omit those computations that are impossible.33953396\item If a certain type of computation is not asked for explicitly, but can3397painlessly be produced as a side effect, Normaliz will compute it. For3398example, as soon as a grading is present and the Hilbert basis is computed, the3399degree $1$ elements of the Hilbert basis are selected from it.34003401\end{enumerate}34023403\subsection{Info about Normaliz}34043405\begin{itemize}3406\itemtt [-{}-help, -?] displays a help screen listing the Normaliz options.34073408\itemtt [-{}-version] displays information about the Normaliz executable.3409\end{itemize}341034113412\subsection{Control of execution}\label{exec}34133414The options that control the execution are:34153416\begin{itemize}3417\itemtt[{-}{-}verbose, -c] activates the verbose (``console'') behavior of3418Normaliz in which Normaliz writes additional3419information about its current activities to the3420standard output.34213422\itemtt[-x=<T>] Here \ttt{<T>} stands for a positive3423integer limiting the number of threads that Normaliz3424is allowed access on your system. The default value is3425$8$. (Your operating system may set a lower limit).34263427\ttt{-x=0} switches off the limit set by Normaliz.34283429If you want to run3430Normaliz in a strictly serial mode, choose3431\ttt{-x=1}.3432\end{itemize}34333434The number of threads can also be controlled by the environment3435variable \verb+OMP_NUM_THREADS+. See Section \ref{PerfPar} for3436further discussion.34373438\subsection{Interruption}\label{interrupt}34393440During a computation \verb|normaliz| can be interrupted by pressing Ctrl-C on the keyboard. If this happens, Normaliz will stop the current computation and write the already computed data to the output file(s).34413442At present, the Normaliz interrupt control has no effect during SCIP computations.34433444If Crtl-C is pressed during the output phase, Normaliz is stopped immediately.34453446\subsection{Control of output files}\label{outcontrol}34473448In the default setting Normaliz writes only the output file3449\ttt{<project>.out} (and the files produced by \ttt{Triangulation} and \ttt{StanleyDec}). The3450amount of output files can be3451increased as follows:3452\begin{itemize}3453\itemtt[{-}{-}files, -f] Normaliz writes the additional output files3454with suffixes \ttt{gen}, \ttt{cst}, and \ttt{inv},3455provided the data of these files have been computed.3456\itemtt[{-}{-}all-files, -a] includes \ttt{Files}, Normaliz writes all3457available output files (except \verb|typ|, the triangulation or the3458Stanley decomposition, unless these have been requested).3459\itemtt [{-}{-}<suffix>] chooses the output file with suffix \verb|<suffix>|.3460\end{itemize}34613462For the list of potential output files, their suffixes and their interpretation3463see Section \ref{optionaloutput}. There may be several options \verb|--<suffix>|.34643465If the computation goal \verb|IntegerHull| is set, Normaliz computes a second cone and lattice. The output is contained in \verb|<project>.IntHull.out|. The options for the output of \verb|<project>| are applied to \verb|<project>.IntHull| as well. There is no way to control the output of the two computations individually.34663467Similarly, if symmetrization has been used, Normaliz writes the file \verb|<project>.symm.out|. It contains the data of the symmetrized cone.34683469Sometimes one wants the output to be written to another directory. The output directory can be set by3470\begin{itemize}3471\itemtt[{-}{-OutputDir=<outdir>}]. The path \ttt{<outdir<} is an absolute path or a path relative to the current directory (which is not necessarily the directory of \verb|<project>.in|.)3472\end{itemize}3473Note that all output files will be written to the chosen directory. It must be created before Normaliz is started.34743475Extreme rays and vertices may have very long integer coordinates. One can suppress their output by3476\begin{itemize}3477\itemtt[NoExtRaysOutput]3478\end{itemize}3479\verb|NoExtRaysOutput| is not cone properties.34803481\subsection{Overriding the options in the input file}34823483Since Normaliz accumulates options, one cannot get rid of settings in the input file by command line options unless one uses3484\begin{itemize}3485\itemtt[{-}{-}ignore, -i] This option disables all settings in the input file.3486\end{itemize}34873488348934903491%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EXAMPLES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%3492\section{More examples}\label{MoreExamples}34933494\subsection{Lattice points in polytopes once more}\label{LattPoints}34953496There are two ways to define polytopes for Normaliz:3497\begin{arab}3498\item by homogeneous input: a cone $C$ and a grading $\deg$ define the polytopes $P=C\cap \{x:\deg x=1 \}$,3499\item by inhomogeneous input: a bounded polyhedron $P$ is a polytope.3500\end{arab}3501As far as the computation of lattice points is concerned, there is essentially no difference in the algorithms that can be used.35023503However, there is a difference in the out file(s): for homogeneous input the lattice points in $P$ appear as ``degree $1$ elements of the Hilbert basis'' whereas they are the ``module generators'' in the inhomogeneous case.35043505Normaliz has three main algorithms for the computation of lattice points of which two have two variants each:3506\begin{arab}3507\item the project-and-lift algorithm (\verb|Projection, -j|),3508\item its variant using floating point arithmetic (\verb|ProjectionFloat, -J|),3509\item the triangulation based Normaliz primal algorithm specialized to lattice points (\verb|PrimalMode, -P|),3510\item its variant using approximation of rational polytopes (\verb|Approximate, -r|),3511\item the dual algorithm specialized to lattice points (\verb|DualMode, -d|).3512\end{arab}35133514The options \verb|Projection|, \verb|ProjectionFloat| and \verb|Approximate| imply the computation goals \verb|Deg1Points| (in the homogeneous case) and \verb|ModuleGenerators| (in the inhomogeneous case). Since \verb|PrimalMode| can also be used for the computation of Hilbert series and Hilbert bases, one must add the computation goal to it. In the homogeneous case one must add the computation goal also to \verb|DualMode|.35153516We recommend the reader to experiment with the following input files:3517\begin{itemize}3518\item \verb|5x5.in|3519\item \verb|6x6.in|3520\item \verb|max_polytope_cand.in|3521\item \verb|hickerson-18.in|3522\item \verb|knapsack_11_60.in|3523\item \verb|ChF_2_64.in|3524\item \verb|ChF_8_1024.in|3525\item \verb|ChF_16_1048576.in| (may take some time)3526\item \verb|pedro2.in|3527\end{itemize}35283529In certain cases you must use \verb|-i| on the command line to override the options in the input file.35303531\verb|max_polytope_cand.in| came up in connection with the paper ``Quantum jumps of normal polytopes'' by W. Bruns, J. Gubeladze and M. Micha\l{}ek, Discrete Comput.\ Geom.\ {56 (2016), no. 1, 181--215. The files \verb|ChF*.in| are taken from the paper `On the orthogonality of the Chebyshev-Frolov lattice and applications'' by Ch. Kacwin, J. Oettershagen and T. Ullrich (\url{arXiv:1606.00492}, Math. Monatshefte, to appear). \verb|hickerson-18.in| is taken from the LattE distribution \cite{LatInt}. \verb|pedro2.in| was suggested by P. Garcia-Sanchez.35323533\subsubsection{Project-and-lift}\label{project}35343535We have explained the project-and-lift algorithm in Section \ref{project_example}.3536This algorithm is very robust arithmetically since it needs not compute determinants or solve systems of linear equations. Moreover, the project-and-lift algorithm itself does not use the vertices of the polytope explicitly and only computes lattice points in $P$ and its successive projections. Therefore it is rather insensitive against rational vertices with large denominators. (To get started it must usually compute the vertices of the input polytope; an exception are parallelotopes, as mentioned in Section \ref{project_example}.)35373538The option for project-and-lift is3539\begin{itemize}3540\itemtt [Projection, -j]3541\end{itemize}35423543There are two complications that may slow it down unexpectedly: (i) the projections may have large numbers of support hyperplanes, as seen in the example \verb|ChF_16_1048576.in| (it uses floating point arithmetic in the lifting part):3544\begin{Verbatim}3545embdim 17 inequalities 323546embdim 16 inequalities 2403547embdim 15 inequalities 11203548...3549embdim 11 inequalities 228803550embdim 10 inequalities 257403551embdim 9 inequalities 228803552...3553embdim 3 inequalities 323554embdim 2 inequalities 23555\end{Verbatim}35563557(ii) The projections may have many lattice points that cannot be lifted to the top. As an example we look at the terminal output of \verb|pedro2.in|:3558\begin{Verbatim}3559embdim 2 Deg1Elements 333560embdim 3 Deg1Elements 4783561embdim 4 Deg1Elements 42013562embdim 5 Deg1Elements 174493563embdim 6 Deg1Elements 23564\end{Verbatim}35653566Despite of these potential problems, \verb|Projection| is the default choice of Normaliz for the computation of lattice points (if not combined with Hilbert series or Hilbert basis). If you do not want to use it, you must either choose another method explicitly or switch it off by \verb|NoProjection|.35673568\emph{Parallelotopes.}\enspace3569Lattice points in parallelotopes that are defined by inequalities, like those in the input files \verb|ChF*.in|, can be computed without any knowledge of the vertices. In fact, for them it is favorable to present a face $F$ by the list of facets whose intersection $F$ is (and not by the list of the $2^{\dim F}$ vertices of $F$!). Parallelotopes are not only simple polytopes. It is important that two faces do not intersect if and only if they are contained in parallel facets, and this is easy to control.35703571Normaliz recognizes parallelotopes by itself, and suppresses the computation of the vertices unless asked to compute them.35723573\emph{Remark.}\enspace3574The triangulation based primal algorithm and the dual algorithm do not depend on the embedding of the computed objects into the ambient space since they use only data that are invariant under coordinate transformations. This is not true for project-and-lift and the approximation discussed below.35753576\subsubsection{Project-and-lift with floating point arithmetic}35773578Especially the input of floating point numbers often forces Normaliz into GMP arithmetic. Since GMP arithmetic is slow (compared to arithmetic with machine integers), Normaliz has a floating point variant of the project-and-lift algorithm. (Such an algorithm makes no sense for Hilbert bases or Hilbert series.) It behaves very well, even in computations for lower dimensional polytopes. We have not found a single deviation from the results with GMP arithmetic in our examples.35793580The option for the floating point variant of project-and-lift is3581\begin{itemize}3582\itemtt [ProjectionFloat, -J]3583\end{itemize}3584If you want a clear demonstration of the difference between \verb|Projection| and \verb|ProjectionFloat|, try \verb|ChF_16_1048576.in|.35853586The use of \verb|ProjectionFloat| or any other algorithmic variant is independent of the input type.3587\subsubsection{The triangulation based primal algorithm}35883589With this algorithm, Normaliz computes a triangulation as it does for the computation of Hilbert bases (in primal mode) for the cone over the polytope. Then it computes the lattice points in each of the subpolytopes defined by the simplicial subcones in the triangulation. The difference to the Hilbert basis calculation is that all points that do not lie in our polytope $P$ can be discarded right away and that no reduction is necessary.35903591The complications that can arise are (i) a large triangulation or (ii) large determinants of the simplicial cones. Normaliz tries to keep the triangulations small by restricting itself to a partial triangulation, but often there is nothing one can do. Normaliz deals with large determinants by applying project-and-lift to the simplicial subcones with large determinants. We can see this by looking at the terminal output of \verb|max_polytope_cand.in|, computed with \verb|-cP|:3592\begin{Verbatim}3593...3594evaluating 49 simplices3595||||||||||||||||||||||||||||||||||||||||||||||||||359649 simplices, 819 deg1 vectors accumulated.359747 large simplices stored3598Evaluating 47 large simplices3599Large simplex 1 / 473600************************************************************3601starting primal algorithm (only support hyperplanes) ...3602Generators sorted lexicographically3603Start simplex 1 2 3 4 53604Pointed since graded3605Select extreme rays via comparison ... done.3606------------------------------------------------------------3607transforming data... done.3608Computing lattice points by project-and-lift3609Projection3610embdim 5 inequalities 53611...3612embdim 2 inequalities 23613Lifting3614embdim 2 Deg1Elements 643615...3616embdim 5 Deg1Elements 322683617Project-and-lift complete3618...3619\end{Verbatim}3620After finishing the $49$ ``small'' simplicial cones, Normaliz takes on the $49$ ``large'' simplicial cones, and does them by project-and-lift. Therefore one can say that Normaliz takes a hybrid approach if you request primal mode.36213622An inherent weakness of the triangulation based algorithm is that its efficiency drops with $d!$ where $d$ is the dimension because the proportion of lattice points in $P$ of all points generated by the algorithm must be expected to be $1/d!$ (as long as small simplicial cones are evaluated). To some extent this is compensated by the extremely dast generation of the candidates.36233624\subsubsection{Lattice points by approximation}\label{approx}36253626Large determinants come up easily for rational polytopes whose vertices have large denominators. In previous versions, Normaliz fought against large determinants caused by rational vertices ny finding an integral polytope $Q$ containing $P$, computing the lattice points in $Q$ and then sieving out those that are in $Q\setminus P$:3627\begin{center}3628\begin{tikzpicture}[scale=0.6]3629\filldraw[fill=orange] (0,0) -- (0,1) -- (1,3) -- (2,4) -- (3,4) -- (4,1) -- (3,0) --cycle;3630\filldraw[fill=yellow] (0.3,0.6) -- (3.4,0.8) -- (2.3,3.8) --(1.2,2.7) -- cycle;3631\foreach \x in {0,...,4}3632\foreach \y in {0,...,4}3633{3634\filldraw[fill=black] (\x,\y) circle (1.5pt);3635}3636% \draw (1,0) -- (0,1) -- (2,2) --cycle;3637\end{tikzpicture}3638\end{center}36393640This approach is still possible. It is requested by the option3641\begin{itemize}3642\itemtt [Approximate, -r]3643\end{itemize}36443645This is often a good choice, especially in low dimension.36463647It is not advisable to use approximation for polytopes with a large number of vertices since it must be expected that the approximation multiplies the number of vertices by $\dim P+1$ so that it may become difficult to compute the triangulation.36483649\subsubsection{Lattice points by the dual algorithm}36503651Often the dual algorithm is extremely fast. But it can also degenerate terribly. It is very fast for \verb|6x6.in| run with \verb|-d1|. The primal algorithm or approximation fail miserably. (\verb|-1|, the default choice project-and-lift, is also quite good. The difference is that \verb|-d1| does not compute the vertices that in this case are necessary for the preparation of project-and-lift.)36523653On the other hand, the dual algorithm is hopeless already for the $2$-dimensional parallelotope \verb|ChF_2_64.in|. Try it. It is clear that the complicated arithmetic is is forbidding for the dual algorithm. (The dual algorithm successively computes the lattice points correctly for all intermediate polyhedra, defined as intersections of the half spaces that have been processed so far. The intermediate polyhedra can be much more difficult than the final polytope, as in this case.)36543655In certain cases (see Section \ref{div_labor}) Normaliz will try the dual algorithm if you forbid project-and-lift by \verb|NoProjection|.36563657\subsection{The bottom decomposition}\label{bottom_dec}36583659The triangulation size and the determinant sum of the triangulation are critical size parameters in Normaliz computations. Normaliz always tries to order the generators in such a way that the determinant sum is close to the minimum, and on the whole this works out well. The use of the bottom decomposition by \verb|BottomDecomposition, -b| enables Normaliz to compute a triangulation with the optimal determinant sum for the given set of generators, as we will explain in the following.36603661The determinant sum is independent of the order of the generators of the cone $C$ if they lie in a hyperplane $H$. Then the determinant sum is exactly the normalized volume of the polytope spanned by $0$ and $C\cap H$. The triangulation itself depends on the order, but the determinant sum is constant.3662\begin{center}3663\begin{tikzpicture}[scale=0.4]3664\filldraw[gray!20] (-3.5,5.833) -- (0,0) -- (6,4) -- (6,5.833) -- cycle;3665\filldraw[yellow] (0,0) -- (-3,5) -- (3,2) -- cycle;3666\draw (-3.5,5.833) -- (0,0) -- (6,4);3667\foreach \x in {-4,...,5}3668\foreach \y in {0,...,5}3669{3670\filldraw[fill=black] (\x,\y) circle (1.5pt);3671}3672\draw (-4,5.5) --(4,1.5) node at (4.5,1.3){\tiny $H$};36733674\draw (-3,5) circle (4pt) node at (3.5,4.5){\tiny $C$};3675\draw (1,3) circle (4pt);3676\draw (3,2) circle (4pt);3677\end{tikzpicture}3678\end{center}36793680This observation helps to find a triangulation with minimal determinant sum in the general case.3681We look at the \emph{bottom} (the union of the compact faces) of the polyhedron generated by $x_1,\dots,x_n$ as vertices and $C$ as recession cone, and take the volume underneath the bottom:3682\begin{center}3683\begin{tikzpicture}[scale=0.4]3684\filldraw[gray!20] (-3.5,5.833) -- (0,0) -- (6,4) -- (6,5.833) -- cycle;3685\filldraw[yellow] (0,0) -- (-3,5) -- (-1,3) -- (1,2) -- (3,2) -- cycle;36863687\draw (-3,5) -- (-1,3) -- (1,2) -- (3,2);36883689\draw (-3.5,5.833) -- (0,0) -- (6,4);3690\foreach \x in {-4,...,5}3691\foreach \y in {0,...,5}3692{3693\filldraw[fill=black] (\x,\y) circle (1.5pt);3694}36953696\draw (-3,5) circle (4pt) node at (3.5,4.5){\tiny $C$};3697\draw (-1,3) circle (4pt);3698\draw (1,3) circle (4pt);3699\draw (3,2) circle (4pt);3700\draw (1,2) circle (4pt);3701\end{tikzpicture}3702\end{center}3703With the option \texttt{BottomDecomposition}, \texttt{-b}, Normaliz computes a triangulation that respects the bottom facets. This yields the optimal determinant sum for the given generators. If one can compute the Hilbert basis by the dual algorithm, it can be used as input, and then one obtains the absolute bottom of the cone, namely the compact facets of the convex hull of all nonzero lattice points.37043705Normaliz does not always use the bottom decomposition by default since its computation requires some time and administrative overhead. However, as soon as the input ``profile'' is considered to be ``rough'' it is invoked. The measure of roughness is the ratio between the maximum degree (or $L_1$ norm without a grading) and the minimum. A ratio $\ge 10$ activates the bottom decomposition.37063707If you have the impression that the bottom decomposition slows down your computation, you can suppress it by \texttt{NoBottomDec}, \texttt{-o}.37083709The bottom decomposition is part of the subdivision of large simplicial cones discussed in the next section.37103711The example \verb|StrictBorda.in| belongs to social choice theory like \verb|Condorcet.in| (see Section \ref{Condorcet}), \verb|PluralityVsCutoff.in| and \verb|CondEffPlur.in|. The last two profit enormously from symmetrization (see Section \ref{symmetrize}), but \verb|StrictBorda.in| does not. Therefore we must compute the Hilbert series (or at least the multiplicity) for a monoid in dimension $24$ whose cone has $6363$ extreme rays. It demonstrates the substantial gain that can be reached by bottom decomposition. Since the roughness is large enough, Normaliz chooses bottom decomposition automatically, unless we block it.3712\begin{center}3713\begin{tabular}{|c|r|r|}\hline3714algorithm & triangulation size& determinant sum \\ \hline3715bottom decomposition& 30,399,162,846 &75,933,588,203 \\ \hline3716standard order of extreme rays, \ttt{-o} & 119,787,935,829 & 401,249,361,966\\ \hline3717\end{tabular}3718\end{center}37193720\subsection{Subdivision of large simplicial cones}\label{subdiv}37213722Especially in computations with rational polytopes one encounters very large determinants that can keep the Normaliz primal algorithm from terminating in reasonable time. As an example we take \verb|hickerson-18.in| from the LattE distribution \cite{LatInt}. It is simplicial and the complexity is totally determined by the large determinant $\approx 4.17\times 10^{14}$ (computed with \verb|-v|).37233724If we are just interested in the degree $1$ points, Normaliz uses the project-and-lift method of Section \ref{project} and finds $44$ degree $1$ points in the blink of an eye. If we use these points together with the extreme rays of the simplicial cone, then the determinant sum decreases to $\approx 1.3\times 10^{12}$, and the computation of the Hilbert basis and the Hilbert series is in reach. But it is better to pursue the idea of subdividing large simplicial cones systematically. Normaliz employs two methods:3725\begin{arab}3726\item computation of subdivision points by the IP solver SCIP,3727\item its own algorithm for finding optimal subdivision points, based on project-and-lift.3728\end{arab}37293730Normaliz tries to subdivide a simplicial cone if it has determinant $\ge 10^8$ or $10^7$ if the Hilbert basis is computed. Both methods are used recursively via stellar subdivision until simplicial cones with determinant $< 10^6$ have been reached or no further improvement is possible. All subdivision points are then collected, and the start simplicial cone is subdivided with bottom decomposition, which in general leads to substantial further improvement.37313732The use of SCIP requires a Normaliz executable built with SCIP see Section \ref{Compile}). Moreover, the option \verb|SCIP| must be set since in many cases the Normaliz method is faster and always finds a subdivision point if such exists.37333734The following table contains some performance data for subdivisions based on the Normaliz method (default mode, parallelization with 8 threads).3735\begin{center}3736\setlength{\tabcolsep}{3.2pt}3737\renewcommand{\arraystretch}{1.2}3738\begin{tabular}{|c|c|c|c|}3739\hline3740& \ttt{hickerson-16} & \ttt{hickerson-18} & \ttt{knapsack\_11\_60} \\ \hline3741simplex volume & $9.83\times 10^7$ & $4.17\times 10^{14}$ & $2.8\times 10^{14}$ \\ \hline3742stellar determinant sum & $3.93\times 10^6$ & $9.07\times 10^8$ & $1.15\times 10^8$\\ \hline3743volume under bottom & $8.10\times 10^5$ & $3.86\times 10^7$ & $2.02\times 10^7$ \\ \hline3744volume used & $3.93\times 10^6$ & $6.56\times 10^7$ & $2.61\times 10^7$ \\ \hline3745%improvement factor & 25 & $7.62\times10^6$ & $1.17\times 10^7$\\ \hline3746runtime without subdivision & 2.8 s & >12 d & >8 d \\ \hline3747runtime with subdivision & 0.4 s & 24 s & 5.1 s \\ \hline3748\end{tabular}3749\end{center}37503751A good nonsimplicial example showing the subdivision at work is \verb|hickerson-18plus1.in| with option \verb|-q|.37523753Note: After subdivision the decomposition of the cone may no longer be a triangulation in the strict sense, but a decomposition that we call a \emph{nested triangulation}; see \ref{nested}. If the creation of a nested triangulation must be blocked, one uses the option \verb|NoSubdivision|. Inevitably it blocks the subdivision of large simplicial cones.37543755\emph{Remark}\enspace The bounds mentioned above work well up to dimension $\approx 10$. For a fixed determinant, the probability for finding a subdivision point decreases rapidly.37563757\subsection{Primal vs. dual -- division of labor}\label{div_labor}37583759%\subsection{Normaliz tries to be smart}\label{smart}37603761As already mentioned several times, Normaliz has two main algorithms for the computation of Hilbert bases and degree $1$ points, the primal algorithm and the dual algorithm. It is in general very hard to decide beforehand which of the two is better for a specific example. Nevertheless Normaliz ties to guess, unless \verb|PrimalMode|, \verb|-P| or \verb|DualMode|, \verb|-d| is explicitly chosen by the user. In first approximation one can day that the dual algorithm is chosen if the computation is based on constraints and the number of inequalities is neither too small nor too large. Normaliz chooses the dual algorithm if at the start of the Hilbert basis computation the cone is defined by $s$ inequalities such that3762$$3763r+\frac{50}{r} \le s \le 2e3764$$3765where $r$ is the rank of the monoid to be computed and $e$ is the dimension of the space in which the data are embedded. These conditions ate typically fulfilled for diophantine systems of equations whose nonnegative solutions are asked for.3766In the case of very few or many hyperplanes Normaliz prefers the primal algorithm. While this combinatorial condition is the only criterion for Normaliz, it depends also on the arithmetic of the example what algorithm is better. At present Normaliz makes no attempt to measure it in some way.37673768When both Hilbert basis and Hilbert series are to be computed, the best solution can be the combination of both algorithms. We recommend \verb|2equations.in| as a demonstration example which combines the algorithmic variant \verb|DualMode| and the computation goal \verb|HilbertSeries|:3769\begin{Verbatim}3770amb_space 93771equations 237721 6 -7 -18 25 -36 6 8 -937737 -13 15 6 -9 -8 11 12 -23774total_degree3775DualMode3776HilbertSeries3777\end{Verbatim}3778As you will see, the subdivision of large simplicial cones is very useful for such computations.37793780Compare \verb|2equations.in| and \verb|2equations_default.in| for an impression on the relation between the algorithms.37813782\subsection{Checking the Gorenstein property}\label{Gorenstein}37833784If the Hilbert series has been computed, one can immediately see whether the monoid computed by Normaliz is Gorenstein: this is the case if and only if the numerator is a symmetric polynomial, and Normaliz indicates that (see Section \ref{job_dual}). However, there is a much more efficient way to check the Gorenstein property, which does not even require the existence of a grading: we must test whether the \emph{dual} cone has degree $1$ extreme rays. This amounts to checking the existence of an implicit grading on the dual cone.37853786This very efficient Gorenstein test is activated by the option \ttt{IsGorenstein}, equivalently \ttt{-G} on the command line. We take \verb|5x5Gorenstein.in|:37873788\begin{Verbatim}3789amb_space 253790equations 1137911 1 1 1 1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 03792...37931 1 1 1 0 0 0 0 -1 0 0 0 -1 0 0 0 -1 0 0 0 -1 0 0 0 03794IsGorenstein3795\end{Verbatim}37963797In the output we see3798\begin{Verbatim}3799Monoid is Gorenstein3800Generator of interior38011 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 13802\end{Verbatim}38033804In fact, the Gorenstein property is (also) equivalent to the fact that the interior of our monoid is generated by a single element as an ideal, and this generator is computed if the monoid is Gorenstein. (It defines the grading under which the extreme rays of the dual cone have degree~$1$.)38053806If the monoid is not Gorenstein, Normaliz will print the corresponding message.38073808\subsection{Symmetrization}\label{symmetrize}38093810Under certain conditions one can count lattice points in a cone $C$ by mapping $C$ to a cone $C'$ of lower dimension and then counting each lattice point $y$ in $C'$ with the number of its lattice preimages. This approach works well if the number of preimages is given by a polynomial in the coordinates of $y$. Since $C'$ has lower dimension, one can hope that its combinatorial structure is much simpler that that of $C$. One must of course pay a price: instead of counting each lattice point with the weight $1$, one must count it with a polynomial weight. This amounts to a computation of a weighted Ehrhart series that we will discuss in Section \ref{Poly_comp}. Similarly multiplicity can be computed as the virtual multiplicity of a polynomial after projection.38113812The availability of this approach depends on symmetries in the coordinates of $C$, and therefore we call it \emph{symmetrization}. Normaliz tries symmetrization under the following condition: $C$ is given by constraints (inequalities, equations, congruences, excluded faces) and the inequalities contain the sign conditions $x_i\ge 0$ for all coordinates $x_i$ of $C$. (Coordinate hyperplanes may be among the excluded faces.) Then Normaliz groups coordinates that appear in all constraints and the grading (!) with the same coefficients, and, roughly speaking, replaces them by their sum. The number of preimages that one must count for the vector $y$ of sums is then a product of binomial coefficients -- a polynomial as desired. More precisely, if $y_j$, $j=1,\dots,m$, is the sum of $u_j$ variables $x_i$ then3813$$3814f(y)=\binom{u_1+y_1-1}{u_1-1}\cdots \binom{u_m+y_m-1}{u_m-1}.3815$$3816is the number of preimages of $(y_1,\dots,y_m)$. This approach to Hilbert series has been suggested by A. Sch�rmann \cite{Sch}.38173818As an example we look again at the input for the Condorcet paradox:3819\begin{Verbatim}3820amb_space 243821inequalities 338221 1 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 1 -138231 1 1 1 1 1 1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -138241 1 1 1 1 1 1 1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -13825nonnegative3826total_degree3827Multiplicity3828\end{Verbatim}3829The grading is completely symmetric, and it is immediately clear that the input is symmetric in the first $6$ coordinates. But also the column of three entries $-1$ appears $6$ times, and there are $6$ more groups of $2$ coordinates each (one group for each $\pm1$ pattern). With the suitable labeling, the number of preimages of$(y_1,\dots,y_8$) is given by3830$$3831f(y)=\binom{y_1+5}{5}(y_2+1)(y_3+1)(y_4+1)(y_5+1)(y_6+1)(y_7+1)\binom{y_8+5}{5}.3832$$3833Normaliz finds the groups of variables that appear with the same sign pattern, creates the data for the weighted Ehrhart series, and interprets it as the Hilbert series of the monoid defined by the input data.38343835However, there is a restriction. Since the polynomial arithmetic has its own complexity and Normaliz must do it in GMP integers, it makes no sense to apply symmetrization if the dimension does not drop by a reasonable amount. Therefore we require that3836$$3837\dim C' \le \frac{2}{3}\dim C).3838$$3839If called with the options \verb|-q| or \verb|-v| Normaliz will try symmetrization. If the inequality for $\dim C'$ is not satisfied, it will simply compute the Hilbert series or the multiplicity without symmetrization. (In default mode it of course tries symmetrization for the Hilbert series.)38403841Whenever Normaliz has used symmetrization, it writes the file \verb|<project>.symm.out| that contains the data of the symmetrized object. In it you find the multiplicity of \verb|<project>.out| as virtual multiplicity and the Hilbert series as weighted Ehrhart series.38423843If you use the option \verb|Symmetrize|, then the behavior depends on the other options:3844\begin{arab}3845\item If neither the \verb|HilbertSeries| nor \verb|Multiplicity| is to be computed, Normaliz writes only the output file \verb|<project>.symm.out| computed with \verb|SupportHyperplanes|.3846\item If one of these goals is to be computed, Normaliz will do the symmetrization, regardless of the dimension inequality above (and often this makes sense).3847\end{arab}3848By doing step (1) first, the user gets useful information of what to expect by symmetrization. In a second run, one can add \verb|HilbertSeries| or \verb|Multiplicity| if (1) was satisfactory.38493850The Condorcet example is too small in order to demonstrate the power of symmetrization. A suitable example is \verb|PluralityVsCutoff.in|:3851\begin{Verbatim}3852winfried@ubuntu:~/Dropbox/git_normaliz/source$ time ./normaliz -c ../example/PluralityVsCutoff3853\.....|3854Normaliz 3.3.0 \....|3855\...|3856(C) The Normaliz Team, University of Osnabrueck \..|3857March 2017 \.|3858\|3859************************************************************3860Command line: -c ../example/PluralityVsCutoff3861Compute: DefaultMode3862Embedding dimension of symmetrized cone = 63863...3864------------------------------------------------------------3865transforming data... done.38663867real 0m2.655s3868user 0m5.328s3869sys 0m0.080s3870\end{Verbatim}3871The Hilbert series is computable without symmetrization, but you better make sure that there is no power failure for the next week if you try that. (The time above includes the Hilbert basis computed automatically in dual mode).38723873Another good example included in the distribution is \verb|CondEffPlur.in|, but it takes some hours with symmetrization (instead of days without). For it, the dimension drops only from $24$ to $13$.38743875Symmetrization is a special type of computations with a polynomial weight, and therefore requires Normaliz to be built with CoCoALib.38763877\subsection{Computations with a polynomial weight}\label{Poly_comp}38783879For a graded monoid $M$, which arises as the intersection $M=C\cap L$ of a rational cone$C$ and a lattice $L$, Normaliz computes the volume of3880the rational polytope3881$$3882P=\{x\in \RR_+ M: \deg x=1\},3883$$3884called the multiplicity of $M$ (for the given grading), the Hilbert series of $M$, and the quasipolynomial representing the Hilbert function. This Hilbert series of $M$ is also called the Ehrhart series of $P$ (with respect to $L$), and for the generalization introduced in this section we speak of Ehrhart series and functions.38853886The computations of these data can be understood as integrals of the3887constant polynomial $f=1$, namely with respect to the counting3888measure defined by $L$ for the Ehrhart function, and with3889respect to the (suitably normed) Lebesgue measure for the3890volume. Normaliz generalizes these computations to3891arbitrary polynomials $f$ in $n$ variables with rational3892coefficients. (Mathematically, there is no need to restrict3893oneself to rational coefficients for $f$.)38943895More precisely, set3896$$3897E(f,k)=\sum_{x\in M, \deg x=k} f(x),3898$$3899and call $E(f,\_)$ the \emph{weighted Ehrhart function} for3900$f$. (With $f=1$ we simply count lattice points.) The3901\emph{weighted Ehrhart series} is the ordinary generating3902function3903$$3904E_f(t)=\sum_{k=0}^\infty E(f,k)t^k.3905$$3906It turns out that $E_f(t)$ is the power series expansion of a3907rational function at the origin, and can always be written in3908the form3909$$3910E_f(t)=\frac{Q(t)}{(1-t^\ell)^{\totdeg f+\rank M}},\qquad Q(t)\in\QQ[t],\3911\deg Q< \totdeg f+\rank M.3912$$3913Here $\totdeg f$ is the total degree of the polynomial $f$, and3914$\ell$ is the least common multiple of the degrees of the3915extreme integral generators of $M$. See \cite{BS} for an3916elementary account, references and the algorithm used by Normaliz.39173918At present, weighted Ehrhart series can only be computed with homogeneous data. Note that \verb|excluded_faces| is a homogeneous input type. For them the monoid $M$ is replaced by the set3919$$3920M'=C'\cap L3921$$3922where $C'=C\setminus \mathcal F$ and $\mathcal F$ is the union of a set of3923faces3924(not necessarily facets) of $C$. What has been said above about the structure3925of the weighted Ehrhart series remains true. We discuss an example below.39263927It follows from the general theory of rational generating3928functions that there exists a quasipolynomial $q(k)$ with3929rational coefficients and of degree $\le \totdeg f+\rank M-1$ that3930evaluates to $E(f,k)$ for all $k\ge 0$.39313932Let $m=\totdeg f$ (we use this notation to distinguish the degree of the polynomial from the degree of lattice points) and $f_m$ be the degree $m$ homogeneous3933component of $f$. By letting $k$ go to infinity and3934approximating $f_m$ by a step function that is constant on the3935meshes of $\frac 1kL$ (with respect to a fixed basis), one sees3936$$3937q^{(j)}_{\totdeg f+\rank M-1}=\int_P f_m\, d\lambda3938$$3939where $d\lambda$ is the Lebesgue measure that takes value $1$3940on a basic mesh of $L\cap \RR M$ in the hyperplane of degree3941$1$ elements in $\RR M$. In particular, the \emph{virtual3942leading coefficient} $q^{(j)}_{\totdeg f+\rank M-1}$ is3943constant and depends only on $f_m$. If the integral vanishes,3944the quasipolynomial $q$ has smaller degree, and the true3945leading coefficient need not be constant. Following the3946terminology of commutative algebra and algebraic geometry, we3947call3948$$3949(\totdeg f+\rank M-1)!\cdot q_{\totdeg f+\rank M-1}3950$$3951the \emph{virtual multiplicity} of $M$ and $f$. It is an3952integer if $f_m$ has integral coefficients and $P$ is a lattice3953polytope.39543955The input format of polynomials has been discussed in Section \ref{poly_input}.39563957The terminal output contains a factorization of the polynomial as well as some computation results. From the terminal output you may also recognize that Normaliz first computes the triangulation and the Stanley decomposition and then applies the algorithms for integrals and weighted Ehrhart series.39583959\emph{Remarks} \enspace (1) Large computations with many parallel threads may require much memory due to the fact that very long polynomials must be stored. Another reason for large memory usage can be the precomputed triangulation or Stanley decomposition.39603961(2) You should think about the option \verb|BottomDecomposition|. It will be applied to the symmetrized input. (Under suitable conditions it is applied automatically.)396239633964\subsubsection{A weighted Ehrhart series}39653966We discuss the Condorcet paradox again (and the last time), now starting from the symmetrized form. The file \ttt{Condorcet.symm.in} from the directory3967\ttt{example} contains the following:39683969\begin{Verbatim}3970amb_space 83971inequalities 339721 -1 1 1 1 -1 -1 -139731 1 -1 1 -1 1 -1 -139741 1 1 -1 -1 -1 1 -13975nonnegative3976total_degree3977polynomial39781/120*1/120*(x[1]+5)*(x[1]+4)*(x[1]+3)*(x[1]+2)*(x[1]+1)*(x[2]+1)*3979(x[3]+1)*(x[4]+1)*(x[5]+1)*(x[6]+1)*(x[7]+1)*(x[8]+5)*(x[8]+4)*3980(x[8]+3)*(x[8]+2)*(x[8]+1);3981\end{Verbatim}3982We have seen this polynomial in Section \ref{symmetrize} above.398339843985From the Normaliz directory we start the computation by3986\begin{Verbatim}3987./normaliz -cE example/Condorcet.symm3988\end{Verbatim}3989We could have used \verb|--WeightedEhrhartSeries| instead of \verb|-E| or put \verb|WeightedEhrhartSeries| into the input file.39903991The file \ttt{Condorcet.symm.out} we find the information on the weighted Ehrhart series:39923993\begin{Verbatim}3994Weighted Ehrhart series:39951 5 133 363 ... 481 15 63996Common denominator of coefficients: 13997Series denominator with 24 factors:39981: 1 2: 14 4: 939994000degree of weighted Ehrhart series as rational function = -2540014002Weighted Ehrhart series with cyclotomic denominator:4003...4004\end{Verbatim}4005The only piece of data that we haven't seen already is the common denominator of coefficients. But since the polynomial has rational coefficients, we cannot any longer expect that the polynomial in the numerator of the series has integral coefficients. We list them as integers, but must then divide them by the denominator (which is$1$ in thus case since the weighted Ehrhart series is a Hilbert series in disguise). As usual, the representation with a denominator of cyclotomic polynomials follows.40064007And we have the quasipolynomial as usual:40084009\begin{Verbatim}4010Weighted Ehrhart quasi-polynomial of period 4:40110: 6939597901822221635907747840000 20899225...000000 ... 5626265640121: 2034750310223351797008092160000 7092764...648000 ... 5626265640132: 6933081849299152199775682560000 20892455...168000 ... 5626265640143: 2034750310223351797008092160000 7092764...648000 ... 562626564015with common denominator: 69395979018222216359077478400004016\end{Verbatim}40174018The left most column indicates the residue class modulo the period, and the4019numbers in line $k$ are the coefficients of the $k$-th polynomial after4020division by the common denominator. The list starts with $q_0^{(k)}$ and ends4021with (the constant) $q_{23}^{(k)}$.4022The interpretation of the remaining data is obvious:40234024\begin{Verbatim}4025Degree of (quasi)polynomial: 2340264027Expected degree: 2340284029Virtual multiplicity: 1717/81924030\end{Verbatim}403140324033\subsubsection{Virtual multiplicity}40344035Instead of the option \verb|-E| (or (\verb|--WeightedEhrhartSeries|) we use \verb|-L| or (\verb|--VirtualMultiplicity|). Then we can extract the virtual multiplicity from the output file.40364037\subsubsection{An integral}4038In their paper \emph{Multiplicities of classical varieties} (Proc. Lond. Math. Soc. (3) 110 (2015), 1033--105) J. Jeffries, J. Monta�o and M. Varbaro ask4039for the computation of the integral4040$$4041\int\limits_{\substack{[0,1]^m \\ \sum{x}= t}}(x_1\cdots x_{m})^{n-m}\prod_{1\le i<j \le m}(x_j-x_i)^2 \mathrm d{\mu}\4042$$4043taken over the intersection of the unit cube in $\RR^m$ and the hyperplane of constant coordinate sum $t$. It is supposed that $t\le m \le n$. We compute the integral for $t=2$, $m=4$ and $n=6$.40444045The polytope is specified in the input file \ttt{j462.in} (partially typeset in 24046columns):40474048\begin{Verbatim}4049amb_space 5 -1 0 0 0 14050inequalities 8 0 -1 0 0 140511 0 0 0 0 0 0 -1 0 140520 1 0 0 0 0 0 0 -1 140530 0 1 0 0 equations 140540 0 0 1 0 -1 -1 -1 -1 24055grading4056unit_vector 54057polynomial4058(x[1]*x[2]*x[3]*x[4])^2*(x[1]-x[2])^2*(x[1]-x[3])^2*4059(x[1]-x[4])^2*(x[2]-x[3])^2*(x[2]-x[4])^2*(x[3]-x[4])^2;4060\end{Verbatim}40614062The $8$ inequalities describe the unit cube in $\RR^4$ by the inequalities $0\le z_i\le 1$4063and the equation gives the hyperplane $z_1+\dots+z_4=2$ (we must use homogenized coordinates!). (Normaliz would find the grading itself.)40644065From the Normaliz directory the computation is called by40664067\begin{Verbatim}4068./normaliz -cI example/j4624069\end{Verbatim}4070where \verb|-I| could be replaced by \verb|--Integral|.40714072It produces the output in \ttt{j462.out} containing40734074\begin{Verbatim}4075Integral: 27773/295151867010004076\end{Verbatim}40774078\subsubsection{Restrictions in MS Windows}40794080We have not succeeded in compiling Normaliz with CoCoALib under MS Windows. in previous versions of Normaliz, the computations with polynomial weights were done by the separate program NmzIntegrate, and NmzIntegrate can still be used (in all operating systems). One must start the computation from NmzIntegrate (and not from Normaliz, as was also possible in previous versions).40814082Unfortunately 1.3 the last version of NmzIntegrate that we could compile under MS Windows. This causes some restrictions in the use of NmzIntegrate:40834084\begin{arab}4085\item Due to a bug it is possible that a segmentation fault occurs if excluded faces are used.4086\item The option \verb|OutputDir| is not available.4087\end{arab}40884089An excellent way out is to run Normaliz (and NmzIntegrate) in the Linux subsystem of Windows 10.40904091\subsection{Significant coefficients of the quasipolynomial}\label{highest_coeff}40924093If the degree and simultaneously the period of the Hilbert or weighted Ehrhart quasipolynomial are large, the space needed to store it (usually with large coefficients) may exceed the available memory. Depending on the application, only a certain number of the coefficients may be significant. Therefore one can limit the number of highest coefficients that are stored and printed. We look at the input file \texttt{CondorcetN.in}:4094\begin{Verbatim}4095amb_space 244096inequalities 340971 1 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 1 -140981 1 1 1 1 1 1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -140991 1 1 1 1 1 1 1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -14100nonnegative4101total_degree4102nr_coeff_quasipol 24103\end{Verbatim}41044105The output file shows the following information on the quasipolynomial:4106\begin{Verbatim}4107Hilbert quasi-polynomial of period 4:4108only 2 highest coefficients computed4109their common period is 241100: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15982652919 5626265641111: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15528493056 562626564112with common denominator = 69395979018222216359077478400004113\end{Verbatim}4114Normaliz computes and prints only as many components of the quasipolynomial as required by the common period of the printed coefficients. Coefficients outside the requested range are printed as $0$.41154116The bound on the significant coefficients applies simultaneously to the Hilbert polynomial and the weighted Ehrhart quasipolynomial---usually one is interested in only one of them.41174118By default Normaliz computes the quasipolynomial only if the period does not exceed a preset bound, presently $10^6$. If this bound is too small for your computation, you can remove it by the option4119\begin{Verbatim}4120NoPeriodBound4121\end{Verbatim}4122412341244125\subsection{Explicit dehomogenization}\label{dehom_ex}4126Inhomogeneous input for data in $\RR^{d}$ is homogenized by an extra $(d+1)$th coordinate. The dehomogenization sets the last coordinate equal to $1$. Other systems may prefer the first coordinate. By choosing an explicit dehomogenization Normaliz can be adapted to such input. The file \verb|dehomogenization.in|4127\begin{Verbatim}4128amb_space 34129inequalities 24130-1 1 04131-1 0 14132dehomogenization4133unit_vector 14134\end{Verbatim}4135indicates that in this case the first variable is the homogenizing one. The output file4136\begin{Verbatim}41371 module generators41382 Hilbert basis elements of recession monoid41391 vertices of polyhedron41402 extreme rays of recession cone41413 support hyperplanes of polyhedron (homogenized)41424143embedding dimension = 34144affine dimension of the polyhedron = 2 (maximal)4145rank of recession monoid = 241464147size of triangulation = 04148resulting sum of |det|s = 041494150dehomogenization:41511 0 0415241534154module rank = 141554156***********************************************************************415741581 module generators:41591 1 1416041612 Hilbert basis elements of recession monoid:41620 0 141630 1 0416441651 vertices of polyhedron: 3 support hyperplanes of polyhedron (homogenized)41661 1 1 -1 0 14167-1 1 041682 extreme rays of recession cone: 1 0 041690 0 141700 1 04171\end{Verbatim}4172shows that Normaliz does the computation in the same way as with implicit dehomogenization, except that now the first coordinate decides what is in the polyhedron and what belongs to the recession cone, roughly speaking.41734174Note that the dehomogenization need not be a coordinate. It can be any linear form that is nonnegative on the cone generators.41754176\subsection{Nonpointed cones}\label{Nonpointed}41774178Nonpointed cones and nonpositive monoids contain nontrivial invertible elements. The main effect is that certain data are no longer unique, or may even require a new definition. An important point to note is that cones always split off their unit groups as direct summands and the same holds for normal affine monoids. Since Normaliz computes only normal affine monoids, we can always pass to the quotient by the unit groups. Roughly speaking, all data are computed for the pointed quotient and then lifted back to the original cone and monoid. It is inevitable that some data are no longer uniquely determined, but are unique only modulo the unit group, for example the Hilbert basis and the extreme rays. Also the multiplicity and the Hilbert series are computed for the pointed quotient. From the algebraic viewpoint this means to replace the field $K$ of coefficients by the group ring $L$ of the unit group, which is a Laurent polynomial ring over $K$: instead of $K$-vector space dimensions one considers ranks over $L$.41794180\subsubsection{A nonpointed cone}41814182As a very simple example we consider the right halfplane (\verb|halfspace2.in|):4183\begin{Verbatim}4184amb_space 24185inequalities 141861 04187\end{Verbatim}4188When run in default mode, it yields the following output:4189\begin{Verbatim}41901 Hilbert basis elements41911 Hilbert basis elements of degree 141921 extreme rays41931 support hyperplanes41944195embedding dimension = 24196rank = 2 (maximal)4197external index = 14198dimension of maximal subspace = 141994200size of triangulation = 14201resulting sum of |det|s = 142024203grading:42041 042054206degrees of extreme rays:42071: 142084209Hilbert basis elements are of degree 142104211multiplicity = 142124213Hilbert series:421414215denominator with 1 factors:42161: 142174218degree of Hilbert Series as rational function = -142194220Hilbert polynomial:422114222with common denominator = 142234224rank of class group = 04225class group is free42264227***********************************************************************422842291 Hilbert basis elements of degree 1:42301 0423142320 further Hilbert basis elements of higher degree:423342341 extreme rays:42351 0423642371 basis elements of maximal subspace:42380 1423942401 support hyperplanes:42411 04242\end{Verbatim}42434244In the preamble we learn that the cone contains a nontrivial subspace. In this case it is the vertical axis, and close to the end we see a basis of this subspace, namely $(0,1)$. This basis is always simultaneously a $\ZZ$-basis of the unit group of the monoid. The rest of the output is what we have gotten for the positive horizontal axis which in this case is a natural representative of the quotient modulo the maximal subspace, The quotient can always be embedded in the cone or monoid respectively, but there is no canonical choice. We could have gotten $(1,5)$ as the Hilbert basis as well.42454246Normaliz has found a grading. Of course it vanishes on the unit group, but is positive on the quotient monoid modulo the unit group.42474248Note that the data of type ``dimension'' (embedding dimension, rank, rank of recession monoid in the inhomogeneous case, affine dimension of the polyhedron)) are measured before the passage to the quotient modulo the maximal subspace. The same is true for equations and congruences (which are trivial for the example above).42494250\subsubsection{A polyhedron without vertices}42514252We define the affine halfspace of the figure by \verb|gen_inhom_nonpointed.in|:4253\begin{Verbatim}4254amb_space 24255cone 342561 -14257-1 142580 14259vertices 14260-1 -1 34261\end{Verbatim}42624263\begin{center}4264\begin{tikzpicture}[scale=0.7]42654266\filldraw[yellow] (1.333,-2) -- (-2.667,2) -- (2.5,2) -- (2.5,-2) -- cycle;42674268\foreach \x in {-2,...,2}4269\foreach \y in {-2,...,2}4270{4271\filldraw[fill=black] (\x,\y) circle (1.5pt);4272}4273\draw[->] (-2.5,0) -- (2.5,0);4274\draw[->] (0,-2.5) -- (0,2.5);4275\draw (1.333,-2) -- (-2.667,2);4276\draw (-0.33,-0.333) circle (2.5pt);4277\end{tikzpicture}4278\end{center}42794280It is clear that the ``vertex'' is not a vertex in the strict sense, bt only gives a displacement of the cone. The output when run in default mode:42814282\begin{Verbatim}42831 module generators42841 Hilbert basis elements of recession monoid42851 vertices of polyhedron42861 extreme rays of recession cone42872 support hyperplanes of polyhedron (homogenized)42884289embedding dimension = 34290affine dimension of the polyhedron = 2 (maximal)4291rank of recession monoid = 24292internal index = 34293dimension of maximal subspace = 142944295size of triangulation = 14296resulting sum of |det|s = 342974298dehomogenization:42990 0 1430043014302module rank = 143034304***********************************************************************430543061 module generators:43070 0 1430843091 Hilbert basis elements of recession monoid:43100 1 0431143121 vertices of polyhedron:43130 -2 3431443151 extreme rays of recession cone:43160 1 0431743181 basis elements of maximal subspace:43191 -1 0432043212 support hyperplanes of polyhedron (homogenized):43220 0 143233 3 24324\end{Verbatim}43254326The ``vertex'' of the polyhedron shown is of course the lifted version of the vertex modulo the maximal subspace. It is not the input ``vertex'', but agrees with it up to a unit.43274328\subsubsection{Checking pointedness first}\label{IsPointed}43294330Nonpointed cones will be an exception in Normaliz computations, and therefore Normaliz assumes that the (recession) cone it must compute is pointed. Only in rare circumstances it could be advisable to have this property checked first. There is no need to do so when the dual algorithm is used since it does not require the cone to be pointed. Moreover, if an explicit grading is given or a grading dependent computation is asked for, one cannot save time by checking the pointedness first.43314332The exceptional case is a computation, say of a Hilbert basis, by the primal algorithm in which the computation of the support hyperplanes needs very long time to be completed. If you are afraid this may happen, you can force Normaliz to compute the support hyperplanes right away by adding \verb|IsPointed| to the computation goals. This is a disadvantage only if the cone is unexpectedly pointed.43334334\subsubsection{Input of a subspace} \label{subspace}43354336If a linear subspace contained in the cone is known a priori, it can be given to Normaliz via the input type \verb|subspace|. If Normaliz detects a \verb|subspace|, it appends the rows of the matrix to the generators of the cone, and additionally the negative of the sum of the rows (since we must add the subspace as a cone). If \verb|subspace| is combined with \verb|cone_and_lattice|, then the rows of \verb|subspace| are also appended to the generators of the lattice. It is not assumed that the vectors in \verb|subspace| are linearly independent or generate the maximal linear subspace of the cone. A simple example (\verb|subspace4.in|):4337\begin{Verbatim}4338amb_space 44339cone 443401 0 2 043410 1 -2 143420 0 0 143430 0 0 -14344subspace 143450 0 1 04346\end{Verbatim}43474348From the output:4349\begin{Verbatim}43502 Hilbert basis elements of degree 1:43510 1 0 043521 0 0 0435343540 further Hilbert basis elements of higher degree:435543562 extreme rays:43570 1 0 043581 0 0 0435943602 basis elements of maximal subspace:43610 0 1 043620 0 0 1436343642 support hyperplanes:43650 1 0 043661 0 0 04367\end{Verbatim}43684369One should note that the maximal subspace is generated by the smallest face that contains all invertible elements. Therefore, in order to make all vectors in a face invertible, it is enough to put a single vector from the interior of the face into \verb|subspace|.43704371\subsubsection{Data relative to the original monoid}43724373If original monoid generators are defined, there are two data related to them that must be read with care.43744375First of all, we consider the original monoid generators as being built from the vectors in \verb|cone| or \verb|cone_and_lattice| plus the vectors in \verb|subspace| and additionally the negative of the sum of the latter (as pointed out above).43764377The test for ``Original monoid is integrally closed' is correct -- it returns \verb|true| if and only if the original monoid as just defined indeed equals the computed integral closure. (There was a mistake in version 3.0.)43784379The ``module generators over the original monoid'' only refer to the \emph{image} of the original monoid and the image of the integral closure \emph{modulo the maximal subspace}. They do not take into account that the unit group of the integral closure may not be generated by the original generators. An example in which the lack of integral closedness is located in the unit group (\verb|normface.in|):43804381\begin{Verbatim}4382amb_space 54383cone 443840 0 0 1 143851 0 0 1 143860 1 0 1 143870 0 1 1 14388subspace 443890 0 0 0 143901 0 0 0 143910 1 0 0 143921 1 2 0 14393\end{Verbatim}43944395From the output file:43964397\begin{Verbatim}4398...4399dimension of maximal subspace = 44400original monoid is not integrally closed4401unit group index = 24402...440344041 Hilbert basis elements of degree 1:44050 0 0 1 04406...44071 module generators over original monoid:44080 0 0 0 04409\end{Verbatim}4410The original monoid is not integrally closed since the unit group of the integral closure is strictly larger than that of the original monoid: the extension has index $2$, as indicated. The quotients modulo the unit groups are equal, as can be seen from the generator over the original monoid or the Hilbert basis (of the integral closure) that is contained in the original monoid.441144124413\subsection{Exporting the triangulation}\label{Triang}44144415The option \ttt{-T} asks Normaliz to export the triangulation by writing the files4416\ttt{<project>.tgn} and \verb|<project>.tri|:44174418\begin{itemize}44194420\itemtt[tgn] The file \ttt{tgn} contains a matrix of vectors (in the4421coordinates of $\AA$) spanning the simplicial cones in4422the triangulation.44234424\itemtt[tri]4425The file \ttt{tri} lists the simplicial subcones. There are two variants, depending on whether \verb|ConeDecomposition| had been set. Here we assume that \verb|ConeDecomposition| is not computed. See Section \ref{Disjoint} for the variant with \verb|ConeDecomposition|.44264427The first line contains the number of simplicial cones4428in the triangulation, and the next line contains the4429number $m+1$ where $m=\rank \EE$. Each of the following4430lines specifies a simplicial cone $\Delta$: the first4431$m$ numbers are the indices (with respect to the order4432in the file \ttt{tgn}) of those generators that span4433$\Delta$, and the last entry is the multiplicity of4434$\Delta$ in $\EE$, i.~e.\ the absolute value of the4435determinant of the matrix of the spanning vectors (as4436elements of $\EE$).4437\end{itemize}44384439The following example is the $2$-dimensional cross polytope with one excluded face (\verb|cross2.in|). The excluded face is irrelevant for the triangulation.44404441\begin{Verbatim}4442amb_space 34443polytope 444441 044450 14446-1 044470 -14448excluded_faces 144491 1 -14450\end{Verbatim}44514452Its \verb|tgn| and \verb|tri| files are4453\begin{Verbatim}4454tgn tri44554 244563 444571 0 1 1 2 3 244580 1 1 1 3 4 24459-1 0 1 plain44600 -1 14461\end{Verbatim}44624463We see the $4$ vertices $v_1,\dots,v_4$ in homogenized coordinates in \verb|tgn| and the $2$ simplices (or the simplicial cones over them) in \verb|tri|: both have multiplicity $2$. The last word \verb|plain| indicates that Normaliz has computed a triangulation in the strict sense, namely a simplicial subdivision in which neighboring simplicial cones match along common faces. The alternative is \verb|nested| that we discuss below.44644465In addition to the files \verb|<project>.tgn| and \verb|<project>.tri|, also the file \verb|<object>.inv| is written. It contains the data of the file \verb|<project>.out| above the line of stars in a human and machine readable format.44664467\subsubsection{Nested triangulations}\label{nested}44684469If Normaliz has subdivided a simplicial cone of a triangulation of the cone $C$, the resulting decomposition of $C$ may no longer be a triangulation in the strict sense. It is rather a \emph{nested triangulation}, namely a map from a rooted tree to the set of full-dimensional subcones of $C$ with the following properties:4470\begin{arab}4471\item the root is mapped to $C$,4472\item every other node is mapped to a full dimensional simplicial subcone,4473\item the simplicial subcones corresponding to the branches at a node $x$ form a triangulation of the simplicial cone corresponding to $x$.4474\end{arab}44754476The following figure shows a nested triangulation:44774478\begin{center}4479\begin{tikzpicture}[scale=1.0]4480\draw[very thick] (-4,4) -- (4,4) -- (0,0) -- cycle;4481\draw[thick] (-2,2) -- (2,2) -- (0,4) -- cycle;4482\draw (-1,3) -- (1,3) -- (0,2) -- cycle;4483\draw[dashed] (0.5,2.5) --(1.5,2.5) -- (1.0,2) --cycle;4484\end{tikzpicture}4485\end{center}44864487For the Normaliz computations, nested triangulations are as good as ordinary triangulations, but in other applications the difference may matter. With the option \verb|-T|, Normaliz prints the leaves of the nested triangulation to the \verb|tri| file. They constitute the simplicial cones that are finally evaluated by Normaliz.44884489The triangulation is always plain if \verb|-T| is the only computation goal or if it is just combined with \verb|-v|. Otherwise it can only fail to be plain if it contains determinants $\ge 10^8$.44904491The subdivision can be blocked by \verb|NoSubdivision|, independently of the computation goals.44924493\subsubsection{Disjoint decomposition}\label{Disjoint}44944495Normaliz can export the disjoint decomposition of the cone that it has computed. This decomposition is always computed together with a full triangulation, unless only the multiplicity is asked for. It represents the cone as the disjoint union of semiopen simplicial subcones. The corresponding closed cones constitute the triangulation, and from each of them some facets are removed so that one obtains a disjoint decomposition. See \cite{BIS} for more information. In the following figure, the facets separating the triangles are omitted in the triangle on the $-$ side.44964497\begin{center}4498\begin{scriptsize}4499%\tikzstyle{every node}=[circle, draw, fill=black, inner sep=0pt, minimum width=3pt]4500\begin{tikzpicture}4501[scale=0.7,auto=left, thick]4502%\foreach \from/\to in {n2/n4,n2/n5,n4/n5,n4/n6,n5/n7,n6/n7}4503% \foreach \x in {0, 1, ..., 9}4504\foreach \x/\y in {0/2, 2/0, 5/0, 5/2, 5/4, 7/0, 7/4, 9/2}4505\node [circle, draw, fill=black, inner sep=0pt, minimum width=2.5pt](n\x\y) at (\x,\y) {};4506\node [circle, draw, fill=black, inner sep=0pt, minimum width=2.5pt](n23) at (2.5,3) {};4507%\node [circle, draw, inner sep=0pt, minimum width=3pt, label=above:$O_C$](OC) at (2.8,1.7) {};45084509% \draw (\from) -- node[above]{$+$} node[below]{$-$} (\to);4510\draw (n20) -- node[right=-2pt, pos=0.4]{$+$} node[left=-2pt, pos=0.4]{$-$} (n23);4511\draw (n20) -- node[above=-2pt]{$+$} (n02);4512\draw (n50) -- node[right=-2pt]{$-$} node[left=-2pt]{$+$} (n23);4513\draw (n50) -- node[near end, right=-2pt]{$-$} node[near end, left=-2pt]{$+$} (n52);4514\draw (n52) -- node[right=-2pt]{$-$} node[left=-2pt]{$+$} (n54);4515\draw (n70) -- node[right=-2pt, pos=0.4]{$-$} node[left=-2pt, pos=0.4]{$+$} (n74);45164517\draw (n52) -- node[below=-2pt]{$+$} node[above=-2pt]{$-$} (n23);4518\draw (n52) -- node[below=-2pt]{$-$} node[above]{$+$} (n74);4519\draw (n50) -- node[right=-2pt]{$-$} node[left=-2pt]{$+$} (n74);45204521\draw (n02) -- node[below=-2pt]{$+$} (n23);4522\draw (n23) -- node[right=5pt]{$+$} (n54);4523\draw (n20) -- node[above=-2pt]{$+$} (n50);4524\draw (n50) -- node[above=-2pt]{$+$} (n70);4525\draw (n54) -- node[below=-2pt]{$+$} (n74);4526\draw (n70) -- node[above=-2pt]{$+$} (n92);4527\draw (n74) -- node[below=-2pt]{$+$} (n92);452845294530% \draw[to] (daq) -- node[midway,right] {raw event data\\level 1} (buffer);4531% \draw[to] (monitor) -- node[midway,above] {events} node[midway,below] {level 1} (datastore);4532\end{tikzpicture}4533\end{scriptsize}4534\end{center}45354536If you want to access the disjoint decomposition, you must activate the computation goal \verb|ConeDecomposition| or use the command line option is \verb|-D|. As an example we compute \verb|cross2.in| with the computation goal \verb|ConeDecomposition|. The file \verb|cross2.tri| now looks as follows:45374538\begin{Verbatim}453924540745411 2 3 2 0 0 045422 3 4 2 0 0 14543plain4544\end{Verbatim}45454546As before the first line contains the size of the triangulation and the second is the number of entries of each row.4547The first $3$ entries in each line are the indices of the extreme rays with respect to the \verb|tgn| file and the fourth entry is the determinant. They are followed by a $0/1$ vector indicating the open facets in the order in which they are opposite to the extreme rays. If the corresponding entry is $1$, the facet must be removed.45484549In our example all facets of the first simplicial cone are kept, and from the second simplicial cone the facet opposite to the third extreme ray (with index $4$ relative to \verb|tgn|) must be removed.45504551The disjoint decomposition which is the basis of all Hilbert series computations uses the algorithm suggested by K�ppe and Verdoolaege \cite{KV}.455245534554\subsection{Exporting the Stanley decomposition}\label{Stanley}45554556The option \ttt{-y} makes Normaliz4557write the files \ttt{<project>.tgn}, \verb|<project>.dec| and \verb|<project>.inv|. Stanley decomposition is contained in the file with the suffix \verb|dec|. But this file also contains the inclusion/exclusion data if there are excluded faces:45584559(a) If there are any excluded faces, the file starts with the word4560\verb|in_ex_data|. The next line contains the number of such data that follow.4561Each of these lines contains the data of a face and the coefficient with which4562the face is to be counted: the first number lists the number of generators that4563are contained in the face, followed by the indices of the generators relative4564to the \verb|tgn| file and the last number is the coefficient.45654566(b) The second block (the first if there are no excluded faces) starts with4567the word \verb|Stanley_dec|, followed by the number of simplicial cones in the4568triangulation.45694570For each simplicial cone $\Delta$ in the4571triangulation this file contains a block of data:4572\begin{enumerate}4573\item[(i)] a line listing the indices $i_1,\dots,i_m$ of the4574generators $v_{i_1},\dots,v_{i_m}$ relative to the4575order in \ttt{tgn} (as in \ttt{tri}, $m=\rank \EE$);45764577\item[(ii)] a $\mu\times m$ matrix where $\mu$ is the4578multiplicity of $\Delta$ (see above).45794580In the notation of \cite{BIS}, each line lists an4581``offset'' $x+\epsilon(x)$ by its coordinates with4582respect to $v_{i_1},\dots,v_{i_m}$ as follows: if4583$(a_1,\dots,a_m)$ is the line of the matrix, then4584$$4585x+\epsilon(x)=\frac{1}{\mu}(a_1v_{i_1}+\dots+a_mv_{i_m}).4586$$4587\end{enumerate}458845894590The \verb|dec| file of the example above is4591\begin{Verbatim}4592in_ex_data4593145942 1 2 -14595Stanley_dec4596245971 3 4 1 2 345982 245993 346000 0 2 0 0 046011 1 2 1 0 14602\end{Verbatim}46034604There is $1$ face in \verb|in_ex_data| (namely the excluded one), it contains the $2$ generators $v_1$ and $v_2$ and appears with multiplicity $-1$. The Stanley decomposition consists of $4$ components of which each of the simplicial cone contains $2$. The second offset in the second simplicial cone is4605$$4606\frac12 (1v_1+0v_2+1v_3)=(0,0,1).4607$$46084609We recommend you to process the file \ttt{3x3magiceven.in} with the4610option \ttt{-ahTy} activated. Then inspect all4611the output files in the subdirectory \ttt{example} of the4612distribution.46134614\subsection{Module generators over the original monoid}\label{MinMod}46154616Suppose that the original generators are well defined in the input. This is always the case when these consists just of a \verb|cone| or a \verb|cone_and_lattice|. Let $M$ be the monoid generated by them. Then Normaliz computes the integral closure $N$ of $M$ in the effective lattice $\EE$. It is often interesting to understand the difference set $N\setminus M$. After the introduction of a field $K$ of coefficients, this amounts to understanding $K[N]$ as a $K[M]$-module. With the option \verb|ModuleGeneratorsOverOriginalMonoid, -M| Normaliz computes a minimal generating set $T$ of this module. Combinatorially this means that we find an irreducible cover4617$$4618N=\bigcup_{x\in T} x+M.4619$$4620Note that $0\in T$ since $M\subset N$.4621\begin{center}4622\begin{tikzpicture}[scale=0.7]4623\filldraw[yellow] (0,0) -- (1.833,5.5) -- (4.5,5.5) -- (4.5,2.25) -- cycle;4624\draw (0,0) -- (1.833,5.5);4625\draw (0,0) -- (4.5,2.25) node at (-0.3,-0.3){\small $0$};4626\foreach \x in {0,...,4}4627\foreach \y in {0,...,5}4628{4629\filldraw[fill=black] (\x,\y) circle (1.5pt);4630}4631\draw[red,thick] (1,1) circle (4pt);4632\draw[red,thick] (2,3) circle (4pt);4633\draw[red,thick] (1,2) circle (4pt);4634\draw[red,thick] (2,2) circle (4pt);4635\draw[red,thick] (0,0) circle (4pt);4636\draw[->,thick] (0,0) -- (1,3);4637\draw[->,thick] (0,0) -- (2,1);4638\end{tikzpicture}4639\end{center}4640As an example, we can run \verb|2cone.in| with the option \verb|-M| on the command line. This yields the output4641\begin{Verbatim}4642...46434 Hilbert basis elements:46441 146451 2 5 module generators over original monoid:46461 3 0 046472 1 1 146481 246492 extreme rays: 2 246501 3 2 346512 14652\end{Verbatim}46534654In the nonpointed case Normaliz can only compute the module generators of $N/N_0$ over $M/(M\cap N_0)$ where $N_0$ is the unit group of $N$. If $M_0\neq M_0$, this is not a system of generators of $M$ over $N$.46554656\subsubsection{An inhomogeneous example}46574658Let us have a look at a very simple input file (\verb|genmod_inhom2.in|):4659\begin{Verbatim}4660amb_space 24661cone 246620 346632 04664vertices 146650 0 14666ModuleGeneratorsOverOriginalMonoid4667\end{Verbatim}46684669The cone is the positive orthant that we have turned into a polyhedron by adding the vertex $(0,0)$. The original monoid is generated by $(2,0)$ and $(0,3)$.46704671In addition to the original monoid $M$ and its integral closure $N$ we have a third object, namely the module $P$ of lattice points in the polyhedron.We compute4672\begin{enumerate}4673\item the system of generators of $P$ over $N$ (the \verb|module generators|) and4674\item the system of generators of $P$ over $N$ (the \verb|module generators over original monoid|).4675\end{enumerate}4676We do not compute the system of generators of $N$ over $M$ (that we get in the homogeneous case).46774678The output:4679\begin{Verbatim}46801 module generators46812 Hilbert basis elements of recession monoid46821 vertices of polyhedron46832 extreme rays of recession cone46846 module generators over original monoid46853 support hyperplanes of polyhedron (homogenized)46864687embedding dimension = 34688affine dimension of the polyhedron = 2 (maximal)4689rank of recession monoid = 24690internal index = 646914692size of triangulation = 14693resulting sum of |det|s = 646944695dehomogenization:46960 0 1469746984699module rank = 147004701***********************************************************************470247031 module generators:47040 0 1470547062 Hilbert basis elements of recession monoid:47070 1 047081 0 0470947101 vertices of polyhedron:47110 0 1471247132 extreme rays of recession cone:47140 1 047151 0 0471647176 module generators over original monoid:47180 0 147190 1 147200 2 147211 0 147221 1 147231 2 1472447253 support hyperplanes of polyhedron (homogenized):47260 0 147270 1 047281 0 04729\end{Verbatim}47304731\subsection{Lattice points in the fundamental parallelepiped}\label{LattPointsFPE}47324733Let $u_1,\dots,u_n$ be linearly independent vectors in $\ZZ^d\subset\RR^d$. They span a simplicial cone $C$. Moreover let $U$ be the subgroup of $(\RR^d,+)$ generated by $u_1,\dots,u_n$ and let $v\in\RR^d$. We are interested in the shifted cone $C'=v+C$. We assume that $C'$ contains a lattice point. This need not be true if $n<s$, but with our assumption we can also assume that $n=d$ after the restriction to the affine space spanned by $C'$. The \emph{fundamental} parallelepiped of $C$ (with respect to $U$) is4734$$4735F=\para(u_1,\dots,u_d)=\{q_qu_1+\dots+q_du_d: 0\le q_i<1 \}.4736$$4737Set $F'=v+F$. Then the translates $u+F'$, $u\in U$, tile $\RR^d$; so $F'$ is a fundamental domain for the action of $U$ on $\RR^d$ by translation, and we call it $F'$ the \emph{fundamental} parallelepiped of $C'$ (with respect to $U$). Every point in $\RR^d$ differs from exactly one point in $F'$ by an element of $U$. This holds in particular for the lattice points.47384739One of the main basic tasks if Normaliz is the computation of the lattice points in $F'$, especially in the case $v=0$ (but not only). Looking back at the examples in Section \ref{MinMod}, we see that we can in fact compute and export these lattice points via the computation goal \verb|ModuleGeneratorsOverOriginalMonoid|.47404741Often however, an additional complication comes up: we must shift $F'$ by an infinitesimally small vector in order to exclude certain facets of $C'$. This would be difficult in Normaliz without the input type \verb|open_facets| (see Section \ref{open_facets}). Recall that this is a $0$-$1$-vector whose entries $1$ indicate which facets must be avoided: if its $i$-th entry is $1$, then the facet opposite to $v+u_i$ must be made `open''.47424743The input file \verb|no_open_facets.in| is4744\begin{Verbatim}4745amb_space 24746cone 247471 14748-3 34749vertices 147501/2 1/2 14751ModuleGeneratorsOverOriginalMonoid4752\end{Verbatim}47534754Then \verb|no_open_facets.out| contains4755\begin{Verbatim}47566 module generators over original monoid:4757-2 3 14758-1 2 14759-1 3 147600 1 147610 2 147621 1 14763\end{Verbatim}4764These are $6$ encircled points in the left figure.47654766\begin{center}4767\begin{tikzpicture}[scale=0.7]4768\filldraw[yellow] (0.5,0.5) -- (1.5,1.5) -- (-1.5,4.5) -- (-2.5,3.5) -- cycle;4769\foreach \x in {-3,...,3}4770\foreach \y in {0,...,5}4771{4772\filldraw[fill=black] (\x,\y) circle (1.5pt);4773}4774\draw[->,thick] (0.5,0.5) -- (-2.5,3.5);4775\draw[->,thick] (0.5,0.5) -- (1.5,1.5);4776\draw[dashed] (-2.5,3.5) -- (-1.5,4.5) -- (1.5,1.5);4777\draw node at (0,-0.5){\small $0$};4778\draw node at (0.5,0.1){\small $v$};4779\draw[red,thick] (1,1) circle (4pt);4780\draw[red,thick] (0,1) circle (4pt);4781\draw[red,thick] (-1,2) circle (4pt);4782\draw[red,thick] (0,2) circle (4pt);4783\draw[red,thick] (-2,3) circle (4pt);4784\draw[red,thick] (-1,3) circle (4pt);4785\draw (0.5,0.5) circle (4pt);4786\draw[blue, thick] (0.6,0.6) -- (1.6,1.6) -- (-1.4,4.6) -- (-2.4,3.6) -- cycle;4787\end{tikzpicture}4788\qquad\qquad\qquad4789\begin{tikzpicture}[scale=0.7]4790\filldraw[yellow] (1,1) -- (2,2) -- (-1,5) -- (-2,4) -- cycle;4791\foreach \x in {-3,...,3}4792\foreach \y in {0,...,5}4793{4794\filldraw[fill=black] (\x,\y) circle (1.5pt);4795}4796\draw[->,thick] (1,1) -- (-2,4);4797\draw[->,thick] (1,1) -- (2,2);4798\draw[dashed] (-2,4) -- (-1,5) -- (2,2);4799\draw node at (0,-0.5){\small $0$};4800\draw node at (1,0.6){\small $v'$};4801\draw[red,thick] (1,1) circle (4pt);4802\draw[red,thick] (1,2) circle (4pt);4803\draw[red,thick] (0,3) circle (4pt);4804\draw[red,thick] (0,2) circle (4pt);4805\draw[red,thick] (-1,4) circle (4pt);4806\draw[red,thick] (-1,3) circle (4pt);4807\end{tikzpicture}4808\end{center}4809Now we add4810\begin{Verbatim}4811open_facets48121 04813\end{Verbatim}4814to the input (to get \verb|open_facets.in|). We have tried to indicate the infinitesimal shift by the blue rectangle in the left figure. The computation yields4815\begin{Verbatim}48166 module generators over original monoid:4817-1 3 14818-1 4 148190 2 148200 3 148211 1 148221 2 14823\end{Verbatim}4824which are the encircled lattice points in the right figure. It is explained in Section \ref{open_facets} how the new vector $v'$ is computed.48254826Note that the lattice points are listed with the homogenizing coordinate $1$. In fact, both \verb|vertices| and \verb|open_facets| make the computation inhomogeneous. If both are missing, then the lattice points are listed without the homogenizing coordinate. If you want a uniform format for the output, you can use the zero vector for \verb|open_facets| or the origin as the vertex. Both options change the result only to the extent that the homogenizing coordinate is added.48274828\subsection{Precomputed support hyperplanes}\label{supphyp_ex}48294830Computing the support hyperplanes can be a very time consuming task, and if it has been the first step in the exploration of a difficult example, it may be desirable, to use the support hyperplanes as additional input in order to save computation time. This is especially true if Normaliz must do an intermediate computation of the support hyperplanes because of a large number of simplicial cones to be evaluated. The file \verb|2cone_supp.in| is just a toy example:4831\begin{Verbatim}4832amb_space 24833cone 248342 148351 34836support_hyperplanes 24837-1 248383 -14839\end{Verbatim}48404841As pointed out in Section \ref{HomConstrCone}, Normaliz must trust you---here is no way of checking the correctness of this input without recomputing it.48424843\subsection{Shift, denominator, quasipolynomial and multiplicity}\label{sdqm}48444845In this section we discuss the interplay of shift, denominator of the grading and the quasipolynomial. As long as the denominator is $1$, the situation is very simple and no ambiguity arises. See Section \ref{inhom_ineq_ex}. We modify the example from that section as follows (\verb|InhomIneq_7.in|):4846\begin{Verbatim}4847amb_space 24848inhom_inequalities 348490 2 148500 -2 348512 -2 34852grading48537 04854\end{Verbatim}4855The output related to the grading is4856\begin{Verbatim}4857grading:48587 0 04859with denominator = 7486048614862module rank = 24863multiplicity = 248644865Hilbert series:48661 14867denominator with 1 factors:48681: 148694870shift = -148714872degree of Hilbert Series as rational function = -148734874Hilbert polynomial:487524876with common denominator = 14877\end{Verbatim}4878The Hilbert series computed by hand is4879$$4880\frac{t^{-7}+1}{1-t^7}.4881$$48824883We obtain it from the output as follows. The printed series is4884$$4885\frac{1+t}{1-t}.4886$$4887Now the shift is applied and yields4888$$4889\frac{t^{-1}+1}{1-t}.4890$$4891Finally we make the substitution $t\mapsto t^7$, and obtain the desired result.48924893Now we add the complication $x_1+x_2\equiv -1 \mod 8$ ((\verb|InhomIneq_7_8.in|):4894\begin{Verbatim}4895amb_space 24896inhom_inequalities 348970 2 148980 -2 348992 -2 34900grading49017 04902inhom_congruences 149031 1 1 84904\end{Verbatim}4905The result:4906\begin{Verbatim}4907grading:49087 0 04909with denominator = 7491049114912module rank = 24913multiplicity = 1/449144915Hilbert series:49161 0 0 0 0 0 0 14917denominator with 1 factors:49188: 149194920shift = -149214922degree of Hilbert Series as rational function = -249234924Hilbert series with cyclotomic denominator:4925-1 1 -1 1 -1 1 -14926cyclotomic denominator:49271: 1 4: 1 8: 149284929Hilbert quasi-polynomial of period 8:49300: 0 4: 049311: 0 5: 049322: 0 6: 149333: 0 7: 14934with common denominator = 14935\end{Verbatim}4936The printed Hilbert series is4937$$4938\frac{1+t^7}{1-t^8}.4939$$4940The application of the shift yields4941$$4942\frac{t^{-1}+t^6}{1-t^8}.4943$$4944the correct result for the divided grading. \emph{The Hilbert quasipolynomial is computed for the divided grading}, as already explained in Section \ref{cong_ex}. As a last step, we can apply the substitution $t\mapsto t^7$ in order obtain the Hilbert series4945$$4946\frac{t^{-7}+t^{42}}{1-t^{56}}4947$$4948for the original grading.49494950Like the quasipolynomial, \emph{the multiplicity is computed for the divided grading}.4951495249534954\section{Optional output files}\label{optionaloutput}495549564957When one of the options \ttt{Files,-f} or \ttt{AllFiles, -a} is activated, Normaliz4958writes additional output files whose names are of type4959\ttt{<project>.<type>}. (Note that the options \verb|-T, Triangulation| and \verb|-y, StanleyDec| as well as the options \verb|-E, -L, -I| calling NmzIntegrate also write files in addition to \verb|<project>.out|. \verb|Symmetrize| does not produce extra output files.) Moreover one can select the optional output files individually via command line options. Most of these files contain matrices in a simple format:4960\begin{Verbatim}4961<m>4962<n>4963<x_1>4964...4965<x_m>4966\end{Verbatim}4967where each row has \verb|<n>| entries. Exceptions are the files with suffixes \verb|cst|, \verb|inv|, \verb|esp|.49684969Note that the files are only written if they would contain at least one row.49704971As pointed out in Section \ref{outcontrol}, the optional output files for the integer hull are the same as for the original computation, as far as their content has been computed.49724973\subsection{The homogeneous case}49744975The option \ttt{-f} makes Normaliz write the following files:49764977\begin{itemize}4978\itemtt[gen] contains the Hilbert basis. If you want to use this file as an input file and reproduce the computation results, then you must make it a matrix of type \verb|cone_and_lattice| (and add the dehomogenization in the inhomogeneous case).49794980\itemtt[cst] contains the constraints defining the cone4981and the lattice in the same format as they would appear4982in the input: matrices of types \emph{constraints} following each4983other. Each matrix is concluded by the type of the constraints.4984Empty matrices are indicated by $0$ as the4985number of rows. Therefore there will always be at least4986$3$ matrices.49874988If a grading is defined, it will be appended. Therefore4989this file (with suffix \ttt{in}) as input for4990Normaliz will reproduce the Hilbert basis and all the4991other data computed, at least in principle.49924993\itemtt[inv] contains all the information from the4994file \ttt{out} that is not contained in any of the4995other files.4996\end{itemize}49974998If \ttt{-a} is activated, then the following files are written4999\emph{additionally:}50005001\begin{itemize}50025003\itemtt[ext] contains the extreme rays of the cone.50045005\itemtt[ht1] contains the degree $1$ elements of the5006Hilbert basis if a grading is defined.50075008\itemtt[egn,esp] These contain the Hilbert basis and5009support hyperplanes in the coordinates with respect to5010a basis of $\EE$. \ttt{esp} contains the grading and the dehomogenization in the5011coordinates of $\EE$. Note that no5012equations for $\CC\cap\EE$ or congruences for $\EE$ are5013necessary.50145015\itemtt[lat] contains the basis of the lattice $\EE$.50165017\itemtt[mod] contains the module generators of the integral closure modulo the original monoid.50185019\itemtt[msp] contains the basis of the maximal subspace.5020\end{itemize}50215022In order to select one or more of these files individually, add an option of type \verb|--<suffix>| to the command line where \verb|<suffix>| can take the values5023\begin{Verbatim}5024gen, cst, inv, ext, ht1, egn, esp, lat, mod, msp, typ5025\end{Verbatim}50265027The type \verb|typ| is not contained in \verb|Files| or \verb|AllFiles| since it can be extremely large. It is of the matrix format described above. It is the product of the matrices5028corresponding to \ttt{egn} and the transpose of \ttt{esp}. In other5029words, the linear forms representing the support5030hyperplanes of the cone $C$ are evaluated on the5031Hilbert basis. The resulting matrix, with the5032generators corresponding to the rows and the support5033hyperplanes corresponding to the columns, is written to5034this file.50355036The suffix \ttt{typ} is motivated by the fact that the5037matrix in this file depends only on the isomorphism5038type of monoid generated by the Hilbert basis (up to5039row and column permutations). In the language of5040\cite{BG} it contains the \emph{standard embedding}.50415042Note: the explicit choice of an optional output file does \emph{not} imply a computation goal. Output files that would contain unknown data are simply not written without a warning or error message.50435044\subsection{Modifications in the inhomogeneous case}50455046The optional output files are a subset of those that can be produced in the homogeneous5047case. The main difference is that the generators of the solution module and the5048Hilbert basis of the recession monoid appear together in the file \verb|gen|.5049They can be distinguished by evaluating the dehomogenization on them (simply the last component with inhomogeneous input), and the5050same applies to the vertices of the polyhedron and extreme rays of the5051recession cone. The file \verb|cst| contains the constraints defining the5052polyhedron and the recession module in conjunction with the dehomogenization, which is also contained in the \verb|cst| file, following the constraints.50535054With \verb|-a| the files \verb|egn| and \verb|esp| are produced. These files contain \verb|gen| and the support hyperplanes of the homogenized cone in the coordinates of $\EE$, as well as the dehomogenization.50555056%%%%%%%%%%%%%%%%%%%%%%%%%%%% TERMINAL OUTPUT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%50575058%\section{Terminal output}50595060%%%%%%%%%%%%%%%%%%%%%%%%%%%% PERFORMANCE AND PARALLELIZATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%5061506250635064%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LARGE COMPUTATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%50655066\section{Performance}\label{Perf}50675068\subsection{Parallelization}\label{PerfPar}50695070The executables of Normaliz have been compiled for parallelization5071on shared memory systems with OpenMP. Parallelization reduces the5072``real'' time of the computations considerably, even on relatively5073small systems. However, one should not underestimate the5074administrational overhead involved.5075\begin{itemize}5076\item It is not a good idea to use parallelization for very small problems.5077\item On multi-user systems with many processors it may be wise to limit5078the number of threads for Normaliz somewhat below the maximum5079number of cores.5080\end{itemize}5081By default, Normaliz limits the number of threads to 8. One can override this limit by the Normaliz5082option \ttt{-x} (see Section \ref{exec}).50835084Another way to set an upper limit to the number of threads is via the environment variable \verb|OMP_NUM_THREADS|:5085\begin{center}5086\verb+export OMP_NUM_THREADS=<T>+\qquad (Linux/Mac)5087\end{center}5088or5089\begin{center}5090\verb+set OMP_NUM_THREADS=<T>+\qquad (Windows)5091\end{center}5092where \ttt{<T>} stands for the maximum number of threads5093accessible to Normaliz. For example, we often use5094\begin{center}5095\verb+export OMP_NUM_THREADS=20+5096\end{center}5097on a multi-user system system with $24$ cores.50985099Limiting the number of threads to $1$ forces a strictly serial5100execution of Normaliz.51015102The paper \cite{BIS} contains extensive data on the effect of parallelization. On the whole Normaliz scales very well.5103However, the dual algorithm often performs best with mild parallelization, say with $4$ or $6$ threads.51045105\subsection{Running large computations}\label{Large}51065107Normaliz can cope with very large examples, but it5108is usually difficult to decide a priori whether an example is5109very large, but nevertheless doable, or simply impossible.5110Therefore some exploration makes sense.51115112See \cite{BIS} for some very large computations. The following5113hints reflect the authors' experience with them.51145115(1) Run Normaliz with the option \ttt{-cs} and pay attention5116to the terminal output. The number of extreme rays, but also5117the numbers of support hyperplanes of the intermediate cones5118are useful data.51195120(2) In many cases the most critical size parameter is the5121number of simplicial cones in the triangulation. It makes sense5122to determine it as the next step. Even with the fastest5123potential evaluation (option \ttt{-v}), finding the5124triangulation takes less time, say by a factor between $3$ and5125$10$. Thus it makes sense to run the example with \ttt{-t} in5126order to explore the size.51275128As you can see from \cite{BIS}, Normaliz has successfully5129evaluated triangulations of size $\approx 5\cdot 10^{11}$ in5130dimension $24$.51315132(3) Another critical parameter are the determinants of the5133generator matrices of the simplicial cones. To get some feeling5134for their sizes, one can restrict the input to a subset (of the5135extreme rays computed in (1)) and use the option \ttt{-v} or the computation goal \verb|TriangulationDetSum| if there is no grading.51365137The output file contains the number of simplicial cones as well5138as the sum of the absolute values of the determinants. The5139latter is the number of vectors to be processed by Normaliz5140in triangulation based calculations.51415142The number includes the zero vector for every simplicial cone5143in the triangulation. The zero vector does not enter the5144Hilbert basis calculation, but cannot be neglected for the5145Hilbert series.51465147Normaliz has mastered calculations with $> 10^{15}$ vectors.51485149(4) If the triangulation is small, we can add the option5150\ttt{-T} in order to actually see the triangulation in a file.5151Then the individual determinants become visible.51525153(5) If a cone is defined by inequalities and/or equations5154consider the dual mode for Hilbert basis calculation, even if5155you also want the Hilbert series.51565157(6) The size of the triangulation and the size of the5158determinants are \emph{not} dangerous for memory by themselves5159(unless \ttt{-T} or \ttt{-y} are set). Critical magnitudes can5160be the number of support hyperplanes, Hilbert basis candidates,5161or degree $1$ elements.51625163%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DISTRIBUTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%5164\section{Distribution and installation}\label{Distr}51655166In order to install Normaliz you should first download the5167basic package. Follow the instructions in5168\begin{center}5169\url{http://normaliz.uos.de/download/}.5170\end{center}5171They guide you to our GitHub repository.51725173The basic package contains the documentation, examples, source5174code, jNormaliz, NmzIntegrate and the packages for PyNormaliz, Singular5175and Macaulay2. Then unzip the downloaded file5176\ttt{\NmzDir.zip} in a directory of your choice. (Any other5177downloaded zip file for Normaliz should be unzipped in this5178directory, too.)51795180This process will create a directory \ttt{\NmzDir} (called5181Normaliz directory) and several subdirectories in5182it. The names of the subdirectories created are5183self-explanatory. Nevertheless we give an overview:5184\begin{itemize}5185\item In the Normaliz directory you should5186find \ttt{jNormaliz.jar}, several files, for example \ttt{Copying}, and5187subdirectories.51885189\item The subdirectory \ttt{source} contains the source files.51905191\item The subdirectory \ttt{doc} contains the file you are reading5192and further documentation.51935194\item In the subdirectory \ttt{example} are the input5195files for some examples. It contains all named5196input files of examples of this manual.51975198\item Automated tests which run Normaliz on different inputs5199and options are contained in the subdirectory \ttt{test}.52005201\item The subdirectory \ttt{Singular} contains the5202\textsc{Singular} library \ttt{normaliz.lib} and a PDF file with5203documentation.52045205\item The subdirectory \ttt{Macaulay2} contains the5206\textsc{Macaulay2} package \ttt{Normaliz.m2}.52075208\item The subdirectory \ttt{PyNormaliz} contains the source5209\textsc{Python} interface.52105211\item The subdirectory \ttt{lib} contains libraries for5212jNormaliz.52135214\item Moreover, there are subdirectories whose name starts with \verb|Q|. They contain5215the source code, examples and tests for QNormaliz (see Appendix \ref{QNorm})5216\end{itemize}52175218We provide executables for Windows, Linux and Mac. Download the archive file5219corresponding to your system \ttt{\NmzDir<systemname>.zip}5220and unzip it. This process will store the executables of5221Normaliz and NmzIntegrate in the Normaliz directory. In case you want to run Normaliz from the5222command line or use it from other systems, you may have to copy5223the executables to a directory in the search path for5224executables.52255226Please read the release notes on the download page. Especially on Mac you may want to build Normaliz yourself since it is impossible to provide a statically linked executable with parallelization.52275228%%%%%%%%%%%%%%%%%%%%%%%%%%%%% COMPILATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%5229\section{Building Normaliz yourself}\label{Compile}52305231Normaliz offers the luxury of three build systems:5232\begin{enumerate}5233\item \ttt{autotools},5234\item \ttt{cmake}5235\item ``classical'' \ttt{make} using the ``handwritten'' \verb|Makefile.classic|.5236\end{enumerate}52375238The basic steps are the same for all three systems, namely5239\begin{itemize}5240\item configuration,5241\item compilation,5242\item installation.5243\end{itemize}5244The main difference is the way how the build system is configured whereas compilation and installation are essentially identical. In all cases the compilation of NmzIntegrate is included (as well as the compilation of the example program maxsimplex in Appendix \ref{maxsimplex}).52455246In the following we describe the basic steps of \verb|autotools| and \verb|cmake| for Linux 64 bit under certain standard assumptions. Comments on Mac OS follow in Section \ref{mac} The file \verb|INSTALL| in the directory \verb|source| contains more information. \verb|Makefile.classic| is only meant for Linux and the development of Normaliz.52475248The \verb|autotools| scripts have been written by Matthias K�ppe. The Normaliz team thanks him cordially for his generous help.52495250\subsection{Compiler prerequisites}52515252We require some C++11 features (e.g. \verb|std::exception_ptr|), supported by:5253\begin{itemize}5254\item GNU g++ 4.4,5255\item clang++ 2.9,5256\item Intel icpc 12.05257\end{itemize}5258See \url{https://github.com/Normaliz/Normaliz/issues/26} for a more detailed discussion.52595260The mentioned compilers are also able to handle OpenMP 3.0, with the exception of clang++, there the first OpenMP support was introduced in 3.7.52615262\subsection{Required libraries}52635264For compiling Normaliz the following libraries are needed:5265\begin{itemize}5266\item GMP including the C++ wrapper (libgmpxx and libgmp)5267\item Boost (headers only)5268\end{itemize}52695270We will only discuss the basic use of cmake for compilation, see the file \verb|source/INSTALL| for additional information, especially on how to use customized paths. Also the use of the \ttt{autotools} system is explained in this file. The ``classical'' Makefile is meant for development. Therefore you should use \verb|autotools| or \verb|cmake|.52715272The installation will store the files in standard locations, and we assume in the following that they do not need individual include paths.52735274\subsection{Optional packages}52755276As discussed in the manual, Normaliz can use SCIP. If you want5277to use it, SCIP must be installed before the compilation of Normaliz, independently of5278the method used for building Normaliz.52795280To build SCIP download the scipoptsuite at \url{http://scip.zib.de/}. Notice that SCIP5281is not distributed under GPL, but the ZIB Academic License (\url{http://scip.zib.de/academic.txt}).5282Unpack it and then compile it with5283\begin{Verbatim}5284make ZLIB=false GMP=false READLINE=false scipoptlib5285\end{Verbatim}52865287Another optional package is CoCoALib. It is necessary if you want to compute integrals or weighted Ehrhart series and, hence, for symmetrization. If you want to compile Normaliz with CoCoALib, install CoCoALib first.5288The following sequence of commands will install it in the subdirectory \verb|CoCoA| of your home directory.5289\begin{Verbatim}5290mkdir ~/CoCoA/5291cd ~/CoCoA/5292wget http://cocoa.dima.unige.it/cocoalib/tgz/CoCoALib-0.99550.tgz5293tar xvf CoCoALib-0.99550.tgz5294cd CoCoALib-0.995505295./configure --threadsafe-hack --no-boost5296make library -j25297\end{Verbatim}52985299If CoCoALib-0.99550 should be no longer available, replace it by a newer version.53005301\subsection{autotools}53025303To build Normaliz with the \verb|autotools| system, navigate to the Normaliz directory and issue the following sequence of commands:5304\begin{Verbatim}5305./configure5306make5307\end{Verbatim}5308This will compile Normaliz, but most likely without SCIP and CoCoALib since they are optional libraries mentioned above and must be found. If they are not located at standard places, you must specify their paths. Examples (on the machine of a Normaliz team member):5309\begin{Verbatim}5310./configure --with-scipoptsuite-src=$HOME/SCIP/scipoptsuite-3.2.0/5311\end{Verbatim}5312or5313\begin{Verbatim}5314./configure --with-cocoalib=$HOME/CoCoA/CoCoALib-0.995505315\end{Verbatim}5316or with both paths. If the libraries are found, Normaliz will be compiled with SCIP and CoCoALib, respectively, by the \verb|make| command. Check the terminal output of \verb|./configure| for success.53175318The next step is5319\begin{Verbatim}5320make5321\end{Verbatim}5322After this step you will find \verb|normaliz| in the directory \verb|source| (and \verb|maxsimplex| in its directory).53235324The last, optional step is5325\begin{Verbatim}5326sudo make install5327\end{Verbatim}5328It copies the header files, the library \verb|libnormaliz| and the executables (except \verb|maxsimplex|) into subdirectories of \verb|/usr/local|. It is of course possible to specify another installation path in the call of \verb|./configure|.53295330Note: In case you have checked out Normaliz from GitHub, the very first step is \verb|./bootstrap.sh|.53315332Unfortunately, the paths for SCIP are version dependent. We have tested versions 3.2.0 and 3.2.1.53335334\subsection{cmake}\label{cmake}53355336You may need to install \verb|cmake| first:5337\begin{Verbatim}5338sudo apt-get cmake cmake-curses-gui5339\end{Verbatim}53405341To build Normaliz with \verb|cmake|, start by creating a build directory within the Normaliz directory, say \verb|BUILD|. Then change the working directory to \verb|BUILD|.53425343The basic configuration (equivalent to \verb|configure| of \verb|autotools|) is5344\begin{Verbatim}5345cmake ../source5346\end{Verbatim}5347Then \verb|make| and \verb|make install| will complete the basic installation.53485349For the inclusion of SCIP, use (for example)5350\begin{Verbatim}5351SCIP_DIR=$HOME/SCIP/scipoptsuite-3.2.0/ cmake ../source5352\end{Verbatim}5353replacing \verb|$HOME/SCIP/scipoptsuite-3.2.0/| with your own path to SCIP if necessary. Similarly,5354\begin{Verbatim}5355COCOA_DIR=$HOME/CoCoA/CoCoALib-0.99550 cmake ../source/5356\end{Verbatim}5357Then \verb|make| and \verb|make install| will complete the work. After \verb|make| the executables can be found in \verb|BUILD| and its subdirectory \verb|maxsimplex|.53585359The main advantage of \verb|cmake| is the existence of a GUI in which you can change most settings originally chosen by \verb|cmake|. Call \verb|ccmake ../source| (2 times c) or, for a more sophisticated version, \verb|cmake-gui ../source|.53605361Note: Unfortunately, the paths for SCIP are version dependent. The configuration files for SCIP presently can find the versions 3.2.0 and 3.2.1. For another version you must edit the file \verb|FindSCIP.cmake| in \verb|source/cmake/Modules|.536253635364\subsection{Mac OS X}\label{mac}53655366Currently Apple does not supply a compiler which supports OpenMP.5367We recommend the use of LLVM 3.9 or newer from Homebrew. See5368\url{http://brew.sh/} from where you can also download GMP and Boost. For details see \ttt{INSTALL} in the directory \ttt{source} of the distribution.53695370For building Normaliz under Mac OS we recommend autotools if you want to use SCIP.53715372You can then follow the instructions for Linux.53735374Note: Do not try to compile Normaliz with static libraries for Mac OS X.53755376\subsection{Windows}53775378One can compile Windows executables with the Cygwin port of GCC. Unfortunately it is not compatible to OpenMP.53795380Using Visual Studio is a bit tricky. Microsoft's C++ compiler does not support OpenMP 3.0. Creating a Normaliz Visual Studio project via cmake is currently not fully supported. The executables that are offered in the Normaliz distribution have been compiled with Intel icpc and a manually created project. Please contact us if you want to build Normaliz on Windows.53815382Note that the statically linked Linux binaries run in the Linux subsystem of Windows 10. We have not yet tried to build Normaliz in it.53835384\section{Copyright and how to cite}53855386Normaliz 3.1 is free software licensed under the GNU General5387Public License, version 3. You can redistribute it and/or5388modify it under the terms of the GNU General Public License as5389published by the Free Software Foundation, either version 3 of5390the License, or (at your option) any later version.53915392It is distributed in the hope that it will be useful, but5393WITHOUT ANY WARRANTY; without even the implied warranty of5394MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5395GNU General Public License for more details.53965397You should have received a copy of the GNU General Public5398License along with the program. If not, see5399\url{http://www.gnu.org/licenses/}.54005401Please refer to Normaliz in any publication for which it has5402been used:5403\begin{center}5404W. Bruns, B. Ichim, T. R�mer, R. Sieg and C. S�ger: Normaliz. Algorithms for5405rational cones and affine monoids. Available at5406\url{http://normaliz.uos.de}5407\end{center}5408The corresponding \verb|\bibitem|:5409\begin{Verbatim}5410\bibitem{Normaliz} W. Bruns, B. Ichim, T. R\"omer, R. Sieg and C. S\"oger:5411Normaliz. Algorithms for rational cones and affine monoids.5412Available at \url{http://normaliz.uos.de}.5413\end{Verbatim}54145415A BibTeX entry:5416\begin{Verbatim}5417@Misc{Normaliz,5418author = {W. Bruns and B. Ichim and T. R\"omer and R. Sieg and C. S\"oger},5419title = Normaliz. Algorithms for rational cones and affine monoids,5420howpublished ={Available at \url{http://normaliz.uos.de}}5421\end{Verbatim}54225423It is now customary to evaluate mathematicians by such data as5424numbers of publications, citations and impact factors. The data5425bases on which such dubious evaluations are based do not list5426mathematical software. Therefore we ask you to cite the article5427\cite{BIS} in addition. This is very helpful for the younger5428members of the team.54295430\newpage54315432\appendix54335434\section{Mathematical background and terminology}54355436For a coherent and thorough treatment of the mathematical background we refer the reader to \cite{BG}.54375438\subsection{Polyhedra, polytopes and cones}54395440An \emph{affine halfspace} of $\RR^d$ is a subset given as5441$$5442H_\lambda^+=\{x: \lambda(x)\ge 0\},5443$$5444where $\lambda$ is an affine form, i.e., a non-constant map $\lambda:\RR^d\to\RR$, $\lambda(x)=\alpha_1x_1+\dots+\alpha_dx_d+\beta$ with $\alpha_1,\dots,\alpha_d,\beta\in\RR$. If $\beta=0$ and $\lambda$ is therefore linear, then the halfspace is called \emph{linear}. The halfspace is \emph{rational} if $\lambda$ is \emph{rational}, i.e., has rational coordinates. If $\lambda$ is rational, we can assume that it is even \emph{integral}, i.e., has integral coordinates, and, moreover, that these are coprime. Then $\lambda$ is uniquely determined by $H_\lambda^+$. Such integral forms are called \emph{primitive}, and the same terminology applies to vectors.54455446\begin{definition}5447A (rational) \emph{polyhedron} $P$ is the intersection of finitely many (rational) halfspaces. If it is bounded, then it is called a \emph{polytope}. If all the halfspaces are linear, then $P$ is a \emph{cone}.54485449The \emph{dimension} of $P$ is the dimension of the smallest affine subspace $\aff(P)$ containing $P$.5450\end{definition}545154525453A support hyperplane of $P$ is an affine hyperplane $H$ that intersects $P$, but only in such a way that $H$ is contained in one of the two halfspaces determined by $H$. The intersection $H\cap P$ is called a \emph{face} of $P$. It is a polyhedron (polytope, cone) itself. Faces of dimension $0$ are called \emph{vertices}, those of dimension $1$ are called \emph{edges} (in the case of cones \emph{extreme rays}), and those of dimension $\dim(P)-1$ are \emph{facets}.54545455When we speak of \emph{the} support hyperplanes of $P$, then we mean those intersecting $P$ in a facet. Their halfspaces containing $P$ cut out $P$ from $\aff(P)$. If $\dim(P)=d$, then they are uniquely determined (up to a positive scalar).54565457The constraints by which Normaliz describes polyhedra are5458\begin{arab}5459\item linear equations for $\aff(P)$ and5460\item linear inequalities (simply called support hyperplanes) cutting out $P$ from $\aff(P)$.5461\end{arab}5462In other words, the constraints are given by a linear system of equations and inequalities, and a polyhedron is nothing else than the solution set of a linear system of inequalities and equations. It can always be represented in the form5463$$5464Ax\ge b, \qquad A\in\RR^{m\times d}, b\in \RR^m,5465$$5466if we replace an equation by two inequalities.54675468\subsection{Cones}54695470The definition describes a cone by constraints. One can equivalently describe it by generators:54715472\begin{theorem}[Minkowski-Weyl]5473The following are equivalent for $C\subset\RR^d$;5474\begin{enumerate}5475\item $C$ is a (rational) cone;5476\item there exist finitely many (rational) vectors $x_1,\dots,x_n$ such that5477$$5478C=\{a_1x_1+\dots+a_nx_n:a_1,\dots,a_n\in\RR_+\}.5479$$5480\end{enumerate}5481\end{theorem}54825483By $\RR_+$ we denote the set of nonnegative real numbers; $\QQ_+$ and $\ZZ_+$ are defined in the same way.54845485The conversion between the description by constraints and that by generators is one of the basic tasks of Normaliz. It uses the \emph{Fourier-Motzkin elimination}.54865487Let $C_0$ be the set of those $x\in C$ for which $-x\in C$ as well. It is the largest vector subspace contained in $C$.5488A cone is \emph{pointed} if $C_0=0$. If a rational cone is pointed, then it has uniquely determined \emph{extreme integral generators}. These are the primitive integral vectors spanning the extreme rays. These can also be defined with respect to a sublattice $L$ of $\ZZ^d$, provided $C$ is contained in $\RR L$. If a cone is not pointed, then Normaliz computes the extreme rays of the pointed $C/C_0$ and lifts them to $C$. (Therefore they are only unique modulo $C_0$.)54895490The \emph{dual cone} $C^*$ is given by5491$$5492C^*=\{\lambda\in (\RR^d)^*:\lambda(x)\ge0 \text{ for all } x\in C\}.5493$$5494Under the identification $\RR^d=(\RR^d)^{**}$ one has $C^{**}=C$. Then one has5495$$5496\dim C_0+\dim C^*=d.5497$$5498In particular, $C$ is pointed if and only if $C^*$ is full dimensional, and this is the criterion for pointedness used by Normaliz. Linear forms $\lambda_1,\dots,\lambda_n$ generate $C^*$ if and only if $C$ is the intersection of the halfspaces $H_{\lambda_i}^+$. Therefore the conversion from constraints to generators and its converse are the same task, except for the exchange of $\RR^d$ and its dual space.54995500\subsection{Polyhedra}55015502In order to transfer the Minkowski-Weyl theorem to polyhedra it is useful to homogenize coordinates by embedding $\RR^d$ as a hyperplane in $\RR^{d+1}$, namely via5503$$5504\kappa:\RR^d\to\RR^{d+1},\qquad \kappa(x)=(x,1).5505$$5506If $P$ is a (rational) polyhedron, then the closure of the union of the rays from $0$ through the points of $\kappa(P)$ is a (rational) cone $C(P)$, called the \emph{cone over} $P$. The intersection $C(P)\cap(\RR^d\times\{0\})$ can be identified with the \emph{recession} (or tail) \emph{cone}5507$$5508\rec(P)=\{x\in\RR^d: y+x\in P\text{ for all } y\in P\}.5509$$5510It is the cone of unbounded directions in $P$. The recession cone is pointed if and only if $P$ has at least one bounded face, and this is the case if and only if it has a vertex.55115512The theorem of Minkowski-Weyl can then be generalized as follows:55135514\begin{theorem}[Motzkin]5515The following are equivalent for a subset $P\neq\emptyset$ of $\RR^d$:5516\begin{enumerate}5517\item $P$ is a (rational) polyhedron;5518\item $P=Q+C$ where $Q$ is a (rational) polytope and $C$ is a (rational) cone.5519\end{enumerate}5520If $P$ has a vertex, then the smallest choice for $Q$ is the convex hull of its vertices, and $C=\rec(P)$ is uniquely determined.5521\end{theorem}55225523The \emph{convex hull} of a subset $X\in\RR^d$ is5524$$5525\conv(X)=\{a_1x_1+\dots+a_nx_n: n\ge 1, x_1,\dots,x_n\in X, a_1,\dots,a_n\in\RR_+, a_1+\dots+a_n=1\}.5526$$55275528Clearly, $P$ is a polytope if and only if $\rec(P)=\{0\}$, and the specialization to this case one obtains Minkowski's theorem: a subset $P$ of $\RR^d$ is a polytope if and only if it is the convex hull of a finite set. A \emph{lattice polytope} is distinguished by having integral points as vertices.55295530Normaliz computes the recession cone and the polytope $Q$ if $P$ is defined by constraints. Conversely it finds the constraints if the vertices of $Q$ and the generators of $C$ are specified.55315532Suppose that $P$ is given by a system5533$$5534Ax\ge b, \qquad A\in\RR^{m\times d},\ b\in \RR^m,5535$$5536of linear inequalities (equations are replaced by two inequalities). Then $C(P)$ is defined by the \emph{homogenized system}5537$$5538Ax-x_{d+1}b\ge 05539$$5540whereas the $\rec(P)$ is given by the \emph{associated homogeneous system}5541$$5542Ax\ge 0.5543$$55445545It is of course possible that $P$ is empty if it is given by constraints since inhomogeneous systems of linear equations and inequalities may be unsolvable. By abuse of language we call the solution set of the associated homogeneous system the recession cone of the system.55465547Via the concept of dehomogenization, Normaliz allows for a more general approach. The \emph{dehomogenization} is a linear form $\delta$ on $\RR^{d+1}$. For a cone $\widetilde C$ in $\RR^{d+1}$ and a dehomogenization $\delta$, Normaliz computes the polyhedron $P=\{x\in \widetilde C: \delta(x)=1\}$ and the recession cone $C=\{x\in \widetilde C: \delta(x)=0\}$. In particular, this allows other choices of the homogenizing coordinate. (Often one chooses $x_0$, the first coordinate then.)55485549In the language of projective geometry, $\delta(x)=0$ defines the hyperplane at infinity.55505551\subsection{Affine monoids}55525553An \emph{affine monoid} $M$ is a finitely generated submonoid of $\ZZ^d$ for some $d\ge0$. This means: $0\in M$, $M+M\subset M$, and there exist $x_1,\dots,x_n$ such that5554$$5555M=\{a_1x_1+\dots+a_nx_n: a_1,\dots,a_n\in\ZZ_+\}.5556$$5557We say that $x_1,\dots,x_n$ is a \emph{system of generators} of $M$. A monoid $M$ is positive if $x\in M$ and $-x\in M$ implies $x=0$. An element $x$ in a positive monoid $M$ is called \emph{irreducible} if it has no decomposition $x=y+z$ with $y,z\in M$, $y,z\neq0$. The \emph{rank} of $M$ is the rank of the subgroup $\gp(M)$ of $\ZZ^d$ generated by $M$. (Subgroups of $\ZZ^d$ are also called sublattices.)5558For certain aspects of monoid theory it is very useful (or even necessary) to introduce coefficients from a field $K$ (or a more general commutative ring) and consider the monoid algebra $K[M]$.555955605561\begin{theorem}[van der Corput]5562Every positive affine monoid $M$ has a unique minimal system of generators, given by its irreducible elements.5563\end{theorem}55645565We call the minimal system of generators the \emph{Hilbert basis} of $M$. Normaliz computes Hilbert bases of a special type of affine monoid:55665567\begin{theorem}[Gordan's lemma]5568Let $C\subset\RR^d$ be a (pointed) rational cone and let $L\subset \ZZ^d$ be a sublattice. Then $C\cap L$ is a (positive) affine monoid.5569\end{theorem}55705571The monoids $M=C\cap L$ of the theorem have the pleasant property that the group of units $M_0$ (i.e., elements whose inverse also belongs to $M$) splits off as a direct summand. Therefore $M/M_0$ is a well-defied affine monoid. If $M$ is not positive, then Normaliz computes a Hilbert basis of $M/M_0$ and lifts it to $M$.55725573Let $M\subset \ZZ^d$ be an affine monoid, and let $N\supset M$ be an overmonoid (not necessarily affine), for example a sublattice $L$ of $\ZZ^d$ containing $M$.55745575\begin{definition}5576The \emph{integral closure} (or \emph{saturation}) of $M$ in $N$ is the set5577$$5578\widehat M_N=\{x\in N: kx\in M \text{ for some } k\in \ZZ, k>0\}.5579$$5580If $\widehat M_N=M$, one calls $M$ \emph{integrally closed} in $N$.55815582The integral closure $\overline M$ of $M$ in $\gp(M)$ is its \emph{normalization}. $M$ is \emph{normal} if $\overline M=M$.5583\end{definition}55845585The integral closure has a geometric description:55865587\begin{theorem}\label{incl_cone}5588$$5589\widehat M_N =\cone(M)\cap N.5590$$5591\end{theorem}55925593Combining the theorems, we can say that Normaliz computes integral closures of affine monoids in lattices, and the integral closures are themselves affine monoids as well. (More generally, $\widehat M_N$ is affine if $M$ and $N$ are affine.)55945595In order to specify the intersection $C\cap L$ by constraints we need a system of homogeneous inequalities for $C$. Every sublattice of $\ZZ^d$ can be written as the solution set of a combined system of homogeneous linear diophantine equations and a homogeneous system of congruences (this follows from the elementary divisor theorem). Thus $C\cap L$ is the solution set of a homogeneous linear diophantine system of inequalities, equations and congruences. Conversely, the solution set of every such system is a monoid of type $C\cap L$.55965597In the situation of Theorem \ref{incl_cone}, if $\gp(N)$ has finite rank as a $\gp(M)$-module, $\widehat M_N$ is even a finitely generated module over $M$. I.e., there exist finitely many elements $y_1,\dots,y_m\in \widehat M_N$ such that $\widehat M_N=\bigcup_{i=1}^m M+y_i$. Normaliz computes a minimal system $y_1,\dots,y_m$ and lists the nonzero $y_i$ as a system of module generators of $\widehat M_N$ modulo $M$. We must introduce coefficients to make this precise: Normaliz computes a minimal system of generators of the $K[M]$-module $K[\widehat M_N]/K[M]$.55985599\subsection{Affine monoids from binomial ideals}\label{binomials}56005601Let $U$ be a subgroup of $\ZZ^n$. Then the natural image $M$ of5602$\ZZ_+^n\subset\ZZ^n$ in the abelian group $G=\ZZ^n/U$ is a5603submonoid of $G$. In general, $G$ is not torsionfree, and5604therefore $M$ may not be an affine monoid. However, the image5605$N$ of $M$ in the lattice $L=G/\textup{torsion}(G)$ is an affine5606monoid. Given $U$, Normaliz chooses an embedding5607$L\hookrightarrow\ZZ^r$, $r=n-\rank U$, such that $N$ becomes a5608submonoid of $\ZZ_+^r$. In general there is no canonical choice5609for such an embedding, but one can always find one, provided5610$N$ has no invertible element except $0$.56115612The typical starting point is an ideal $J\subset5613K[X_1,\dots,X_n]$ generated by binomials5614$$5615X_1^{a_1}\cdots X_n^{a_n}-X_1^{b_1}\cdots X_n^{b_n}.5616$$5617The image of $K[X_1,\dots,X_n]$ in the residue class ring of5618the Laurent polynomial ring $S=K[X_1^{\pm1},\dots,X_n^{\pm1}]$5619modulo the ideal $JS$ is exactly the monoid algebra $K[M]$ of5620the monoid $M$ above if we let $U$ be the subgroup of $\ZZ^n$5621generated by the differences5622$$5623(a_1,\dots,a_n)-(b_1,\dots,b_n).5624$$56255626Ideals of type $JS$ are called lattice ideals if they are5627prime. Since Normaliz automatically passes to5628$G/\textup{torsion}(G)$, it replaces $JS$ by the smallest lattice5629ideal containing it.56305631\subsection{Lattice points in polyhedra}\label{latt_hedra}56325633Let $P\subset \RR^d$ be a rational polyhedron and $L\subset \ZZ^d$ be an \emph{affine sublattice}, i.e., a subset $w+L_0$ where $w\in\ZZ^d$ and $L_0\subset \ZZ^d$ is a sublattice. In order to investigate (and compute) $P\cap L$ one again uses homogenization: $P$ is extended to $C(P)$ and $L$ is extended to $\cL=L_0+\ZZ(w,1)$. Then one computes $C(P)\cap \cL$. Via this ``bridge'' one obtains the following inhomogeneous version of Gordan's lemma:56345635\begin{theorem}5636Let $P$ be a rational polyhedron with vertices and $L=w+L_0$ an affine lattice as above. Set $\rec_L(P)=\rec(P)\cap L_0$. Then there exist $x_1,\dots,x_m\in P\cap L$ such that5637$$5638P\cap L=\{(x_1+\rec_L(P))\cap\dots\cap(x_m+\rec_L(P))\}.5639$$5640If the union is irredundant, then $x_1,\dots,x_m$ are uniquely determined.5641\end{theorem}56425643The Hilbert basis of $\rec_L(P)$ is given by $\{x: (x,0)\in \Hilb(C(P)\cap\cL)\}$ and the minimal system of generators can also be read off the Hilbert basis of $C(P)\cap \cL$: it is given by those $x$ for which $(x,1)$ belongs to $\Hilb(C(P)\cap\cL)$. (Normaliz computes the Hilbert basis of $C(P)\cap L$ only at ``levels'' $0$ and $1$.)56445645We call $\rec_L(P)$ the \emph{recession monoid} of $P$ with respect to $L$ (or $L_0$). It is justified to call $P\cap L$ a \emph{module} over $\rec_L(P)$. In the light of the theorem, it is a finitely generated module, and it has a unique minimal system of generators.56465647After the introduction of coefficients from a field $K$, $\rec_L(P)$ is turned into an affine monoid algebra, and $N=P\cap L$ into a finitely generated torsionfree module over it. As such it has a well-defined \emph{module rank} $\mrank(N)$, which is computed by Normaliz via the following combinatorial description: Let $x_1,\dots,x_m$ be a system of generators of $N$ as above; then $\mrank(N)$ is the cardinality of the set of residue classes of $x_1,\dots,x_m$ modulo $\rec_L(P)$.56485649Clearly, to model $P\cap L$ we need linear diophantine systems of inequalities, equations and congruences which now will be inhomogeneous in general. Conversely, the set of solutions of such a system is of type $P\cap L$.565056515652\subsection{Hilbert series}56535654Normaliz can compute the Hilbert series and the Hilbert5655(quasi)polynomial of a graded monoid. A \emph{grading} of a5656monoid $M$ is simply a homomorphism $\deg:M\to\ZZ^g$ where5657$\ZZ^g$ contains the degrees. The \emph{Hilbert series} of $M$5658with respect to the grading is the formal Laurent series5659$$5660H(t)=\sum_{u\in \ZZ^g} \#\{x\in M: \deg x=u\}t_1^{u_1}\cdots t_g^{u_g}=\sum_{x\in M}t^{\deg x},5661$$5662provided all sets $\{x\in M: \deg x=u\}$ are finite. At the moment, Normaliz can only handle the case $g=1$, and therefore we restrict ourselves to this case. We assume in the following that $\deg x >0$ for all nonzero $x\in M$ and that there exists an $x\in\gp(M)$ such that $\deg x=1$. (Normaliz always rescales the grading accordingly.) In the case of a nonpositive monoid, these conditions must hold for $M/M_0$, and its Hilbert series is considered as the Hilbert series of $M$.56635664The basic fact about $H(t)$ in the $\ZZ$-graded case is that it5665is the Laurent expansion of a rational function at the origin:5666\begin{theorem}[Hilbert, Serre; Ehrhart]5667Suppose that $M$ is a normal positive affine monoid. Then5668$$5669H(t)=\frac{R(t)}{(1-t^e)^r},\qquad R(t)\in\ZZ[t], %\label{raw}5670$$5671where $r$ is the rank of $M$ and $e$ is the least common multiple5672of the degrees of the extreme integral generators of $\cone(M)$. As a rational function, $H(t)$ has negative degree.5673\end{theorem}56745675The statement about the rationality of $H(t)$ holds under much more general hypotheses.56765677Usually one can find denominators for $H(t)$ of much lower5678degree than that in the theorem, and Normaliz tries to5679give a more economical presentation of $H(t)$ as a quotient of5680two polynomials. One should note that it is not clear what the5681most natural presentation of $H(t)$ is in general (when $e>1$).5682We discuss this problem in \cite[Section 4]{BIS}. The examples \ref{rational} and \ref{magiceven}, may serve as5683an illustration.56845685A rational cone $C$ and a grading together define the rational5686polytope $Q=C\cap A_1$ where $A_1=\{x:\deg x=1\}$. In this5687sense the Hilbert series is nothing but the Ehrhart series of5688$Q$.5689The following description of the Hilbert function $H(M,k)=\#\{x\in M: \deg x=k\}$ is equivalent to the previous theorem:56905691\begin{theorem}5692There exists a quasipolynomial $q$ with rational coefficients, degree $\rank M-1$ and period $\pi$ dividing $e$ such that $H(M,k)=q(k)$ for all $q\ge0$.5693\end{theorem}56945695The statement about the quasipolynomial means that there exist5696polynomials $q^{(j)}$, $j=0,\dots,\pi-1$, of degree $\rank M-1$ such that5697$$5698q(k)=q^{(j)}(k),\qquad j\equiv k\pod \pi,5699$$5700and5701$$5702q^{(j)}(k)=q^{(j)}_0+q^{(j)}_1k+\dots+q^{(j)}_{r-1}k^{r-1},\qquad r=\rank M,5703$$5704with coefficients $q^{(j)}_i\in \QQ$. It is not hard to show that in the case of affine monoids all components have the same degree $r-1$ and the same leading coefficient:5705$$5706q_{r-1}=\frac{\vol(Q)}{(r-1)!},5707$$5708where $\vol$ is the lattice normalized volume of $Q$ (a lattice simplex of smallest possible volume has volume $1$). The \emph{multiplicity} of $M$, denoted by $e(M)$ is $(r-1)!q_{r-1}=\vol(Q)$.57095710Suppose now that $P$ is a rational polyhedron in $\RR^d$, $L\subset\ZZ^d$ is an affine lattice, and we consider $N=P\cap L$ as a module over $M=\rec_L(P)$. Then we must give up the condition that $\deg$ takes the value $1$ on $\gp(M)$ (see Section \ref{sdqm} for an example). But the Hilbert series5711$$5712H_N(t)=\sum_{x\in N} t^{\deg x}5713$$5714is well-defined, and the qualitative statement above about rationality remain valid. However, in general the quasipolynomial gives the correct value of the Hilbert function only for $k>r$ where $r$ is the degree of the Hilbert series as a rational function.57155716Let $m$ be the gcd of the numbers $\deg x$, $x\in M$. (For $M=\{0\}$ we set $m=1$.) Then we must define $e(M)=e'(M)/m$ where $e'(M)$ is the multiplicity of $M$ with respect to the normalized grading $\deg/m$. The multiplicity of $N$ is given by5717$$5718e(N)=\mrank(N)e(M).5719$$57205721Since $N$ may have generators in negative degrees, Normaliz shifts the degrees into $\ZZ_+$ by subtracting a constant, called the \emph{shift}. (The shift may also be positive.)57225723\subsection{The class group}57245725A normal affine monoid $M$ has a well-defined divisor class group. It is naturally isomorphic to the divisor class group of $K[M]$ where $K$ is a field (or any unique factorization domain); see \cite[4.F]{BG}, and especially \cite[4.56]{BG}. The class group classifies the divisorial ideals up to isomorphism. It can be computed from the standard embedding that sends an element $x$ of $\gp(M)$ to the vector $\sigma(x)$ where $\sigma$ is the collection of support forms $\sigma_1,\dots,\sigma_s$ of $M$: $\Cl(M)=\ZZ^s/\sigma(\gp(M))$. Finding this quotient amounts to an application of the Smith normal form to the matrix of $\sigma$.5726572757285729\section{Annotated console output}\label{Console}57305731\subsection{Primal mode}57325733With5734\begin{Verbatim}5735./normaliz -ch example/A4435736\end{Verbatim}5737we get the following terminal output.57385739\begin{Verbatim}5740\.....|5741Normaliz 3.2.0 \....|5742\...|5743(C) The Normaliz Team, University of Osnabrueck \..|5744January 2017 \.|5745\|5746************************************************************5747Command line: -ch example/A4435748Compute: HilbertBasis HilbertSeries5749************************************************************5750starting primal algorithm with full triangulation ...5751Roughness 15752Generators sorted by degree and lexicographically5753Generators per degree:57541: 485755\end{Verbatim}5756Self explanatory so far (see Section \ref{bottom_dec} for the definition of roughness). Now the generators are inserted.5757\begin{Verbatim}5758Start simplex 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 19 22 25 26 27 28 31 34575937 38 39 40 43 465760\end{Verbatim}5761Normaliz starts by searching linearly independent generators with indices as small as possible. They span the start simplex in the triangulation. The remaining generators are inserted successively. (If a generator does not increase the cone spanned by the previous ones, it is not listed, but this does not happen for \verb|A443|.)5762\begin{Verbatim}5763gen=17, 39 hyp, 4 simpl5764\end{Verbatim}5765We have now reached a cone with $39$ support hyperplanes and the triangulation has $4$ simplices so far. We omit some generators until something interesting happens:5766\begin{Verbatim}5767gen=35, 667 hyp, 85 pyr, 13977 simpl5768\end{Verbatim}5769In view of the number of simplices in the triangulation and the number of support hyperplanes, Normaliz has decided to build pyramids and to store them for later triangulation.5770\begin{Verbatim}5771gen=36, 723 hyp, 234 pyr, 14025 simpl5772...5773gen=48, 4948 hyp, 3541 pyr, 14856 simpl5774\end{Verbatim}5775All generators have been processed now. Fortunately our cone is pointed:5776\begin{Verbatim}5777Pointed since graded5778Select extreme rays via comparison ... done.5779\end{Verbatim}5780Normaliz knows two methods for finding the extreme rays. Instead of ``comparison'' you may see ``rank''.5781Now the stored pyramids must be triangulated. They may produce not only simplices, but also pyramids of higher level, and indeed they do so:5782\begin{Verbatim}5783**************************************************5784level 0 pyramids remaining: 35415785**************************************************5786**************************************************5787all pyramids on level 0 done!5788**************************************************5789level 1 pyramids remaining: 59355790**************************************************5791**************************************************5792all pyramids on level 1 done!5793**************************************************5794level 2 pyramids remaining: 15675795**************************************************57961180 pyramids remaining on level 2, evaluating 2503294 simplices5797\end{Verbatim}5798At this point the preset size of the evaluation buffer for simplices has been exceeded. Normaliz stops the processing of pyramids, and empties the buffer by evaluating the simplices.5799\begin{Verbatim}5800||||||||||||||||||||||||||||||||||||||||||||||||||58012503294 simplices, 0 HB candidates accumulated.5802**************************************************5803all pyramids on level 2 done!5804**************************************************5805level 3 pyramids remaining: 1005806**************************************************5807**************************************************5808all pyramids on level 3 done!5809\end{Verbatim}5810This is a small computation, and the computation of pyramids goes level by level without the necessity to return to a lower level. But in larger examples the buffer for level $n+1$ may be filled before level $n$ is finished. Then it becomes necessary to go back. Some simplices remaining in the buffer are now evaluated:5811\begin{Verbatim}5812evaluating 150978 simplices5813||||||||||||||||||||||||||||||||||||||||||||||||||58142654272 simplices, 0 HB candidates accumulated.5815Adding 1 denominator classes... done.5816\end{Verbatim}5817Since our generators form the Hilbert basis, we do not collect any further candidates. If all generators are in degree $1$, we have only one denominator class in the Hilbert series, but otherwise there may be many. The collection of the Hilbert series in denominator classes reduces the computations of common denominators to a minimum.5818\begin{Verbatim}5819Total number of pyramids = 14137, among them simplicial 29945820\end{Verbatim}5821Some statistics of the pyramid decomposition.5822\begin{Verbatim}5823------------------------------------------------------------5824transforming data... done.5825\end{Verbatim}5826Our computation is finished.58275828A typical pair of lines that you will see for other examples is5829\begin{Verbatim}5830auto-reduce 539511 candidates, degrees <= 1 3 75831reducing 30 candidates by 73521 reducers5832\end{Verbatim}5833It tells you that Normaliz has found a list of $539511$ new candidates for the Hilbert basis, and this list is reduced against itself (auto-reduce). Then the $30$ old candidates are reduced against the $73521$ survivors of the auto-reduction.58345835\subsection{Dual mode}58365837Now we give an example of a computation in dual mode. It is started by the command5838\begin{Verbatim}5839./normaliz -cid example/5x55840\end{Verbatim}5841The option \verb|i| is used to suppress the \verb|HSOP| in the input file. The console output:58425843\begin{Verbatim}5844\.....|5845Normaliz 3.2.0 \....|5846\...|5847(C) The Normaliz Team, University of Osnabrueck \..|5848January 2017 \.|5849\|5850************************************************************5851Command line: -cid example/5x55852Compute: DualMode5853No inequalities specified in constraint mode, using non-negative orthant.5854************************************************************5855\end{Verbatim}5856Indeed, we have used only equations as the input.5857\begin{Verbatim}5858************************************************************5859computing Hilbert basis ...5860==================================================5861cut with halfspace 1 ...5862Final sizes: Pos 1 Neg 1 Neutral 05863\end{Verbatim}5864The cone is cut out from the space of solutions of the system of equations (in this case) by successive intersections with halfspaces defined by the inequalities. After such an intersection we have the positive half space, the ``neutral'' hyperplane and the negative half space. The final sizes given are the numbers of Hilbert basis elements strictly in the positive half space, strictly in the negative half space, and in the hyperplane. This pattern is repeated until all hyperplanes have been used.5865\begin{Verbatim}5866==================================================5867cut with halfspace 2 ...5868Final sizes: Pos 1 Neg 1 Neutral 15869\end{Verbatim}5870We leave out some hyperplanes \dots5871\begin{Verbatim}5872==================================================5873cut with halfspace 20 ...5874auto-reduce 1159 candidates, degrees <= 13 275875Final sizes: Pos 138 Neg 239 Neutral 15925876==================================================5877cut with halfspace 21 ...5878Positive: 1027 Negative: 3675879..................................................5880Final sizes: Pos 1094 Neg 369 Neutral 10195881\end{Verbatim}5882Sometimes reduction takes some time, and then Normaliz may issue a message on ``auto-reduction'' organized by degree (chosen for the algorithm, not defined by the given grading). The line of dots is printed is the computation of new Hilbert basis candidates takes time, and Normaliz wants to show you that it is not sleeping. Normaliz shows you the number of positive and negative partners that must be pared produce offspring.5883\begin{Verbatim}5884==================================================5885cut with halfspace 25 ...5886Positive: 1856 Negative: 6535887..................................................5888auto-reduce 1899 candidates, degrees <= 19 395889Final sizes: Pos 1976 Neg 688 Neutral 28525890\end{Verbatim}5891All hyperplanes have been taken care of.5892\begin{Verbatim}5893Find extreme rays5894Find relevant support hyperplanes5895\end{Verbatim}5896Well, in connection with the equations, some hyperplanes become superfluous. In the output file Normaliz will list a minimal set of support hyperplanes that together with the equations define the cone.5897\begin{Verbatim}5898Hilbert basis 48285899\end{Verbatim}5900The number of Hilbert basis elements computed is the sum of the last positive and neutral numbers.5901\begin{Verbatim}5902Find degree 1 elements5903\end{Verbatim}5904The input file contains a grading.5905\begin{Verbatim}5906transforming data... done.5907\end{Verbatim}5908Our example is finished.59095910The computation of the new Hilbert basis after the intersection with the new hyperplane proceeds in rounds, and there can be many rounds \dots (not in the above example). then you can see terminal output like5911\begin{Verbatim}5912Round 1005913Round 2005914Round 3005915Round 4005916Round 5005917\end{Verbatim}59185919\section{Normaliz 2 input syntax}\label{OldSyntax}59205921A Normaliz 2 input file contains a sequence of matrices. Comments or options are not allowed in it. A matrix has the format5922\begin{Verbatim}5923<m>5924<n>5925<x_1>5926...5927<x_m>5928<type>5929\end{Verbatim}5930where \verb|<m>| denotes the number of rows, \verb|<n>| is the number of columns and \verb|<x_1>...<x_n>| are the rows with \verb|<m>| entries each. All matrix types of Normaliz 3 are allowed (with Normaliz 3), also \verb|grading| and \verb|dehomogenization|. These vectors must be encoded as matrices with $1$ row.59315932The optional output files of with suffix \verb|cst| are still in this format. Just create one and inspect it.593359345935593659375938\section{libnormaliz}\label{libnorm}59395940\begin{small}59415942The kernel of Normaliz is the C++ class library \verb|libnormaliz|. It implements all the classes that are necessary for the computations. The central class is \verb|Cone|. It realizes the communication with the calling program and starts the computations most of which are implemented in other classes. In the following we describe the class \verb|Cone|; other classes of \verb|libnormaliz| may follow in the future.59435944Of course, Normaliz itself is the prime example for the use of \verb|libnormaliz|, but it is rather complicated because of the input and output it must handle. Therefore we have a added a simple example program at the end of this introduction.59455946\verb|libnormaliz| defines its own name space. In the following we assume that5947\begin{Verbatim}5948using namespace std;5949using namespace libnormaliz;5950\end{Verbatim}5951have been declared. It is clear that opening these name spaces is dangerous. In this documentation we only do it to avoid constant repetition of \verb|std::| and \verb|libnormaliz::|59525953\subsection{Integer type as a template parameter}59545955A cone can be constructed for two integer types, \verb|long long| and \verb|mpz_class|. It is reasonable to choose \verb|mpz_class| since the main computations will then be tried with \verb|long long| and restarted with \verb|mpz_class| if \verb|long long| cannot store the results. This internal change of integer type is not possible if the cone is constructed for \verb|long long|. (Nevertheless, the linear algebra routines can use \verb|mpz_class| locally if intermediate results exceed \verb|long long|; have a look into \verb|matrix.cpp|.)59565957Internally the template parameter is called \verb|Integer|. In the following we assume that the integer type has been fixed as follows:5958\begin{Verbatim}5959typedef mpz_class Integer;5960\end{Verbatim}59615962The internal passage from \verb|mpz_class| to \verb|long long| can be suppressed by5963\begin{Verbatim}5964MyCone.deactivateChangeOfPrecision();5965\end{Verbatim}5966where we assume that \verb|MyCone| has been constructed as described in the next section.59675968\subsubsection{Alternative integer types}59695970The predefined alternative to \verb|mpz_class| is \verb|long long|. It is possible to use libnormaliz with other integer types than \verb|mpz_class| or \verb|long long|, but we have tested only these types.59715972In an alternative configuration you have to include \verb|libnormaliz-all.cpp|. (In this case you do not need to link \verb|libnormaliz.a|). If you want to use other types, you probably have to implement some conversion functions which you can find in \verb|integer.h|. Namely the functions5973\begin{Verbatim}5974bool libnormaliz::try_convert(TypeA, TypeB);5975// converts TypeB to TypeA, returns false if not possible5976\end{Verbatim}5977where one type is your type and the other is \verb|long|, \verb|long long| or \verb|mpz_class|.5978Additionally, if your type uses infinite precision (for example, it is some wrapper for GMP), you must also implement5979\begin{Verbatim}5980template<> inline bool libnormaliz::using_GMP<YourType>() { return true; }5981\end{Verbatim}59825983\subsubsection{Decimal fractions and floating point numbers}59845985libnormaliz has a type \verb|nmz_float| (presently set to \verb|double|) that allows the input of decimal fractions and floating point numbers. Input data of type \verb|nmz_float| are first converted into \verb|mpq_class| by using the GMP constructor of \verb|mpq_class|.59865987\subsection{Construction of a cone}59885989The construction requires the specification of input data consisting of one or more matrices and the input types they represent.59905991The term ``matrix'' stands for5992\begin{Verbatim}5993vector<vector<Integer> >5994\end{Verbatim}59955996The available input types (from \verb|libnormaliz.h|) are defined as follows:5997\begin{Verbatim}5998namespace Type {5999enum InputType {6000integral_closure,6001polyhedron,6002normalization,6003polytope,6004rees_algebra,6005inequalities,6006strict_inequalities,6007signs,6008strict_signs,6009equations,6010congruences,6011inhom_inequalities,6012dehomogenization,6013inhom_equations,6014inhom_congruences,6015lattice_ideal,6016grading,6017excluded_faces,6018lattice,6019saturation,6020cone,6021offset,6022vertices,6023support_hyperplanes,6024cone_and_lattice,6025subspace,6026open_facets6027};6028} //end namespace Type6029\end{Verbatim}6030The input types are explained in Section \ref{input}. In certain environments it is not possible to use the enumeration. Therefore we provide a function that converts a string into the corresponding input type:6031\begin{Verbatim}6032Type::InputType to_type(const string& type_string)6033\end{Verbatim}60346035The types \verb|grading|, \verb|dehomogenization|, \verb|offset|and \verb|open_facets| must be encoded as matrices with a single row. We come back to this point below.60366037The simplest constructor has the syntax6038\begin{Verbatim}6039Cone<Integer>::Cone(InputType input_type, const vector< vector<Integer> >& Input)6040\end{Verbatim}6041and can be used as in the following example:6042\begin{Verbatim}6043vector<vector <Integer> > Data = ...6044Type::InputType type = cone;6045Cone<Integer> MyCone = Cone<Integer>(type, Data);6046\end{Verbatim}6047For two and three pairs of type and matrix there are the constructors6048\begin{Verbatim}6049Cone<Integer>::Cone(InputType type1, const vector< vector<Integer> >& Input1,6050InputType type2, const vector< vector<Integer> >& Input2)60516052Cone<Integer>::Cone(InputType type1, const vector< vector<Integer> >& Input1,6053InputType type2, const vector< vector<Integer> >& Input2,6054InputType type3, const vector< vector<Integer> >& Input3)6055\end{Verbatim}60566057If you have to combine more than three matrices, you can define a6058\begin{Verbatim}6059map <InputType, vector< vector<Integer> > >6060\end{Verbatim}6061and use the constructor with syntax6062\begin{Verbatim}6063Cone<Integer>::Cone(const map< InputType,6064vector< vector<Integer> > >& multi_input_data)6065\end{Verbatim}60666067The four constructors also exist in a variant that uses the \verb|libnormaliz| type \verb|Matrix<Integer>| instead of \verb|vector< vector<Integer> >| (see \verb|cone.h|).60686069For the input of rational numbers we have all constructors also in variants that use \verb|mpq_class| for the input matrix, for example6070\begin{Verbatim}6071Cone<Integer>::Cone(InputType input_type, const vector< vector<mpq_class> >& Input)6072\end{Verbatim}6073etc.60746075Similarly, for the input of decimal fractions and floating point numbers we have all constructors also in variants that use \verb|nmz_float| for the input matrix, for example6076\begin{Verbatim}6077Cone<Integer>::Cone(InputType input_type, const vector< vector<nmz_float> >& Input)6078\end{Verbatim}6079etc.60806081For convenience we provide the function6082\begin{Verbatim}6083vector<vector<T> > to_matrix<Integer>(vector<T> v)6084\end{Verbatim}6085in \verb|matrix.h|. It returns a matrix whose first row is \verb|v|. A typical example:6086\begin{Verbatim}6087size_t dim = ...6088vector<vector <Integer> > Data = ...6089Type::InputType type = cone;6090vector<Integer> total_degree(dim,1);6091Type::InputType grad = grading;6092Cone<Integer> MyCone = Cone<Integer>(type, Data,grad,to_matrix(total_degree));6093\end{Verbatim}60946095There is a default constructor for cones,6096\begin{Verbatim}6097Cone<Integer>::Cone()6098\end{Verbatim}60996100\subsubsection{Setting the polynomial}61016102The polynomial needed for integrals and weighted Ehrhart series must be passed to the cone after construction:6103\begin{Verbatim}6104void Cone<Integer>::setPolynomial(string poly)6105\end{Verbatim}61066107\subsubsection{Setting the number of significant coefficients of the quasipolynomial}61086109This is done by6110\begin{Verbatim}6111void Cone<Integer>::setNrCoeffQuasiPol(long nr_coeff)6112\end{Verbatim}6113The default value of \verb|nr_coeff| is $-1$, signaling `all coefficients''.611461156116\subsection{Computations in a cone}61176118Before starting a computation in a (previously constructed) cone, one must decide what should be computed and in which way it should be computed. The computation goals and algorithmic variants (see Section \ref{Goals}) are defined as follows (\verb|cone_property.h|):6119\begin{Verbatim}6120namespace ConeProperty {6121enum Enum {6122//6123// goals that can be computed (or are defined by input data)6124//6125// matrix valued6126Generators,6127ExtremeRays,6128VerticesFloat,6129VerticesOfPolyhedron,6130SupportHyperplanes,6131HilbertBasis,6132ModuleGenerators,6133Deg1Elements,6134ModuleGeneratorsOverOriginalMonoid,6135Sublattice,6136ExcludedFaces,6137OriginalMonoidGenerators,6138MaximalSubspace,6139Equations,6140Congruences,6141//vector valued6142Grading,6143Dehomogenization,6144WitnessNotIntegrallyClosed,6145GeneratorOfInterior,6146// Cardinalities6147TriangulationSize,6148// Integer valued,6149TriangulationDetSum,6150ReesPrimaryMultiplicity,6151GradingDenom,6152UnitGroupIndex,6153InternalIndex,6154ExternalIndex,6155// rational valued6156Multiplicity,6157Integral, // new6158VirtualMultiplicity, // new6159// dimensions6160RecessionRank,6161AffineDim,6162ModuleRank,6163Rank,6164EmbeddingDim,6165// boolean valued6166IsPointed,6167IsDeg1ExtremeRays,6168IsDeg1HilbertBasis,6169IsIntegrallyClosed,6170IsReesPrimary,6171IsInhomogeneous,6172IsGorenstein,6173// complex structures6174Triangulation,6175StanleyDec,6176InclusionExclusionData,6177ClassGroup,6178IntegerHull,6179ConeDecomposition,6180HilbertSeries,6181HilbertQuasiPolynomial,6182WeightedEhrhartSeries, // new6183WeightedEhrhartQuasiPolynomial, // new6184//6185// integer type for computations6186//6187BigInt,6188//6189// algorithmic variants6190//6191DefaultMode,6192Approximate,6193BottomDecomposition,6194NoBottomDec,6195DualMode,6196PrimalMode6197Projection,6198ProjectionFloat,6199NoProjection,6200Symmetrize,6201NoSymmetrization,6202NoSubdivision,6203NoNestedTri, // synonym for NoSubdivision6204KeepOrder,6205HSOP,6206NoPeriodBound,6207//6208// checking properties of already computed data6209// (cannot be used as a computation goal)6210//6211IsTriangulationNested,6212IsTriangulationPartial,62136214EnumSize // this has to be the last entry ...6215};6216}6217\end{Verbatim}62186219The class \verb|ConeProperties| is based on this enumeration. Its instantiation are essentially boolean vectors that can be accessed via the names in the enumeration. Instantiations of the class are used to set computation goals and algorithmic variants and to check whether the goals have been reached. The distinction between computation goals and algorithmic variants is not completely strict. See Section \ref{Goals} for implications between some \verb|ConeProperties|.62206221There exist versions of \verb|compute| for up to $3$ cone properties:6222\begin{Verbatim}6223ConeProperties Cone<Integer>::compute(ConeProperty::Enum cp)62246225ConeProperties Cone<Integer>::compute(ConeProperty::Enum cp1,6226ConeProperty::Enum cp2)62276228ConeProperties Cone<Integer>::compute(ConeProperty::Enum cp1,6229ConeProperty::Enum cp2, ConeProperty::Enum cp3)6230\end{Verbatim}62316232An example:6233\begin{Verbatim}6234MyCone.compute(ConeProperty::HilbertBasis, ConeProperty::Multiplicity)6235\end{Verbatim}62366237If you want to specify more than $3$ cone properties, you can define an instance of \verb|ConeProperties| yourself and call6238\begin{Verbatim}6239ConeProperties Cone<Integer>::compute(ConeProperties ToCompute)6240\end{Verbatim}62416242An example:6243\begin{Verbatim}6244ConeProperties Wanted;6245Wanted.set(ConeProperty::Triangulation, ConeProperty::HilbertBasis);6246MyCone.compute(Wanted);6247\end{Verbatim}62486249All \verb|get...| functions that are listed in the next section, try to compute the data asked for if they have not yet been computed. Unless you are interested a single result, we recommend to use \verb|compute| since the data asked for can then be computed in a single run. For example, if the Hilbert basis and the multiplicity are wanted, then it would be a bad idea to call \verb|getHilbertBasis| and \verb|getMultiplicity| consecutively. More importantly, however, is the lack of algorithmic variants if you use \verb|get...| without \verb|compute| beforehand.62506251If \verb|DefaultMode| is not set, then \verb|compute()| will throw a \verb|NotComputableException| so that \verb|compute()| cannot a value. In the presence of \verb|DefaultMode|, the returned \verb|ConeProperties| are those that have not been computed.62526253Please inspect \verb|cone_property.cpp| for the full list of methods implemented in the class \verb|ConeProperties|. Here we only mention the constructors6254\begin{Verbatim}6255ConeProperties::ConeProperties(ConeProperty::Enum p1)62566257ConeProperties::ConeProperties(ConeProperty::Enum p1, ConeProperty::Enum p2)62586259ConeProperties::ConeProperties(ConeProperty::Enum p1, ConeProperty::Enum p2,6260ConeProperty::Enum p3)6261\end{Verbatim}6262and the functions6263\begin{Verbatim}6264ConeProperties& ConeProperties::set(ConeProperty::Enum p1, bool value)62656266ConeProperties& ConeProperties::set(ConeProperty::Enum p1, ConeProperty::Enum p2)62676268bool ConeProperties::test(ConeProperty::Enum Property) const6269\end{Verbatim}62706271A string can be converted to a cone property and conversely:6272\begin{Verbatim}6273ConeProperty::Enum toConeProperty(const string&)6274const string& toString(ConeProperty::Enum)6275\end{Verbatim}62766277\subsection{Retrieving results}62786279As remarked above, all \verb|get...| functions that are listed below, try to compute the data asked for if they have not yet been computed. As also remarked above, it is often better to use \verb|compute| first.62806281The functions that return a matrix encoded as \verb|vector<vector<Integer> >| have variants that return a matrix encoded in the \verb|libnormaliz| class \verb|Matrix<Integer>|. These are not listed below; see \verb|cone.h|.62826283\subsubsection{Checking computations}6284In order to check whether a computation goal has been reached, one can use6285\begin{Verbatim}6286bool Cone<Integer>::isComputed(ConeProperty::Enum prop) const6287\end{Verbatim}6288for example6289\begin{Verbatim}6290bool done=MyCone.isComputed(ConeProperty::HilbertBasis)6291\end{Verbatim}62926293\subsubsection{Rank, index and dimension}62946295\begin{Verbatim}6296size_t Cone<Integer>::getEmbeddingDim()6297size_t Cone<Integer>::getRank()6298size_t Cone<Integer>::getRecessionRank()6299long Cone<Integer>::getAffineDim()6300size_t Cone<Integer>::getModuleRank()63016302Integer Cone<Integer>::getInternalIndex()6303Integer Cone<Integer>::getUnitGroupIndex()6304\end{Verbatim}63056306The \emph{internal} index is only defined if original generators are defined. See Section \ref{coord} for the external index.63076308The last three functions return values that are only well-defined after inhomogeneous computations.63096310\subsubsection{Support hyperplanes and constraints}\label{SHC}63116312\begin{Verbatim}6313const vector< vector<Integer> >& Cone<Integer>::getSupportHyperplanes()6314size_t Cone<Integer>::getNrSupportHyperplanes()6315\end{Verbatim}63166317The first function returns the support hyperplanes of the (homogenized) cone.6318The second function returns the number of support hyperplanes.63196320Together with the equations and congruences the support hyperplanes can also be accessed by6321\begin{Verbatim}6322map< InputType , vector< vector<Integer> > > Cone<Integer>::getConstraints ()6323\end{Verbatim}6324The map returned contains three pairs whose keys are6325\begin{Verbatim}6326Type::inequalities6327Type::equations6328Type::congruences6329\end{Verbatim}63306331Note that \verb|equations| \verb|congruences| can also be accessed via the coordinate transformation (to which they belong internally). See Section \ref{coord}.63326333\subsubsection{Extreme rays and vertices}63346335\begin{Verbatim}6336const vector< vector<Integer> >& Cone<Integer>::getExtremeRays()6337size_t Cone<Integer>::getNrExtremeRays()6338const vector< vector<Integer> >& Cone<Integer>::getVerticesOfPolyhedron()6339size_t Cone<Integer>::getNrVerticesOfPolyhedron()6340\end{Verbatim}63416342In the inhomogeneous case the first function returns the extreme rays of the recession cone, and the second the vertices of the polyhedron. (Together they form the extreme rays of the homogenized cone.)63436344Vertices can be returned in floating point formet:6345\begin{Verbatim}6346const vector< vector<nmz_float> >& Cone<Integer>::getVerticesFloat()6347size_t Cone<Integer>::getNrVerticesFloat()6348\end{Verbatim}63496350\subsubsection{Generators}63516352\begin{Verbatim}6353const vector< vector<Integer> >& Cone<Integer>::getOriginalMonoidGenerators()6354size_t Cone<Integer>::getNrOriginalMonoidGenerators()6355\end{Verbatim}6356Note that original generators are not always defined. The system of generators of the cone that is used in the computations and its cardinality are returned by6357\begin{Verbatim}6358const vector< vector<Integer> >& Cone<Integer>::getGenerators()6359size_t Cone<Integer>::getNrGenerators()6360\end{Verbatim}63616362\subsubsection{Lattice points in polytopes and elements of degree $1$}63636364\begin{Verbatim}6365const vector< vector<Integer> >& Cone<Integer>::getDeg1Elements()6366size_t Cone<Integer>::getNrDeg1Elements()6367\end{Verbatim}63686369This applies only to homogeneous computations. If a polytope is defined by inhomogeneous input, its lattice points appear as \verb|ModuleGenerators|; see below.63706371\subsubsection{Hilbert basis}63726373In the nonpointed case we need the maximal linear subspace of the cone:6374\begin{Verbatim}6375const vector< vector<Integer> >& Cone<Integer>::getMaximalSubspace()6376size_t Cone<Integer>::getDimMaximalSubspace()6377\end{Verbatim}63786379One of the prime results of Normaliz and its cardinality are returned by6380\begin{Verbatim}6381const vector< vector<Integer> >& Cone<Integer>::getHilbertBasis()6382size_t Cone<Integer>::getNrHilbertBasis()6383\end{Verbatim}6384Inhomogeneous case the functions refer to the the Hilbert basis of the recession cone. The module generators of the lattice points in the polyhedron are accessed by6385\begin{Verbatim}6386const vector< vector<Integer> >& Cone<Integer>::getModuleGenerators()6387size_t Cone<Integer>::getNrModuleGenerators()6388\end{Verbatim}63896390If the original monoid is not integrally closed, you can ask for a witness:6391\begin{Verbatim}6392vector<Integer> Cone<Integer>::getWitnessNotIntegrallyClosed()6393\end{Verbatim}63946395\subsubsection{Module generators over original monoid}63966397\begin{Verbatim}6398const vector< vector<Integer> >&6399Cone<Integer>::getModuleGeneratorsOverOriginalMonoid()6400size_t Cone<Integer>::getNrModuleGeneratorsOverOriginalMonoid()6401\end{Verbatim}64026403\subsubsection{Generator of the interior}\label{GenInt}64046405If the monoid is Gorenstein, Normaliz computes the generator of the interior (the canonical module):6406\begin{Verbatim}6407const vector<Integer>& Cone<Integer>::getGeneratorOfInterior()6408\end{Verbatim}6409Before asking for this vector, one should test \verb|isGorenstein()|.64106411\subsubsection{Grading and dehomogenization}64126413\begin{Verbatim}6414vector<Integer> Cone<Integer>::getGrading()6415Integer Cone<Integer>::getGradingDenom()6416\end{Verbatim}6417The second function returns the denominator of the grading.64186419\begin{Verbatim}6420vector<Integer> Cone<Integer>::getDehomogenization()6421\end{Verbatim}64226423\subsubsection{Enumerative data}64246425\begin{Verbatim}6426mpq_class Cone<Integer>::getMultiplicity()6427\end{Verbatim}6428Don't forget that the multiplicity is measured by a rational, not necessarily integral polytope. Therefore it need not be an integer.64296430The Hilbert series is stored in a class of its own. It is retrieved by6431\begin{Verbatim}6432const HilbertSeries& Cone<Integer>::getHilbertSeries()6433\end{Verbatim}6434It contains several data fields that can be accessed as follows (see \verb|hilbert_series.h|):6435\begin{Verbatim}6436const vector<mpz_class>& HilbertSeries::getNum() const;6437const map<long, denom_t>& HilbertSeries::getDenom() const;64386439const vector<mpz_class>& HilbertSeries::getCyclotomicNum() const;6440const map<long, denom_t>& HilbertSeries::getCyclotomicDenom() const;64416442const vector<mpz_class>& HilbertSeries::getHSOPNum() const;6443const map<long, denom_t>& HilbertSeries::getHSOPDenom() const;64446445long HilbertSeries::getDegreeAsRationalFunction() const;6446long HilbertSeries::getShift() const;64476448bool HilbertSeries::isHilbertQuasiPolynomialComputed() const;6449vector< vector<mpz_class> > HilbertSeries::getHilbertQuasiPolynomial() const;6450long HilbertSeries::getPeriod() const;6451mpz_class HilbertSeries::getHilbertQuasiPolynomialDenom() const;6452\end{Verbatim}64536454The first six functions refer to three representations of the Hilbert series as a rational function in the variable $t$: the first has a denominator that is a product of polynomials $(1-t^g)^e$, the second has a denominator that is a product of cylotomic polynomials. In the third case the denominator is determined by the degrees of a homogeneous system of parameters (see Section \ref{rational}). In all cases the numerators are given by their coefficient vectors, and the denominators are lists of pairs $(g,e)$ where in the second case $g$ is the order of the cyclotomic polynomial.64556456If you have already computed the Hilbert series without HSOP and you want it with HSOP afterwards, the Hilbert series will simply be transformed, but Normaliz must compute the degrees for the denominator, and this may be a nontrivial computation.64576458The degree as a rational function is of course independent of the chosen representation, but may be negative, as well as the shift that indicates with which power of $t$ the numerator tarts. Since the denominator has a nonzero constant term in all cases, this is exactly the smallest degree in which the Hilbert function has a nonzero value.64596460The Hilbert quasipolynomial is represented by a vector whose length is the period and whose entries are itself vectors that represent the coefficients of the individual polynomials corresponding to the residue classes modulo the period. These integers must be divided by the common denominator that is returned by the last function.64616462For the input type \verb|rees_algebra| we provide6463\begin{Verbatim}6464Integer Cone<Integer>::getReesPrimaryMultiplicity()6465\end{Verbatim}64666467\subsubsection{Weighted Ehrhart series and integrals}64686469The wighted Ehrhart series can be accessed by6470\begin{Verbatim}6471const pair<HilbertSeries, mpz_class>& Cone<Integer>::getWeightedEhrhartSeries()6472\end{Verbatim}6473The second component of the pair is the denominator of the coefficients in the series numerator. Its introduction was necessary since we wanted to keep integral coefficients for the numerator of a Hilbert series. The numerator and the denominator of the first component of type \verb|HilbertSeries| can be accessed as usual, but one must not forget the denominator of the numerator coefficients. There is a second way to access these data; see below.64746475The virtual multiplicity and the integral, respectively, are got by6476\begin{Verbatim}6477mpq_class Cone<Integer>::getVirtualMultiplicity()6478mpq_class Cone<Integer>::getIntegral()6479\end{Verbatim}64806481Actually the cone saves these data in a special container of class \verb|IntegrationData| (defined in \verb|Hilbert_sries.h|). It is accessed by6482\begin{Verbatim}6483IntegrationData& Cone<Integer>::getIntData()6484\end{Verbatim}6485The three \verb|get| functions above are only shortcuts for the access via \verb|getIntData()|:6486\begin{Verbatim}6487string IntegrationData::getPolynomial() const6488long IntegrationData::getDegreeOfPolynomial() const6489bool IntegrationData::isPolynomialHomogeneous() const64906491const vector<mpz_class>& IntegrationData::getNum_ZZ() const6492mpz_class IntegrationData::getNumeratorCommonDenom() const6493const map<long, denom_t>& IntegrationData::getDenom() const64946495const vector<mpz_class>& IntegrationData::getCyclotomicNum_ZZ() const6496const map<long, denom_t>& IntegrationData::getCyclotomicDenom() const64976498bool IntegrationData::isWeightedEhrhartQuasiPolynomialComputed() const6499void IntegrationData::computeWeightedEhrhartQuasiPolynomial()6500vector< vector<mpz_class> > IntegrationData::getWeightedEhrhartQuasiPolynomial()6501mpz_class IntegrationData::getWeightedEhrhartQuasiPolynomialDenom() const65026503mpq_class IntegrationData::getVirtualMultiplicity() const6504mpq_class IntegrationData::getIntegral() const6505\end{Verbatim}65066507The first three functions refer to the polynomial defining the integral or weighted Ehrhart series.65086509The computation of these data is controlled by the corresponding \verb|ConeProperty|.65106511\subsubsection{Triangulation and disjoint decomposition}65126513The triangulation, the size and the sum of the determinants are returned by6514\begin{Verbatim}6515const vector< pair<vector<key_t>,Integer> >& Cone<Integer>::getTriangulation()6516size_t Cone<Integer>::getTriangulationSize()6517Integer Cone<Integer>::getTriangulationDetSum()6518\end{Verbatim}6519See Section \ref{Triang} for the interpretation of these data. The first component of the pair is the vector of indices of the simplicial cones in the triangulation. Note that the indices are here counted from $0$ (whereas they start from $1$ in the \verb|tri| file). The second component is the determinant.65206521The type of triangulation can be retrieved by6522\begin{Verbatim}6523bool Cone<Integer>::isTriangulationNested()6524bool Cone<Integer>::isTriangulationPartial()6525\end{Verbatim}65266527If the disjoint decomposition has been computed, one gets the $0/1$ vectors describing the facets to be removed65286529\begin{Verbatim}6530const vector<vector<bool> >& Cone<Integer>::getOpenFacets()6531\end{Verbatim}65326533\subsubsection{Stanley decomposition}65346535The Stanley decomposition is stored in a list whose entries correspond to the simplicial cones in the triangulation:6536\begin{Verbatim}6537const list< STANLEYDATA<Integer> >& Cone<Integer>::getStanleyDec()6538\end{Verbatim}6539Each entry is a record of type \verb|STANLEYDATA| defined as follows:6540\begin{Verbatim}6541struct STANLEYDATA {6542vector<key_t> key;6543Matrix<Integer> offsets;6544};6545\end{Verbatim}6546The key has the same interpretation as for the triangulation, namely as the vector of indices of the generators of the simplicial cone (counted from $0$). The matrix contains the coordinate vectors of the offsets of the components of the decomposition that belong to the simplicial cone defined by the key. See Section \ref{Stanley} for the interpretation. The format of the matrix can be accessed by the following functions of class \verb|Matrix<Integer>|:6547\begin{Verbatim}6548size_t nr_of_rows() const6549size_t nr_of_columns() const6550\end{Verbatim}6551The entries are accessed in the same way as those of \verb|vector<vector<Integer> >|.65526553\subsubsection{Coordinate transformation}\label{coord}65546555The coordinate transformation from the ambient lattice to the sublattice generated by the Hilbert basis and the basis of the maximal subspace can be returned as follows:6556\begin{Verbatim}6557const Sublattice_Representation<Integer>& Cone<Integer>::getSublattice()6558\end{Verbatim}6559An object of type \verb|Sublattice_Representation| models a sequence of $\ZZ$-homomorphisms6560$$6561\ZZ^r\xrightarrow{\phi}\ZZ^n\xrightarrow{\pi}\ZZ^r6562$$6563with the following property: there exists $c\in\ZZ$, $c\neq 0$, such that $\pi\circ \phi=c\cdot\operatorname{id}_{\ZZ^r}$. In particular $\phi$ is injective. One should view the two maps as a pair of coordinate transformations: $\phi$ is determined by a choice of basis in the sublattice $U=\phi(\ZZ^r)$, and it allows us to transfer vectors from $U\cong \ZZ^r$ to the ambient lattice $\ZZ^n$. The map $\pi$ is used to realize vectors from $U$ as linear combinations of the given basis of $U\cong\ZZ^r$: after the application of $\pi$ one divides by $c$. (If $U$ is a direct summand of $\ZZ^n$, one can choose $c=1$, and conversely.) Normaliz considers vectors as rows of matrices. Therefore $\phi$ is given as an $r\times n$-matrix and $\pi$ is given as an $n\times r$ matrix.65646565The data just described can be accessed as follows (\verb|sublattice_representation.h|). For space reasons we omit the class specification \verb|Sublattice_Representation<Integer>::|6566\begin{Verbatim}6567const vector<vector<Integer> >& getEmbedding() const6568const vector<vector<Integer> >& getProjection() const6569Integer getAnnihilator() const6570\end{Verbatim}6571Here ``Embedding'' refers to $\phi$ and ``Projection'' to $\pi$ (though $\pi$ is not always surjective). The ``Annihilator'' is the number $c$ above. (It annihilates $\ZZ^r$ modulo $\pi(\ZZ^n)$.)65726573The numbers $n$ and $r$ are accessed in this order by6574\begin{Verbatim}6575size_t getDim() const6576size_t getRank() const6577\end{Verbatim}6578The external index, namely the order of the torsion subgroup of $\ZZ^n/U$, is returned by6579\begin{Verbatim}6580mpz_class getExternalIndex() const6581\end{Verbatim}6582Very often $\phi$ and $\psi$ are identity maps, and this property can be tested by6583\begin{Verbatim}6584bool IsIdentity()const6585\end{Verbatim}6586The constraints computed by Normaliz are ``hidden'' in the sublattice representation. They van be accessed by6587\begin{Verbatim}6588const vector<vector<Integer> >& getEquations() const6589const vector<vector<Integer> >& getCongruences() const6590\end{Verbatim}65916592But see Section \ref{SHC} above for a more direct access.659365946595\subsubsection{Class group}65966597\begin{Verbatim}6598vector<Integer> Cone<Integer>::getClassGroup()6599\end{Verbatim}6600The return value is to be interpreted as follows: The entry for index $0$ is the rank of the class group. The remaining entries contain the orders of the summands in a direct sum decomposition of the torsion subgroup.66016602\subsubsection{Integer hull}66036604For the computation of the integer hull an auxiliary cone is constructed. A reference to it is returned by6605\begin{Verbatim}6606Cone<Integer>& Cone<Integer>::getIntegerHullCone() const6607\end{Verbatim}66086609For example, the support hyperplanes of the integer hull can be accessed by6610\begin{Verbatim}6611MyCone.getIntegerHullCone().getSupportHyperplanes()6612\end{Verbatim}66136614\subsubsection{Excluded faces}66156616Before using the excluded faces Normaliz makes the collection irredundant by discarding those that are contained in others. The irredundant collection (given by hyperplanes that intersect the cone in the faces) and its cardinality are returned by6617\begin{Verbatim}6618const vector< vector<Integer> >& Cone<Integer>::getExcludedFaces()6619size_t Cone<Integer>::getNrExcludedFaces()6620\end{Verbatim}6621For the computation of the Hilbert series the all intersections of the excluded faces are computed, and for each resulting face the weight with which it must be counted is computed. These data can be accessed by6622\begin{Verbatim}6623const vector< pair<vector<key_t>,long> >&6624Cone<Integer>::getInclusionExclusionData()6625\end{Verbatim}6626The first component of each pair contains the indices of the generators (counted from 0) that lie in the face and the second component is the weight.66276628\subsubsection{Boolean valued results}66296630All the ``questions'' to the cone that can be asked by the boolean valued functions in this section start a computation if the answer is not yet known.66316632The first, the question6633\begin{Verbatim}6634bool Cone<Integer>::isIntegrallyClosed()6635\end{Verbatim}6636does not trigger a computation of the full Hilbert basis. The computation stops as soon as the answer can be given, and this is the case when an element in the integral closure has been found that is not in the original monoid. Such an element is retrieved by6637\begin{Verbatim}6638vector<Integer> Cone<Integer>::getWitnessNotIntegrallyClosed()6639\end{Verbatim}66406641As discussed in Section \ref{IsPointed} it can sometimes be useful to ask6642\begin{Verbatim}6643bool Cone<Integer>::isPointed()6644\end{Verbatim}6645before a more complex computation is started.66466647The Gorenstein property can be tested with6648\begin{Verbatim}6649bool Cone<Integer>::isGorenstein()6650\end{Verbatim}6651If the answer is positive, Normaliz computes the generator of the interior of the monoid. Also see \ref{GenInt}665266536654The next two functions answer the question whether the Hilbert basis or at least the extreme rays live in degree $1$.6655\begin{Verbatim}6656bool Cone<Integer>::isDeg1ExtremeRays()6657bool Cone<Integer>::isDeg1HilbertBasis()6658\end{Verbatim}66596660Finally we have6661\begin{Verbatim}6662bool Cone<Integer>::isInhomogeneous()6663bool Cone<Integer>::isReesPrimary()6664\end{Verbatim}6665\verb|isReesPrimary()| checks whether the ideal defining the Rees algebra is primary to the irrelevant maximal ideal.66666667\subsection{Control of execution}66686669\subsubsection{Exceptions}66706671All exceptions that are thrown in \verb|libnormaliz| are derived from the abstract class \verb|NormalizException| that itself is derived from \verb|std::exception|:6672\begin{Verbatim}6673class NormalizException: public std::exception6674\end{Verbatim}66756676The following exceptions must be caught by the calling program:6677\begin{Verbatim}6678class ArithmeticException: public NormalizException6679class BadInputException: public NormalizException6680class NotComputableException: public NormalizException6681class FatalException: public NormalizException6682class NmzCoCoAException: public NormalizException6683class InterruptException: public NormalizException6684\end{Verbatim}66856686The \verb|ArithmeticException| leaves \verb|libnormaliz| if a nonrecoverable overflow occurs (it is also used internally for the change of integer type). This should not happen for cones of integer type \verb|mpz_class|, unless it is caused by the attempt to create a data structure of illegal size or by a bug in the program. The \verb|BadInputException| is thrown whenever the input is inconsistent; the reasons for this are manifold. The \verb|NotComputableException| is thrown if a computation goal cannot be reached. The \verb|FatalException| should never appear. It covers error situations that can only be caused by a bug in the program. At many places \verb|libnormaliz| has \verb|assert| verifications built in that serve the same purpose.66876688There are two more exceptions for the communication within \verb|libnormaliz| that should not leave it:6689\begin{Verbatim}6690class NonpointedException: public NormalizException6691class NotIntegrallyClosedException: public NormalizException6692\end{Verbatim}66936694The \verb|InterruptException| is discussed in the next section.66956696\subsubsection{Interruption}66976698In order to find out if the user wants to interrupt the program, the functions in \verb|libnormaliz| test the value of the global variable6699\begin{Verbatim}6700volatile sig_atomic_t nmz_interrupted6701\end{Verbatim}6702If it is found to be \verb|true|, an \verb|InterruptException| is thrown. This interrupt lraves \verb|libnormaliz|, so that the calling program can process it. The \verb|Cone| still exists, and the data computed in it can still be accessed. Moreover, \verb|compute| can again be applied to it.67036704The calling program must take care to catch the signal caused by Ctrl-C and to set \verb|nmz_interrupted=1|.67056706\subsubsection{Inner parallelization}67076708By default the cone constructor sets the maximal number of parallel threads to $8$, unless the system has set a lower limit. You can change this value by6709\begin{Verbatim}6710long set_thread_limit(long t)6711\end{Verbatim}6712The function returns the previous value.67136714\verb|set_thread_limit(0)| raises the limit set by libnormaliz to $\infty$.67156716\subsubsection{Outer parallelization}67176718The libnormaliz functions can be called by programs that are parallelized via OpenMP themselves. The functions in libnormaliz switch off nested parallelization.67196720As a test program you can compile and run \verb|outerpar| in \verb|source/outerpar|. Compile it by \texttt{make -f Makefile.classic}.672167226723\subsubsection{Control of terminal output}6724By using6725\begin{Verbatim}6726bool setVerboseDefault(bool v)6727\end{Verbatim}6728one can control the verbose output of \verb|libnormaliz|. The default value is \verb|false|. This is a global setting that effects all cones constructed afterwards. However, for every cone one can set an individual value of \verb|verbose| by6729\begin{Verbatim}6730bool Cone<Integer>::setVerbose(bool v)6731\end{Verbatim}6732Both functions return the previous value.67336734The default values of verbose output and error output are \verb|std::cout| and \verb|std::cerr|. These values can be changed by6735\begin{Verbatim}6736void setVerboseOutput(std::ostream&)6737void setErrorOutput(std::ostream&)6738\end{Verbatim}67396740\subsection{A simple program}\label{maxsimplex}67416742The example program is a simplified version of the program on which the experiments for the paper ``Quantum jumps of normal polytopes'' by W. Bruns, J. Gubeladze and M. Micha\l{}ek, Discrete Comput.\ Geom.\ 56 (2016), no. 1, 181--215, are based. Its goal is to find a maximal normal lattice polytope $P$ in the following sense: there is no normal lattice polytope $Q\supset P$ that has exactly one more lattice point than $P$. `Normal'' means in this context that the Hilbert basis of the cone over $P$ is given by the lattice points of $P$, considered as degree $1$ elements in the cone.67436744The program generates normal lattice simplices and checks them for maximality. The dimension is set in the program, as well as the bound for the random coordinates of the vertices.67456746Let us have a look at \verb|source/maxsimplex/maxsimplex.cpp|. First the more or less standard preamble:67476748\begin{Verbatim}6749#include <stdlib.h>6750#include <vector>6751#include <fstream>6752#include <omp.h>6753using namespace std;67546755#include "libnormaliz/libnormaliz.h"6756#include "libnormaliz/cone.h"6757#include "libnormaliz/vector_operations.h"6758#include "libnormaliz/cone_property.h"6759#include "libnormaliz/integer.h"6760using namespace libnormaliz;6761\end{Verbatim}67626763Since we want to perform a high speed experiment which is not expected to be arithmetically demanding, we choose $64$ bit integers:6764\begin{Verbatim}6765typedef long long Integer;6766\end{Verbatim}67676768The first routine finds a random normal simplex of dimension \verb|dim|. The coordinates of the vertices are integers between $0$ and \verb|bound|. We are optimistic that such a simplex can be found, and this is indeed no problem in dimension $4$ or $5$.67696770\begin{Verbatim}6771Cone<Integer> rand_simplex(size_t dim, long bound){67726773vector<vector<Integer> > vertices(dim+1,vector<Integer> (dim));6774while(true){ // an eternal loop ...6775for(size_t i=0;i<=dim;++i){6776for(size_t j=0;j<dim;++j)6777vertices[i][j]=rand()%(bound+1);6778}67796780Cone<Integer> Simplex(Type::polytope,vertices);6781// we must check the rank and normality6782if(Simplex.getRank()==dim+1 && Simplex.isDeg1HilbertBasis())6783return Simplex;6784}6785vector<vector<Integer> > dummy_gen(1,vector<Integer>(1,1));6786// to make the compiler happy6787return Cone<Integer>(Type::cone,dummy_gen);6788}6789\end{Verbatim}67906791We are looking for a normal polytope $Q\supset P$ with exactly one more lattice point. The potential extra lattice points $z$ are contained in the matrix \verb|jump_cands|. There are two obstructions for $Q=\operatorname{conv}(P,z)$ to be tested: (i) $z$ is the only extra lattice point and (ii) $Q$ is normal. It makes sense to test them in this order since most of the time condition (i) is already violated and it is much faster to test.6792\begin{Verbatim}6793bool exists_jump_over(Cone<Integer>& Polytope,6794const vector<vector<Integer> >& jump_cands){67956796vector<vector<Integer> > test_polytope=Polytope.getExtremeRays();6797test_polytope.resize(test_polytope.size()+1);6798for(size_t i=0;i<jump_cands.size();++i){6799test_polytope[test_polytope.size()-1]=jump_cands[i];6800Cone<Integer> TestCone(Type::cone,test_polytope);6801if(TestCone.getNrDeg1Elements()!=Polytope.getNrDeg1Elements()+1)6802continue;6803if(TestCone.isDeg1HilbertBasis())6804return true;6805}6806return false;6807}6808\end{Verbatim}68096810In order to make the (final) list of candidates $z$ as above we must compute the widths of $P$ over its support hyperplanes.6811\begin{Verbatim}6812vector<Integer> lattice_widths(Cone<Integer>& Polytope){68136814if(!Polytope.isDeg1ExtremeRays()){6815cerr<< "Cone in lattice_widths is not defined by lattice polytope"<< endl;6816exit(1);6817}6818vector<Integer> widths(Polytope.getNrExtremeRays(),0);6819for(size_t i=0;i<Polytope.getNrSupportHyperplanes();++i){6820for(size_t j=0;j<Polytope.getNrExtremeRays();++j){6821// v_scalar_product is a useful function from vector_operations.h6822Integer test=v_scalar_product(Polytope.getSupportHyperplanes()[i],6823Polytope.getExtremeRays()[j]);6824if(test>widths[i])6825widths[i]=test;6826}6827}6828return widths;6829}6830\end{Verbatim}68316832\begin{Verbatim}68336834int main(int argc, char* argv[]){68356836time_t ticks;6837srand(time(&ticks));6838cout << "Seed " <<ticks << endl; // we may want to reproduce the run68396840size_t polytope_dim=4;6841size_t cone_dim=polytope_dim+1;6842long bound=6;6843vector<Integer> grading(cone_dim,0);6844// at some points we need the explicit grading6845grading[polytope_dim]=1;68466847size_t nr_simplex=0; // for the progress report68486849\end{Verbatim}6850Since the computations are rather small, we suppress parallelization (except for one step below).6851\begin{Verbatim}6852while(true){68536854#ifdef _OPENMP6855omp_set_num_threads(1);6856#endi6857Cone<Integer> Candidate=rand_simplex(polytope_dim,bound);6858nr_simplex++;6859if(nr_simplex%1000 ==0)6860cout << "simplex " << nr_simplex << endl;6861\end{Verbatim}6862Maximality is tested in $3$ steps. Most often there exists a lattice point $z$ of height $1$ over $P$. If so, then $\operatorname{conv}(P,z)$ contains only $z$ as an extra lattice point and it is automatically normal. In order to find such a point we must move the support hyperplanes outward by lattice distance $1$.6863\begin{Verbatim}6864vector<vector<Integer> > supp_hyps_moved=Candidate.getSupportHyperplanes();6865for(size_t i=0;i<supp_hyps_moved.size();++i)6866supp_hyps_moved[i][polytope_dim]+=1;6867Cone<Integer> Candidate1(Type::inequalities,supp_hyps_moved,6868Type::grading,to_matrix(grading));6869if(Candidate1.getNrDeg1Elements()>Candidate.getNrDeg1Elements())6870continue; // there exists a point of height 16871\end{Verbatim}6872Among the polytopes that have survived the height $1$ test, most nevertheless have suitable points $z$ close to them, and it makes sense not to use the maximum possible height immediately. Note that we must now test normality explicitly.6873\begin{Verbatim}6874cout << "No ht 1 jump"<< " #latt " << Candidate.getNrDeg1Elements() << endl;6875// move the hyperplanes further outward6876for(size_t i=0;i<supp_hyps_moved.size();++i)6877supp_hyps_moved[i][polytope_dim]+=polytope_dim;6878Cone<Integer> Candidate2(Type::inequalities,supp_hyps_moved,6879Type::grading,to_matrix(grading));6880cout << "Testing " << Candidate2.getNrDeg1Elements()6881<< " jump candidates" << endl; // including the lattice points in P6882if(exists_jump_over(Candidate,Candidate2.getDeg1Elements()))6883continue;6884\end{Verbatim}6885Now we can be optimistic that a maximal polytope $P$ has been found, and we test all candidates $z$ that satisfy the maximum possible bound on their lattice distance to $P$.6886\begin{Verbatim}6887cout << "No ht <= 1+dim jump" << endl;6888vector<Integer> widths=lattice_widths(Candidate);6889for(size_t i=0;i<supp_hyps_moved.size();++i)6890supp_hyps_moved[i][polytope_dim]+=6891-polytope_dim+(widths[i])*(polytope_dim-2);6892\end{Verbatim}6893The computation may become arithmetically critical at this point. Therefore we use \verb|mpz_class| for our cone. The conversion to and from \verb|mpz_class| is done by routines contained in \verb|convert.h|.6894\begin{Verbatim}6895vector<vector<mpz_class> > mpz_supp_hyps;6896convert(mpz_supp_hyps,supp_hyps_moved);6897vector<mpz_class> mpz_grading=convertTo<vector<mpz_class> >(grading);6898\end{Verbatim}6899The computation may need some time now. Therefore we allow a little bit of parallelization.6900\begin{Verbatim}6901#ifdef _OPENMP6902omp_set_num_threads(4);6903#endif6904\end{Verbatim}6905Since $P$ doesn't have many vertices (even if we use these routines for more general polytopes than simplices), we don't expect too many vertices for the enlarged polytope. In this situation it makes sense to set the algorithmic variant \verb|Approximate|.6906\begin{Verbatim}6907Cone<mpz_class> Candidate3(Type::inequalities,mpz_supp_hyps,6908Type::grading,to_matrix(mpz_grading));6909Candidate3.compute(ConeProperty::Deg1Elements,ConeProperty::Approximate);6910vector<vector<Integer> > jumps_cand; // for conversion from mpz_class6911convert(jumps_cand,Candidate3.getDeg1Elements());6912cout << "Testing " << jumps_cand.size() << " jump candidates" << endl;6913if(exists_jump_over(Candidate, jumps_cand))6914continue;6915\end{Verbatim}6916Success!6917\begin{Verbatim}6918cout << "Maximal simplex found" << endl;6919cout << "Vertices" << endl;6920Candidate.getExtremeRaysMatrix().pretty_print(cout); // a goody from matrix.h6921cout << "Number of lattice points = " << Candidate.getNrDeg1Elements();6922cout << " Multiplicity = " << Candidate.getMultiplicity() << endl;69236924} // end while6925} // end main6926\end{Verbatim}69276928For the compilation of \verb|maxsimplex.cpp| we have added a \verb|Makefile|. Running the program needs a little bit of patience. However, within a few hours a maximal simplex should have emerged. From a log file:6929\begin{Verbatim}6930simplex 1430006931No ht 1 jump #latt 96932Testing 22 jump candidates6933No ht 1 jump #latt 106934Testing 30 jump candidates6935No ht 1 jump #latt 296936Testing 39 jump candidates6937No ht <= 1+dim jump6938Testing 173339 jump candidates6939Maximal simplex found6940Vertices69411 3 5 3 169422 3 0 3 169433 0 5 5 169445 2 2 1 169456 5 6 2 16946Number of lattice points = 29 Multiplicity = 2756947\end{Verbatim}69486949\end{small}69506951\section{PyNormaliz}69526953Before you can install PyNormaliz (written by Sebastian Gutsche), you must install Normaliz with shared libraries via \verb|make install| (using cmake or autotools). PyNormaliz expects the installed files in a standard location.69546955For PyNormaliz itself type6956\begin{Verbatim}6957python setup.py install6958\end{Verbatim}6959or6960\begin{Verbatim}6961pip install PyNormaliz6962\end{Verbatim}6963at a command prompt. Depending on your python version you might want to write \verb|python3| instead.69646965For a brief introduction please consult the PyNormaliz tutorial on the Normaliz web site.69666967\section{QNormaliz}\label{QNorm}69686969The variant QNormaliz of Normaliz can use coefficients from subfields of $\RR$, for example from real algebraic extensions of $\QQ$. It is clear that the computations are then restricted to those that do not depend on lattice data. At present QNormaliz is restricted to the computations of support hyperplanes/extreme rays and to triangulations. Instead of the template name \verb|Integer| (see Appendix \ref{libnorm}) it uses \verb|Number| to emphasize the difference.69706971The included implementation specializes \verb|Number| to \verb|mpq_class|. This only serves as a demonstration example. From the practical viewpoint it is superfluous since Normaliz can (now) process rational input data. Nevertheless have a look at the examples in \verb|Qexample|.69726973\subsection{Prerequisites}69746975In order to specialize \verb|Number| to your field of coefficients you must of course make it available via a suitable class library in the compilation process.69766977In the code of \verb|QNormaliz| the following adaptations are necessary:6978\begin{enumerate}6979\item In \verb|Qnormaliz.cpp| replace \verb|mpq_class| in the definition of \verb|Cone|.6980\item In \verb|libQnoraliz-templated.cpp| you must do the same replacement.6981\item If your number type has a convenient conversion to \verb|string|, modify the specialization of the templated function \verb|toString| in \verb|Qinteger.h|. Otherwise remove the specialization for \verb|mpq_class|.6982\item In \verb|Qvector_operations.cpp| you must replace the definition of \verb|v_simplify| by a version for your numbers.6983\end{enumerate}69846985The last point is extremely important since the coefficients of the linear forms representing the support hyperplanes or the vectors representing the extreme rays tend to explode rapidly in size if not kept under control. For \verb|mpq_class| this means that we multiply vectors by the least common denominator of the components and then extract the gcd of the numerators. (If you really need a demonstration of what happens otherwise, switch off the function by an immediate \verb|return|, and run QNormaliz on the example \verb|small| in \verb|example|.)69866987\subsection{Restrictions}69886989The following input types are NOT allowed in QNormaliz:6990\begin{center}6991\texttt{6992\begin{tabular}{lll}6993lattice& congruences&grading\\6994cone\_and\_lattice& inhom\_congruences& offset6995\end{tabular}6996}6997\end{center}6998Inhomogeneous types are allowed. Also \verb|saturation| is allowed. It must be interpreted as a generating set for a subspace that is intersected with all the objects defined by other input items.69997000The only computation goals and algorithmic variants allowed are:7001\begin{center}7002\texttt{7003\begin{tabular}{llll}7004Generators& ExtremeRays & VerticesOfPolyhedron & MaximalSubspace \\7005SupportHyperplanes& Equations & Triangulation & ConeDecomposition \\7006Dehomogenization& Rank& EmbeddingDim & Sublattice\\7007KeepOrder & IsPointed &IsInhomogeneous &DefaultMode7008\end{tabular}7009}7010\end{center}70117012It may seem paradoxical that \verb|Sublattice| appears here. As in the true lattice case, the \verb|Sublattice| \verb|Representation| is the coordinate transformation used by QNormaliz. Over a field $F$ there is no need for the annihilator $c$, and one simply has a pair of linear maps $F^r\to F^d \to F^r$ whose composition is the identity of $F^r$. Of course, congruences and external index make no sense anymore.70137014Moreover, the original monoid and any data referring to it are not defined.70157016Implicit or explicit \verb|DefaultMode| is interpreted as \verb|SupportHyperplanes|.70177018\subsection{Results}70197020In the output file we use the same terminology as in that of Normaliz, for example, ``basis elements of sublattice''. In QNormaliz these vectors form a basis of the vector subspace spanned by the cone that is computed. No reference to a sublattice is implied.70217022As far as possible, we apply \verb|v_simplify| to the computation results. Note that it is not necessarily applied to all results. For example the generators of the cone (contained in the file with suffix \verb|tgn| or returned by \verb|getGenerators|) are not necessarily simplified. (In particular, they need not be identical to those computed by Normaliz (if applicable to the input), but can differ from them by order and rational factors.)70237024As for Normaliz, for dehomogenization one must divide a vector by its value under the linear form that we call dehomogenization. Since fractions can be formed now, Normaliz could divide by the dehomogenization, but it does not do it in favor of the output in simplified form.70257026Note that there is no way for QNormaliz to define an invariant volume function on subspaces. (In Normaliz the situation is different since determinants of invertible matrices over $\ZZ$ are equal to $\pm 1$.) Therefore QNormaliz does not define multiplicities. Together with triangulations, it computes determinants of the vectors spanning the simplicial cones. They are defined relative to the choice of basis shown as ``basis of sublattice'' if the cone is not fulldimensional. In the fulldimensional case QNormaliz uses the basis of unit vectors.70277028\subsection{Installation}70297030The standard autotools build system automatically builds and installs7031QNormaliz as well.70327033As for Normaliz and QNormaliz one can use the ``classical'' Makefile. See \verb|INSTALL| in the directory \verb|source| (without Q!).70347035Moreover, QNormaliz can also be built by cmake. Simply follow the steps in Section \ref{cmake} after having made a directory \verb|BUILD_QNMZ| (for example) in the Normaliz directory. Then go to it and say \verb|cmake ../Qsource|, followed by \verb|make| and \verb|make install|. With the default settings, libQnormaliz will be installed in \verb|/usr/local|, subdirectories \verb|bin|, \verb|lib| and \verb|include/libQnormaliz|.7036703770387039\begin{thebibliography}{15.}7040\small70417042\bibitem{CoCoA}7043J. Abbott, A.M. Bigatti and G. Lagorio,7044\emph{CoCoA-5: a system for doing {C}omputations in {C}ommutative {A}lgebra.}7045Available at \url{http://cocoa.dima.unige.it}.70467047\bibitem{Scip} T. Achterberg. {\em SCIP: Solving constraint integer programs}. Mathematical Programming Computation 1 (2009), 1--41. Available from \url{http://mpc.zib.de/index.php/MPC/article/view/4}70487049\bibitem{AI} V. Almendra and B. Ichim. {\em jNormaliz 1.7}.7050Available at \url{http://normaliz.uos.de}70517052\bibitem{LatInt} V. Baldoni, N. Berline, J.A. De Loera, B. Dutra, M. K�ppe, S. Moreinis, G. Pinto, M. Vergne, J. Wu,7053\emph{A User's Guide for LattE integrale v1.7.2, 2013.} Software package7054LattE is available at \url{http://www.math.ucdavis.edu/~latte/}70557056\bibitem{BG} W. Bruns and J. Gubeladze. {\em Polytopes, rings, and K-theory}.7057Springer 2009.70587059\bibitem{BI} W. Bruns and B. Ichim. {\em Normaliz: algorithms for rational cones and affine monoids.}7060J. Algebra 324 (2010) 1098--1113.70617062\bibitem{BHIKS} W. Bruns, R. Hemmecke, B. Ichim, M. K�ppe and C. S�ger.7063{\em Challenging computations of Hilbert bases of cones associated with7064algebraic statistics }. Exp. Math.20 (2011), 25--33.70657066\bibitem{BIS} W. Bruns, B. Ichim and C. S�ger. {\em The power of7067pyramid decomposition in Normaliz}. J. Symb. Comp. 74 (2016), 513--536.70687069\bibitem{BK02} W .Bruns and R. Koch. {\em Computing the integral7070closure of an affine semigroup}. Univ. Iagell. Acta Math.707139 (2001), 59--70.70727073\bibitem{BSS} W. Bruns, R. Sieg and C. S�ger. {\em Normaliz 2013--2016.} To appear in the final report of the DFG SPP 1489. Preprint \url{ arXiv:1611.07965}.70747075\bibitem{BS} W. Bruns and C. S�ger. {\em The computation of weighted Ehrhart series in Normaliz.} J. Symb. Comp. 68 (2015), 75--86.70767077\bibitem{GAP-NmzInterface} S.~Gutsche, M.~Horn, C.~S�ger,7078\emph{NormalizInterface for GAP}.7079Available at \url{https://github.com/gap-packages/NormalizInterface}.70807081\bibitem{KV} M. K�ppe and S. Verdoolaege. {\em Computing7082parametric rational generating functions with a primal7083Barvinok algorithm.} Electron. J. Comb.708415, No. 1, Research Paper R16, 19 p. (2008).70857086\bibitem{Po} L. Pottier. {\em The Euclide algorithm in dimension7087$n$}. Research report, ISSAC 96, ACM Press 1996.70887089\bibitem{Sch} A. Sch\"{u}rmann, {\em Exploiting7090polyhedral symmetries in social choice.}7091Social Choice and Welfare \textbf{40} (2013), 1097--1110.7092\end{thebibliography}7093\end{document}709470957096