Skip to content

Commit 8c70f1c

Browse files
committed
Towards 2.19 for Normaliz 3.10.2
1 parent 062043b commit 8c70f1c

File tree

4 files changed

+54
-18
lines changed

4 files changed

+54
-18
lines changed

NormalizModule.cpp

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ using libnormaliz::ConeProperties;
2929
using libnormaliz::Sublattice_Representation;
3030
using libnormaliz::Type::InputType;
3131
using libnormaliz::AutomorphismGroup;
32+
using libnormaliz::Matrix;
3233

3334
#ifdef LIBNORMALIZ_DYNAMIC_BITSET_H
3435
using libnormaliz::dynamic_bitset;
@@ -179,11 +180,11 @@ static PyObject* CallPythonFuncOnOneArg(PyObject* function, PyObject* single_arg
179180
#ifndef NMZ_RELEASE
180181
static_assert(
181182
false,
182-
"Your Normaliz version (unknown) is too old! Update to 3.10.0 or newer.");
183+
"Your Normaliz version (unknown) is too old! Update to 3.10.2 or newer.");
183184
#endif
184185
#if NMZ_RELEASE < 31000
185186
static_assert(false,
186-
"Your Normaliz version is too old! Update to 3.10.0 or newer.");
187+
"Your Normaliz version is too old! Update to 3.10.2 or newer.");
187188
#endif
188189

189190
/***************************************************************************
@@ -774,6 +775,26 @@ NmzAutomorphismsToPython(const AutomorphismGroup< Integer >& grp)
774775
return list;
775776
}
776777

778+
template < typename Integer >
779+
static PyObject*
780+
NmzFusionDataToPython(const vector<vector<Matrix<Integer> > >& FusData)
781+
{
782+
int outer_list_size = FusData.size();
783+
784+
PyObject* outer_list = PyList_New(outer_list_size);
785+
786+
for(int ring = 0; ring < outer_list_size; ring++){
787+
int inner_list_size = FusData[ring].size();
788+
PyObject* inner_list = PyList_New(inner_list_size);
789+
for(int mat = 0; mat < inner_list_size; mat++){
790+
PyList_SetItem(inner_list, mat, NmzMatrixToPyList(FusData[ring][mat].get_elements()));
791+
}
792+
PyList_SetItem(outer_list, ring, inner_list);
793+
}
794+
return outer_list;
795+
}
796+
797+
777798
/***************************************************************************
778799
*
779800
* PyCapsule handler functions
@@ -1809,15 +1830,27 @@ _NmzResultImpl(Cone< Integer >* C, PyObject* prop_obj, const void* nf = nullptr)
18091830
case libnormaliz::ConeProperty::FVector:
18101831
return NmzVectorToPyList(C->getFVector());
18111832

1833+
case libnormaliz::ConeProperty::FVectorOrbits:
1834+
return NmzVectorToPyList(C->getFVectorOrbits());
1835+
18121836
case libnormaliz::ConeProperty::DualFVector:
18131837
return NmzVectorToPyList(C->getDualFVector());
18141838

1839+
case libnormaliz::ConeProperty::DualFVectorOrbits:
1840+
return NmzVectorToPyList(C->getDualFVectorOrbits());
1841+
18151842
case libnormaliz::ConeProperty::FaceLattice:
18161843
return NmzFacelatticeToPython(C->getFaceLattice());
18171844

1845+
case libnormaliz::ConeProperty::FaceLatticeOrbits:
1846+
return NmzFacelatticeToPython(C->getFaceLatticeOrbits());
1847+
18181848
case libnormaliz::ConeProperty::DualFaceLattice:
18191849
return NmzFacelatticeToPython(C->getDualFaceLattice());
18201850

1851+
case libnormaliz::ConeProperty::DualFaceLatticeOrbits:
1852+
return NmzFacelatticeToPython(C->getDualFaceLatticeOrbits());
1853+
18211854
case libnormaliz::ConeProperty::Automorphisms:
18221855
return NmzAutomorphismsToPython(C->getAutomorphismGroup(
18231856
libnormaliz::ConeProperty::Automorphisms));
@@ -1842,6 +1875,9 @@ _NmzResultImpl(Cone< Integer >* C, PyObject* prop_obj, const void* nf = nullptr)
18421875
return NmzAutomorphismsToPython(C->getAutomorphismGroup(
18431876
libnormaliz::ConeProperty::EuclideanAutomorphisms));
18441877

1878+
case libnormaliz::ConeProperty::FusionData:
1879+
return NmzFusionDataToPython(C->getFusionDataMatrix());
1880+
18451881
case libnormaliz::ConeProperty::Incidence:
18461882
return NmzVectorToPyList(C->getIncidence());
18471883

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ A full documentation is conatined in [Appendix E](doc/PyNormaliz.pdf) of the Nor
1313
## Requirements
1414

1515
* python 3.4 or higher
16-
* Normaliz 3.9.0 or higher <https://github.com/Normaliz/Normaliz/releases>
16+
* Normaliz 3.10.2 or higher <https://github.com/Normaliz/Normaliz/releases>
1717

1818
The source packages of the Normaliz realeases contain PyNormaliz.
1919

@@ -66,7 +66,7 @@ Note that some Normaliz output types must be specially encoded for python. Our H
6666
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). (Aoso see ee [this introduction](doc/PyNormaliz_Tutorial.pdf).) But we can use
6767

6868
print_series(C.HilbertSeries(HSOP = True))
69-
69+
7070
with the result
7171

7272
(1)
@@ -77,33 +77,33 @@ with the result
7777
One can also compute several data simultaneously and specify options ("PrimalMode" only added as an example, not because ot is particularly useful here):
7878

7979
C.Compute("LatticePoints", "Volume", "PrimalMode")
80-
80+
8181
Then
8282

8383
C.Volume()
84-
84+
8585
with the result
8686

8787
1
8888

8989
This is the lattice length of the diagonal in the square. The euclidean length, that has been computed simultaneously, is returned by
9090

9191
C.EuclideanVolume()
92-
92+
9393
with the expected value
9494

9595
'1.4142'
96-
96+
9797
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:
9898

9999
NmzResult(C.cone,"EuclideanVolume")
100100
1.4142135623730951
101-
101+
102102
One can find out whether a single goal has been computed by asking
103103

104104
C.IsComputed("Automorphisms")
105105
False
106-
106+
107107
If you use Compute instead of IsComputed, then Normaliz tries to compute the goal, and there are situations in which the computation is undesirable.
108108

109109
Algebraic polyhedra can be computed by PyNormaliz as well:
@@ -120,7 +120,7 @@ It is important to note that fractions and algebraic numbers must be encoded as
120120
Very hard to read! Somewhat better:
121121

122122
print_matrix(S)
123-
123+
124124
-1470/433*a+280/433 -1
125125
-32204/555417*a-668233/555417 -1
126126

@@ -131,24 +131,24 @@ But we can also get floating point approximations:
131131
-4.1545 -1.0000
132132
-1.2851 -1.0000
133133

134-
By using Python functions, the functionality of Normaliz can be extended. For example,
135-
134+
By using Python functions, the functionality of Normaliz can be extended. For example,
135+
136136
def intersection(cone1, cone2):
137137
intersection_ineq = cone1.SupportHyperplanes()+cone2.SupportHyperplanes()
138138
intersection_equat = cone1.Equations()+cone2.Equations()
139139
C = Cone(inequalities = intersection_ineq, equations = intersection_equat)
140140
return C
141-
141+
142142
computes the intersection of two cones. So
143143

144144
C1 = Cone(cone=[[1,2],[2,1]])
145145
C2 = Cone(cone=[[1,1],[1,3]])
146146
intersection(C1,C2).ExtremeRays()
147-
147+
148148
yeilds the result
149149

150150
[[1, 1], [1, 2]]
151-
151+
152152
If you want to see what Normaliz is doing (especually in longer computations) activate the terminal output by
153153

154154
C.setVerbose(True)

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = PyNormaliz
3-
version = 2.18
3+
version = 2.19
44
description = An interface to Normaliz
55
author = Sebastian Gutsche, Richard Sieg, Winfried Bruns
66
author_email = wbruns@uos.de

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333
extra_compile_args=['-std=c++14'],
3434
libraries=[ 'normaliz' ],
3535
**extra_kwds) ],
36-
36+
3737
package_data = {'': [ "COPYING", "GPLv2", "README.md" ] },
3838
)

0 commit comments

Comments
 (0)