GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
/*1* Normaliz2* Copyright (C) 2007-2014 Winfried Bruns, Bogdan Ichim, Christof Soeger3* This program is free software: you can redistribute it and/or modify4* it under the terms of the GNU General Public License as published by5* the Free Software Foundation, either version 3 of the License, or6* (at your option) any later version.7*8* This program is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11* GNU General Public License for more details.12*13* You should have received a copy of the GNU General Public License14* along with this program. If not, see <http://www.gnu.org/licenses/>.15*16* As an exception, when this program is distributed through (i) the App Store17* by Apple Inc.; (ii) the Mac App Store by Apple Inc.; or (iii) Google Play18* by Google Inc., then that store may impose any digital rights management,19* device limits and/or redistribution restrictions that are required by its20* terms of service.21*/2223#ifndef AUTOMORPHISM_H24#define AUTOMORPHISM_H2526#include <set>27#include <boost/dynamic_bitset.hpp>28#include "libnormaliz/matrix.h"29#include "libnormaliz/nmz_nauty.h"30#include "libnormaliz/HilbertSeries.h"3132namespace libnormaliz {33using namespace std;3435template<typename Integer> class Cone;36template<typename Integer> class Full_Cone;37template<typename Integer> class Isomorphism_Classes;3839template<typename Integer>40class Automorphism_Group {4142template<typename> friend class Cone;43template<typename> friend class Full_Cone;44template<typename> friend class Isomorphism_Classes;4546Matrix<Integer> Gens, LinForms, SpecialLinForms;4748vector<vector<key_t> > GenPerms;49vector<vector<key_t> > LinFormPerms;5051vector<vector<key_t> > GenOrbits;52vector<vector<key_t> > LinFormOrbits;5354vector<key_t> CanLabellingGens;5556vector<Matrix<Integer> > LinMaps;5758mpz_class order;5960bool from_HB; // indicates whether the Hilbert basis was used for the computation6162bool from_ambient_space;63bool from_input;6465bool LinMaps_computed;66bool graded;67bool inhomogeneous;6869bool make_linear_maps_primal(const Matrix<Integer>& GivenGens,const vector<vector<key_t> >& ComputedGenPerms);70void gen_data_via_lin_maps();71void linform_data_via_lin_maps();72void reset();7374public:7576BinaryMatrix<Integer> CanType; // see nauty7778const Matrix<Integer>& getGens() const;79const Matrix<Integer>& getLinForms() const;80const Matrix<Integer>& getSpecialLinForms() const;8182mpz_class getOrder() const;83vector<vector<key_t> > getGenPerms() const;84vector<vector<key_t> > getLinFormPerms() const;85vector<vector<key_t> > getGenOrbits() const;86vector<vector<key_t> > getLinFormOrbits() const;87vector<Matrix<Integer> > getLinMaps() const;88vector<key_t> getCanLabellingGens() const;89bool isFromAmbientSpace() const;90bool isGraded() const;91bool isInhomogeneous() const;92bool isFromHB() const;93bool isLinMapsComputed() const;94void setFromAmbeientSpace(bool on_off);95void setGraded(bool on_off);96void setInhomogeneous(bool on_off);97list<vector<Integer> > orbit_primal(const vector<Integer>& v) const;98void add_images_to_orbit(const vector<Integer>& v,set<vector<Integer> >& orbit) const;99100BinaryMatrix<Integer> getCanType();101102bool compute(const Matrix<Integer>& ExtRays,const Matrix<Integer>& GivenGens, bool given_gens_are_extrays,103const Matrix<Integer>& SupHyps,const Matrix<Integer>& GivenLinForms, bool given_llf_are_supps,104size_t nr_special_gens, const size_t nr_special_linforms);105106Automorphism_Group();107108}; // end class109110template<typename Integer> class Isomorphism_Classes;111112template<typename Integer>113class IsoType {114115template<typename> friend class Isomorphism_Classes;116117size_t rank;118Matrix<Integer> ExtremeRays;119size_t nrExtremeRays;120// Matrix<Integer> SupportHyperplanes;121size_t nrSupportHyperplanes;122Matrix<Integer> HilbertBasis; // without extreme rays123// size_t nrHilbertBasis; // with extreme rays, but not used124vector<Integer> Grading;125vector<Integer> Truncation;126// HilbertSeries HilbertSer;127mpq_class Multiplicity;128bool needs_Hilbert_basis;129130// For the coordinate transformation to the canonical basis131vector<key_t> CanLabellingGens;132Matrix<Integer> CanTransform;133Integer CanDenom;134vector<key_t> CanBasisKey;135136BinaryMatrix<Integer> CanType;137IsoType(); // constructs a dummy object138139public:140141bool isOfType(const Full_Cone<Integer>& C) const;142// bool isOfType(Cone<Integer>& C) const;143144IsoType(const Full_Cone<Integer>& C,bool& success); // success indicates whether a class could be created145// IsoType(Cone<Integer>& C, bool slim=true);146147// size_t getRank();148// Matrix<Integer> getExtremeRays() const;149// Matrix<Integer> getSupportHyperplanes() const;150const Matrix<Integer>& getHilbertBasis() const;151// vector<Integer> getGrading() const;152// vector<Integer> getTruncation() const;153// HilbertSeries getHilbertSeries() const;154mpq_class getMultiplicity() const;155const Matrix<Integer>& getCanTransform() const;156Integer getCanDenom() const;157BinaryMatrix<Integer> getCanType();158};159160template<typename Integer>161class Isomorphism_Classes {162163template<typename> friend class Cone;164template<typename> friend class Full_Cone;165166list<IsoType<Integer> > Classes;167168public:169170Isomorphism_Classes();171const IsoType<Integer>& find_type(Full_Cone<Integer>& C, bool& found) const;172const IsoType<Integer>& find_type(Cone<Integer>& C, bool& found) const;173void add_type(Full_Cone<Integer>& C, bool& success);174void add_type(Cone<Integer>& C);175};176177178// returns all data of nauty179template<typename Integer>180vector<vector<long> > compute_automs(const Matrix<Integer>& Gens, const size_t nr_special_gens, const Matrix<Integer>& LinForms,181const size_t nr_special_linforms, mpz_class& group_order, BinaryMatrix<Integer>& CanType);182183vector<vector<key_t> > convert_to_orbits(const vector<long>& raw_orbits);184185vector<vector<key_t> > cycle_decomposition(vector<key_t> perm, bool with_fixed_points=false);186187void pretty_print_cycle_dec(const vector<vector<key_t> >& dec, ostream& out);188189vector<vector<key_t> > keys(const list<boost::dynamic_bitset<> >& Partition);190191list<boost::dynamic_bitset<> > partition(size_t n, const vector<vector<key_t> >& Orbits);192193list<boost::dynamic_bitset<> > join_partitions(const list<boost::dynamic_bitset<> >& P1,194const list<boost::dynamic_bitset<> >& P2);195196vector<vector<key_t> > orbits(const vector<vector<key_t> >& Perms, size_t N);197198} // namespace199200//---------------------------------------------------------------------------201#endif202//---------------------------------------------------------------------------203204205