4
#include "gfanapplication.h"
5
#include "minkowskisum.h"
6
#include "newtonpolytope.h"
7
#include "buchberger.h"
13
#include "tropical2.h"
14
#include "dimension.h"
18
#include "tropicaltraverse.h"
19
#include "traverser_tropical.h"
20
#include "symmetrictraversal.h"
21
#include "traverser_stableintersection.h"
23
class SymmetriesApplication : public GFanApplication
25
SimpleOption optionSymmetry;
26
SimpleOption optionTorusSymmetry;
28
bool includeInDefaultInstallation()
32
const char *helpText()
34
return "This program computes the symmetries of a polynomial ideal. The program is slow, so think before using it. Use --symmetry to give hints about which subgroup of the symmetry group could be useful. The program checks each element of the specified subgroup to see if it preserves the ideal.\n";
36
SymmetriesApplication():
37
optionSymmetry("--symmetry","Specify subgroup to be searched for permutations keeping the ideal fixed."),
38
optionTorusSymmetry("--symsigns","Specify for each generator of the group specified wiht --symmetry an element of ${-1,+1}^n$ which by its multiplication on the variables together with the permutation is expected to keep the ideal fixed.")
50
AsciiPrinter p(Stdout);
51
PolynomialSet gb=P.parsePolynomialSetWithRing();
52
int n=gb.numberOfVariablesInRing();
54
WeightReverseLexicographicTermOrder T(IntegerVector::allOnes(n));
59
SymmetryGroup signSymmetries(2*n);
60
if(optionSymmetry.getValue())
62
IntegerVectorList generators=P.parseIntegerVectorList();
64
IntegerMatrix torusAction(generators.size(),n);
65
if(optionTorusSymmetry.getValue())
67
torusAction=rowsToIntegerMatrix(P.parseIntegerVectorList());
71
for(int i=0;i<torusAction.getHeight();i++)
72
for(int j=0;j<torusAction.getWidth();j++)
75
IntegerVectorList doubleGenerators;
77
for(IntegerVectorList::const_iterator i=generators.begin();i!=generators.end();i++,I++)
78
doubleGenerators.push_back(SymmetryGroup::combinePermutationAndSignChanges(*i,torusAction[I]));
79
signSymmetries.computeClosure(doubleGenerators);
83
if(optionTorusSymmetry.getValue())
85
debug<<"Option --symsigns can only be used together with --symmetry\n";
88
IntegerVectorList doubleGenerators;
89
IntegerVector cycle(n);
90
for(int i=0;i<n;i++)cycle[i]=((i+1)%n);
91
IntegerVector transposition=SymmetryGroup::identity(n);
94
doubleGenerators.push_back(SymmetryGroup::combinePermutationAndSignChanges(cycle,IntegerVector::allOnes(n)));
95
doubleGenerators.push_back(SymmetryGroup::combinePermutationAndSignChanges(transposition,IntegerVector::allOnes(n)));
96
signSymmetries.computeClosure(doubleGenerators);
99
IntegerVectorList doubleGenerators2;
101
for(SymmetryGroup::ElementContainer::const_iterator i=signSymmetries.elements.begin();i!=signSymmetries.elements.end();i++)
103
IntegerVector permutation,signChanges;
104
SymmetryGroup::extractPermuationAndSignChanges(*i,permutation,signChanges);
106
log1 debug<<"Checking "<<permutation<<" "<<signChanges<<"\n";
107
PolynomialSet b2=SymmetryGroup::permutePolynomialSet(gb,permutation);
108
//log0 AsciiPrinter(Stderr).printPolynomialSet(b2);
110
b2=b2.torusAct(integerVectorToFieldVector(signChanges,Q));
111
if(areIdealsEqual(gb,b2))
113
doubleGenerators2.push_back(*i);
118
IntegerVectorList permutations;
119
IntegerVectorList signChangess;
120
for(IntegerVectorList::const_iterator i=doubleGenerators2.begin();i!=doubleGenerators2.end();i++)
122
IntegerVector permutation,signChanges;
123
SymmetryGroup::extractPermuationAndSignChanges(*i,permutation,signChanges);
124
permutations.push_back(permutation);
125
signChangess.push_back(signChanges);
128
pout<<permutations<<signChangess;
134
static SymmetriesApplication theApplication;