/* * gfan_symmetry.h * * Created on: Oct 22, 2010 * Author: anders */ #ifndef GFANLIB_SYMMETRY_H_INCLUDED #define GFANLIB_SYMMETRY_H_INCLUDED #include #include "gfanlib_vector.h" #include "gfanlib_matrix.h" namespace gfan{ /** * The permutation class represents an element in the symmetric group S_n. */ class Permutation:public IntVector { // IntVector data; public: /** * Returns true if a contains the elements from 0 up to a.size()-1. */ static bool isPermutation(IntVector const &a); /** * Returns true if all rows of the matrix contains the elements 0 up to m.getWidth()-1. */ static bool arePermutations(IntMatrix const &m); /** * Generates the identity permutation on n elements. */ Permutation(int n): IntVector(n) { for(int i=0;i ElementContainer; ElementContainer elements;//Make this private int size()const { return elements.size(); } int sizeOfBaseSet()const; /** The set of vectors which cannot be improved lexicographically by applying an element from the group is a convex set. Its closure is a polyhedral cone. This routine returns a set of inequalities The returned list does not contain the zero vector. */ ZMatrix fundamentalDomainInequalities()const; SymmetryGroup(int n); void computeClosure(Permutation const &v); void computeClosure(IntMatrix const &l); IntMatrix getGenerators()const; int orbitSize(ZVector const &stable)const; bool isTrivial()const; /** The symmetry group acts on vectors by permuting the entries. The following routine returns a unique representative for the orbit containing v. This makes it easy to check if two elements are in the same orbit. The permutation used to get this representative is stored in *usedPermutation (if pointer not 0). */ ZVector orbitRepresentative(ZVector const &v, Permutation *usedPermutation=0)const; /** This routine works as orbitRepresentative() except that the symmetry group considered is only the subgroup keeping the vector fixed fixed. */ ZVector orbitRepresentativeFixing(ZVector const &v, ZVector const &fixed)const; // Methods for highly optimized symmetry group computations: void createTrie(); }; /** * Sorts v and returns the number of swaps performed. */ int mergeSort(IntVector &v); } #endif /* GFAN_SYMMETRY_H_ */