Skip to content

Commit f9aef01

Browse files
author
Winfried Bruns
committed
Automorphisms extended
1 parent 016748b commit f9aef01

File tree

5 files changed

+57
-26
lines changed

5 files changed

+57
-26
lines changed

NormalizModule.cpp

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -710,26 +710,55 @@ static PyObject*
710710
NmzAutomorphismsToPython(const AutomorphismGroup< Integer >& grp)
711711
{
712712

713-
PyObject* list = PyList_New(4);
713+
PyObject* list = PyList_New(6);
714714

715715
PyList_SetItem(list, 0, NmzToPyNumber(grp.getOrder()));
716+
PyList_SetItem(list, 1, BoolToPyBool(grp.IsIntegralityChecked()));
717+
PyList_SetItem(list, 2, BoolToPyBool(grp.IsIntegral()));
718+
719+
if(grp.IsInput() || grp.IsAmbient()){
720+
PyObject* current = PyList_New(2);
721+
PyList_SetItem(current, 0, NmzMatrixToPyList(grp.getGensPerms()));
722+
PyList_SetItem(current, 1, NmzMatrixToPyList(grp.getGensOrbits()));
723+
PyList_SetItem(list, 3, current);
724+
725+
current = PyList_New(2);
726+
vector<vector<long> > Empty;
727+
PyList_SetItem(current, 0, NmzMatrixToPyList(Empty));
728+
PyList_SetItem(current, 1, NmzMatrixToPyList(Empty));
729+
PyList_SetItem(list, 4, current);
730+
731+
if(grp.IsAmbient()){
732+
current = PyList_New(2);
733+
PyList_SetItem(current, 0, NmzMatrixToPyList(grp.getLinFormsPerms()));
734+
PyList_SetItem(current, 1, NmzMatrixToPyList(grp.getLinFormsOrbits()));
735+
PyList_SetItem(list, 5, current);
736+
}
737+
else{
738+
vector<vector<long> > Empty;
739+
PyList_SetItem(current, 0, NmzMatrixToPyList(Empty));
740+
PyList_SetItem(current, 1, NmzMatrixToPyList(Empty));
741+
PyList_SetItem(list, 5, current);
742+
}
743+
}
744+
else{
745+
PyObject* current = PyList_New(2);
746+
PyList_SetItem(current, 0, NmzMatrixToPyList(grp.getExtremeRaysPerms()));
747+
PyList_SetItem(current, 1, NmzMatrixToPyList(grp.getExtremeRaysOrbits()));
748+
PyList_SetItem(list, 3, current);
716749

717-
PyObject* current = PyList_New(2);
718-
PyList_SetItem(current, 0, NmzMatrixToPyList(grp.getExtremeRaysPerms()));
719-
PyList_SetItem(current, 1, NmzMatrixToPyList(grp.getExtremeRaysOrbits()));
720-
PyList_SetItem(list, 1, current);
721-
722-
current = PyList_New(2);
723-
PyList_SetItem(current, 0, NmzMatrixToPyList(grp.getVerticesPerms()));
724-
PyList_SetItem(current, 1, NmzMatrixToPyList(grp.getVerticesOrbits()));
725-
PyList_SetItem(list, 2, current);
750+
current = PyList_New(2);
751+
PyList_SetItem(current, 0, NmzMatrixToPyList(grp.getVerticesPerms()));
752+
PyList_SetItem(current, 1, NmzMatrixToPyList(grp.getVerticesOrbits()));
753+
PyList_SetItem(list, 4, current);
726754

727-
current = PyList_New(2);
728-
PyList_SetItem(current, 0,
729-
NmzMatrixToPyList(grp.getSupportHyperplanesPerms()));
730-
PyList_SetItem(current, 1,
731-
NmzMatrixToPyList(grp.getSupportHyperplanesOrbits()));
732-
PyList_SetItem(list, 3, current);
755+
current = PyList_New(2);
756+
PyList_SetItem(current, 0,
757+
NmzMatrixToPyList(grp.getSupportHyperplanesPerms()));
758+
PyList_SetItem(current, 1,
759+
NmzMatrixToPyList(grp.getSupportHyperplanesOrbits()));
760+
PyList_SetItem(list, 5, current);
761+
}
733762

734763
return list;
735764
}
@@ -1725,6 +1754,10 @@ _NmzResultImpl(Cone< Integer >* C, PyObject* prop_obj, void* nf = nullptr)
17251754
case libnormaliz::ConeProperty::AmbientAutomorphisms:
17261755
return NmzAutomorphismsToPython(C->getAutomorphismGroup(
17271756
libnormaliz::ConeProperty::AmbientAutomorphisms));
1757+
1758+
case libnormaliz::ConeProperty::InputAutomorphisms:
1759+
return NmzAutomorphismsToPython(C->getAutomorphismGroup(
1760+
libnormaliz::ConeProperty::InputAutomorphisms));
17281761

17291762
case libnormaliz::ConeProperty::CombinatorialAutomorphisms:
17301763
return NmzAutomorphismsToPython(C->getAutomorphismGroup(

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.14
3+
version = 2.15
44
description = An interface to Normaliz
55
author = Sebastian Gutsche, Richard Sieg
66
author_email = [email protected]

tests/autom.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ Test automorphism group
44
>>> from PyNormaliz import Cone, NmzCone, NmzResult
55
>>> V = [[-1, -1, 1], [-1, 0, 1], [-1, 1, 1], [0, -1, 1], [0, 0, 1], [0, 1, 1], [1, -1, 1], [1, 0, 1], [1, 1, 1]]
66
>>> cube2 = NmzCone(vertices=V)
7-
>>> NmzResult(cube2,"Automorphisms") == [8, [[], []], [[[0, 2, 1, 3], [1, 0, 3, 2]], [[0, 1, 2, 3]]], [[[1, 0, 3, 2], [0, 2, 1, 3]], [[0, 1, 2, 3]]]]
7+
>>> NmzResult(cube2,"Automorphisms") == [8, True, True, [[], []], [[[0, 2, 1, 3], [1, 0, 3, 2]], [[0, 1, 2, 3]]], [[[1, 0, 3, 2], [0, 2, 1, 3]], [[0, 1, 2, 3]]]]
88
True
99

tests/generic_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class Test2(GenericPyNormalizTest):
192192

193193
# expected results
194194
AffineDim = 2
195-
Automorphisms = [8, [[], []], [[[0, 2, 1, 3], [1, 0, 3, 2]], [[0, 1, 2, 3]]], [[[1, 0, 3, 2], [0, 2, 1, 3]], [[0, 1, 2, 3]]]]
195+
Automorphisms = [8, True, True, [[], []], [[[0, 2, 1, 3], [1, 0, 3, 2]], [[0, 1, 2, 3]]], [[[1, 0, 3, 2], [0, 2, 1, 3]], [[0, 1, 2, 3]]]]
196196
Congruences = []
197197
Dehomogenization = normaliz_error
198198
EmbeddingDim = 5

tests/test_rational_cones.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,15 @@ True
6767
True
6868
>>> len(NmzResult(cube2, "FaceLattice")) == 10
6969
True
70-
>>> cube1.Automorphisms() == [8, [[], []], [[[0, 2, 1, 3], [1, 0, 3, 2]], [[0, 1, 2, 3]]], [[[1, 0, 3, 2], [0, 2, 1, 3]], [[0, 1, 2, 3]]]]
70+
>>> cube1.Automorphisms() == [8, True, True, [[], []], [[[0, 2, 1, 3], [1, 0, 3, 2]], [[0, 1, 2, 3]]], [[[1, 0, 3, 2], [0, 2, 1, 3]], [[0, 1, 2, 3]]]]
7171
True
72-
>>> cube1.Automorphisms() == [8, [[], []], [[[0, 2, 1, 3], [1, 0, 3, 2]], [[0, 1, 2, 3]]], [[[1, 0, 3, 2], [0, 2, 1, 3]], [[0, 1, 2, 3]]]]
72+
>>> cube1.CombinatorialAutomorphisms() == [8, False, False, [[], []], [[[0, 2, 1, 3], [1, 0, 3, 2]], [[0, 1, 2, 3]]], [[[1, 0, 3, 2], [0, 2, 1, 3]], [[0, 1, 2, 3]]]]
7373
True
74-
>>> cube1.CombinatorialAutomorphisms() == [8, [[], []], [[[0, 2, 1, 3], [1, 0, 3, 2]], [[0, 1, 2, 3]]], [[[1, 0, 3, 2], [0, 2, 1, 3]], [[0, 1, 2, 3]]]]
74+
>>> cube1.RationalAutomorphisms() == [8, True, True, [[], []], [[[0, 2, 1, 3], [1, 0, 3, 2]], [[0, 1, 2, 3]]], [[[1, 0, 3, 2], [0, 2, 1, 3]], [[0, 1, 2, 3]]]]
7575
True
76-
>>> cube1.RationalAutomorphisms() == [8, [[], []], [[[0, 2, 1, 3], [1, 0, 3, 2]], [[0, 1, 2, 3]]], [[[1, 0, 3, 2], [0, 2, 1, 3]], [[0, 1, 2, 3]]]]
76+
>>> cube1.RationalAutomorphisms() == [8, True, True, [[], []], [[[0, 2, 1, 3], [1, 0, 3, 2]], [[0, 1, 2, 3]]], [[[1, 0, 3, 2], [0, 2, 1, 3]], [[0, 1, 2, 3]]]]
7777
True
78-
>>> cube1.RationalAutomorphisms() == [8, [[], []], [[[0, 2, 1, 3], [1, 0, 3, 2]], [[0, 1, 2, 3]]], [[[1, 0, 3, 2], [0, 2, 1, 3]], [[0, 1, 2, 3]]]]
79-
True
80-
>>> cube1.EuclideanAutomorphisms() == [8, [[], []], [[[0, 2, 1, 3], [1, 0, 3, 2]], [[0, 1, 2, 3]]], [[[1, 0, 3, 2], [0, 2, 1, 3]], [[0, 1, 2, 3]]]]
78+
>>> cube1.EuclideanAutomorphisms() == [8, False, False, [[], []], [[[0, 2, 1, 3], [1, 0, 3, 2]], [[0, 1, 2, 3]]], [[[1, 0, 3, 2], [0, 2, 1, 3]], [[0, 1, 2, 3]]]]
8179
True
8280
>>> cube1.Incidence() == [[0, 0, 1, 1], [0, 1, 0, 1], [1, 0, 1, 0], [1, 1, 0, 0]]
8381
True

0 commit comments

Comments
 (0)