next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Normaliz :: Keeping results of the computation by Normaliz

Keeping results of the computation by Normaliz

Normaliz prints the Hilbert basis and some auxiliary data as, e.g., the support hyperplanes, into files. When Normaliz is called within the package Normaliz, all the files created are deleted at the end of the function call by default. Sometimes it is desirable to keep these results for later use. To switch the file handling from "delete" to "keep", a filename has to be specified in the global variable nmzFilename.

i1 : nmzFilename="polytope";
i2 : setNmzOption("allf",true);
i3 : R=ZZ/37[x,y,z];
i4 : ehrhartRing {x^0,x^2,y^3,z^5};

Now all the files created by Normaliz are saved as polytope.suffix. The generators of the integral closure are in the file with suffix gen, and the functions of the package return always the content of this file. The support hyperplanes, the defining equations and congruences are printed into the file with suffix cst. For more suffixes see output files written by Normaliz. Use readNmzData to read the files into Macaulay 2 provided they have been written, except for the suffix cst you should use readMultipleNmzData as there are several matrices in this file. Which files are written depends on the input data and on the "computation mode" which is determined by the options set, here the option allf means that all possible data is written. For more options see setNmzOption.

i5 : extremeRays=readNmzData "ext"

o5 = | 0 0 0 1 |
     | 0 0 5 1 |
     | 0 3 0 1 |
     | 2 0 0 1 |

              4        4
o5 : Matrix ZZ  <--- ZZ
i6 : constraints=readMultipleNmzData "cst"

o6 = {| -15 -10 -6 30 |, | 0 |, | 0 |, | 0 0 0 1 |}
      | 0   0   1  0  |  | 4 |  | 5 |
      | 0   1   0  0  |
      | 1   0   0  0  |

o6 : List

The filename is kept during the Macaulay 2 process until another filename is specified.

i7 : nmzFilename="square";
i8 : nmzFilename=""; -- deletes the filename

The files are kept beyond the Macaulay 2 process. To delete them call the function rmNmzFiles. Assure yourself that the right filename is specified before calling the function! This function also resets nmzFilename to the empty string.

i9 : nmzFilename="polytope";
i10 : rmNmzFiles();
i11 : nmzFilename

o11 = 

If you want to change the directory where the files are saved (default is the current directory) you have two possibilities. If you want work in the same directory most of the time, you can define this in a file "start.m2" in the current directory and add a line in "init.m2" such that it is read when starting Macaulay 2. If you want to switch between directories more frequently, you can specify the directory in the global variable nmzDataPath.