An interface to Normaliz
Project description
PyNormaliz - A python interface to Normaliz
PyNormaliz provides an interface to Normaliz via libNormaliz. It offers the complete functionality of Normaliz, and can be used interactively from python. For a first example, see this introduction by Richard Sieg (Slightly outdated: for the installation follow the instructions below).
A full documentation is contained in Appendix E of the Normaliz manual.
Requirements
- python 3.4 or higher
- Normaliz 3.10.2 or higher https://github.com/Normaliz/Normaliz/releases
The source packages of the Normaliz releases contain PyNormaliz.
Installation
The PyNormaliz install script assumes that you have executed
./install_normaliz_with_eantic.sh
within the Normaliz directory. To install PyNormaliz navigate to the Normaliz directory and type
./install_pynormaliz.sh --user
Usage
The command Cone creates a cone (and a lattice), and the member functions of Cone compute its properties. For a full list of input and output properties, see the Normaliz manual.
Start by
import PyNormaliz
from PyNormaliz import *
To create a simple example, type
C = Cone(cone = [[1,0],[0,1]])
All possible Normaliz input types can be given as keyword arguments.
The member functions allow the computation of the data of our cone. For example,
C.HilbertBasis()
returns what its name says:
[[0, 1], [1, 0]]
is the matrix of the two Hilbert basis vectors. The output matrices of PyNormaliz can be used also in Normaliz input files.
One can pass options to the compute functions as in
C.HilbertSeries(HSOP = True)
Note that some Normaliz output types must be specially encoded for python. Our Hilbert Series is returned as
[[1], [1, 1], 0]
to be read as follows: [1] is the numerator polynomial, [1,1] is the vector of exponents of t that occur in the denominator, which is (1-t)(1-t) in our case, and 0 is the shift. So the Hilbert series is given by the rational function 1/(1-t)(1-t). (Also see this introduction.) But we can use
print_series(C.HilbertSeries(HSOP = True))
with the result
(1)
---------
(1 - t)^2
One can also compute several data simultaneously and specify options ("PrimalMode" only added as an example, not because it is particularly useful here):
C.Compute("LatticePoints", "Volume", "PrimalMode")
Then
C.Volume()
with the result
1
This is the lattice length of the diagonal in the square. The euclidean length, that has been computed simultaneously, is returned by
C.EuclideanVolume()
with the expected value
'1.4142'
Floating point numbers are formatted with 4 decimal places and returned as strings (may change). If you want the euclideal volume at the maximum floating point precision, you can use the low level interface which is intermediate between the class Cone and libnormaliz:
NmzResult(C.cone,"EuclideanVolume")
1.4142135623730951
One can find out whether a single goal has been computed by asking
C.IsComputed("Automorphisms")
False
If you use Compute instead of IsComputed, then Normaliz tries to compute the goal, and there are situations in which the computation is undesirable.
Algebraic polyhedra can be computed by PyNormaliz as well:
nf = [ "a2-2", "a", "1.4+/-0.1" ]
D = Cone( number_field = nf, cone = [["1/7a+3/2", "-5a"],["4/83a-1","97/81"]])
It is important to note that fractions and algebraic numbers must be encoded as strings for the input.
S = D.SupportHyperplanes()
S
[['-1470/433*a+280/433', '-1'], ['-32204/555417*a-668233/555417', '-1']]
Very hard to read! Somewhat better:
print_matrix(S)
-1470/433*a+280/433 -1
-32204/555417*a-668233/555417 -1
But we can also get floating point approximations:
print_matrix(D.SuppHypsFloat())
-4.1545 -1.0000
-1.2851 -1.0000
By using Python functions, the functionality of Normaliz can be extended. For example,
def intersection(cone1, cone2):
intersection_ineq = cone1.SupportHyperplanes()+cone2.SupportHyperplanes()
intersection_equat = cone1.Equations()+cone2.Equations()
C = Cone(inequalities = intersection_ineq, equations = intersection_equat)
return C
computes the intersection of two cones. So
C1 = Cone(cone=[[1,2],[2,1]])
C2 = Cone(cone=[[1,1],[1,3]])
intersection(C1,C2).ExtremeRays()
yeilds the result
[[1, 1], [1, 2]]
If you want to see what Normaliz is doing (especually in longer computations) activate the terminal output by
C.setVerbose(True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file pynormaliz-2.21.tar.gz
.
File metadata
- Download URL: pynormaliz-2.21.tar.gz
- Upload date:
- Size: 321.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ef392d0f04e8f41d8eb593c2a8ff1434ea6ae5b379633d44d4bc47068ed5e43 |
|
MD5 | a510feeb458876f457ffdd23548ec35f |
|
BLAKE2b-256 | 2918eac622d4180611edfa59a32a74ba737686fbd87de398fc38b67cf30e9b85 |
File details
Details for the file PyNormaliz-2.21-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: PyNormaliz-2.21-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 71.2 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 804f94ade661f2409e6bcd619c2baf1e5a2a4c1fbd83c45868f77f8add1be567 |
|
MD5 | a598fbb018ac5b28643f5c1dce58e697 |
|
BLAKE2b-256 | 099fd92ab18e19ddf18ce635dcb292fb22de6566dfeea0d7744e51d74cd81312 |
File details
Details for the file PyNormaliz-2.21-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: PyNormaliz-2.21-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 67.5 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7be9025e1435b6e14099ce2d14c785c39047498c0f9d263567dca080b689eb37 |
|
MD5 | fa685912dd950ee0a4dbe02283f22346 |
|
BLAKE2b-256 | d9afd38ea9713f3334b5fb256d1f04742783f3d76d09553c630d1937ce6ecbb2 |
File details
Details for the file PyNormaliz-2.21-cp312-cp312-macosx_11_0_arm64.whl
.
File metadata
- Download URL: PyNormaliz-2.21-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 8.7 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4726e1c08370080f2d73bd810f88f0b8c9c28706a1e9ffee42e4790aacc3f361 |
|
MD5 | 143e1ab8a3214926b98700eb259ae9ac |
|
BLAKE2b-256 | d7f2616465437d7a936b326ea2ce0e7b810767f54c68007b868f44e7b36d8528 |
File details
Details for the file PyNormaliz-2.21-cp312-cp312-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: PyNormaliz-2.21-cp312-cp312-macosx_10_9_x86_64.whl
- Upload date:
- Size: 10.3 MB
- Tags: CPython 3.12, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26001f357f69a68ee451d33b391141f164d7b4d3c3ce862cf4764b95c5d2c8ff |
|
MD5 | b27023306f0fc51d0326f7b30787f7f4 |
|
BLAKE2b-256 | 845491e4f31651e960511688260be78c75d12ad2b9a6e9e5ed20deefc15725fc |
File details
Details for the file PyNormaliz-2.21-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: PyNormaliz-2.21-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 71.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8eecf43307f4cf7e081ad728b23d9b01a78cfc8c9b0919e05df36167d6542d3c |
|
MD5 | 24ad3382cbbf30f6f918a8ccd6350454 |
|
BLAKE2b-256 | 00ce0870609808ebd8faf4863c0e3f6db87173da9cb869aba529f0e4c090b2f8 |
File details
Details for the file PyNormaliz-2.21-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: PyNormaliz-2.21-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 67.5 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0d012515a20072e99d6cf29ce505108d18d10f379e3af3861a37953cd695f48 |
|
MD5 | 2e74f4f660211bdfda6a286ddcbeec8a |
|
BLAKE2b-256 | a0be3d35e2d3a148ef784b3911473f887ffe270ef941f52c1cb1ccb389f11458 |
File details
Details for the file PyNormaliz-2.21-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: PyNormaliz-2.21-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 8.7 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9124a0d2f723cbccb0377e24b97fa2330184159078eaf0a35260cd8427891d5e |
|
MD5 | 7c8fdb640aa60cd5f7c0d0082668f78e |
|
BLAKE2b-256 | b2f92438702aad7a2dbdf16b299e9397ac6b71164a268d51130538de7e810e51 |
File details
Details for the file PyNormaliz-2.21-cp311-cp311-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: PyNormaliz-2.21-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 10.3 MB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f7b26748a385c4d044b61652ee017c4ffdfa962c56faca04a027eb263c6138b |
|
MD5 | 05cccb0759b7a46e739c15a48c49ba4a |
|
BLAKE2b-256 | 586db74f3558ea19695646b67c849aedcffc714bbfb26879c760d76a696482f3 |
File details
Details for the file PyNormaliz-2.21-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: PyNormaliz-2.21-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 71.2 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 565c1c0c65b78661df726bb33415d7c70fd12f7e5785d0cee3391b6ee13e1149 |
|
MD5 | 9dfec1e9203b7cc863bca29311a5dd5b |
|
BLAKE2b-256 | c5d70b1345ee81ac924384b9f150d345a7eb067b7d8fd2d6d9c255ae33daadaa |
File details
Details for the file PyNormaliz-2.21-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: PyNormaliz-2.21-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 67.5 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e92460798fa0e93a3217f9bd26398bb772b763b18034803f2d30264c59a90d8 |
|
MD5 | a8be4f9506c7b5aeed11a15f2ef2efa0 |
|
BLAKE2b-256 | fa06179216d07e7f54e0e6de1c134d853a532d760c59bebf8ab92265872fdf7a |
File details
Details for the file PyNormaliz-2.21-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: PyNormaliz-2.21-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 8.7 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d572e279777b5d1141bb3f26adfa9739c5366d419e187aa2fa944ecc5fa7135b |
|
MD5 | 46d1947b7e04ee63d479ca3d93e668cd |
|
BLAKE2b-256 | 0d7eed9d72304132ed86a3ad9a097cd4b28afc7f5d7ddbef1b40a149a155eb74 |
File details
Details for the file PyNormaliz-2.21-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: PyNormaliz-2.21-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 10.3 MB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c34df36c2a8de225eb78bd488ec957e60d4ade6f98b2c5dcb78285a20a5d39a4 |
|
MD5 | 30fa0f512a8ae26d43c1843dbad9a371 |
|
BLAKE2b-256 | 982773610a0202ebc664bed1e5ea967027c9a928c78544637bdd424754274277 |
File details
Details for the file PyNormaliz-2.21-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: PyNormaliz-2.21-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 71.2 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ff4c300ba2922763146029570ebef50cb54137bd5ad0325d64cdea043d0dcd6 |
|
MD5 | c9d22726bd61c3405a302dab4a02b81b |
|
BLAKE2b-256 | 426d80205af484013003638c269c1187b0b2f79755e01741409aabe842107518 |
File details
Details for the file PyNormaliz-2.21-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: PyNormaliz-2.21-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 67.5 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82f95e9a00e0e6b116ab49deb8369be2e71d7219284de42031c5db0b7f987572 |
|
MD5 | feff6173776eb50a3e0ffe62ed8a8a1d |
|
BLAKE2b-256 | 512c13746d680b701ad9ad5a238381568436b72361b1e502ce7342d7dcfb3ca8 |
File details
Details for the file PyNormaliz-2.21-cp39-cp39-macosx_11_0_arm64.whl
.
File metadata
- Download URL: PyNormaliz-2.21-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 8.7 MB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31289a73fcd89f1df59721239f9a1961ddca4785f79608b7fd3eaf35352ae16b |
|
MD5 | 7b40a2f5ff81bb90f256bdabf6b366cf |
|
BLAKE2b-256 | 276a572f4048841952ef52c825b21776b284427d38049b6a8c6b86243045ccea |
File details
Details for the file PyNormaliz-2.21-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: PyNormaliz-2.21-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 10.3 MB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ae6802e2611b1fbbeb47192bd69c81d4fd583799d56c225cfa2663619c2d768 |
|
MD5 | dd68d669b380f1c2a6e26d5aae4ca9b3 |
|
BLAKE2b-256 | bb13682af2099241780911a648002e1a7c2a75af9e11b7aa8c00f28f0410a541 |