Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 418346/****************************************************************************1**2*A GAP_present.c ANUPQ source Eamonn O'Brien3*A & Frank Celler4*A & Benedikt Rothe5**6*Y Copyright 1995-1997, Lehrstuhl D fuer Mathematik, RWTH Aachen, Germany7*Y Copyright 1995-1997, School of Mathematical Sciences, ANU, Australia8**9*/10#include "pq_defs.h"11#include "pcp_vars.h"12#include "pga_vars.h"13#include "constants.h"14#include "pq_functions.h"15#include "menus.h"161718/****************************************************************************19**20*F print_GAP_word21** print out a word of a pcp presentation22*/23void print_GAP_word(FILE *file, int ptr, struct pcp_vars *pcp)24{25register int *y = y_address;2627int gen, exp;28int i;29int count;30#include "access.h"3132if (ptr == 0)33fprintf(file, " One(F)");34else if (ptr > 0)35fprintf(file, " F.%d", ptr);36else {37ptr = -ptr + 1;38count = y[ptr];39fprintf(file, " %s", (1 < count) ? "(" : "");40for (i = 1; i <= count; i++) {41exp = FIELD1(y[ptr + i]);42gen = FIELD2(y[ptr + i]);43fprintf(file, "F.%d", gen);44if (exp != 1)45fprintf(file, "^%d", exp);46if (i != count)47fprintf(file, "*");48}49if (1 < count)50fprintf(file, ")");51}52}535455/****************************************************************************56**57*F GAP_presentation58** write pq presentation to file in GAP format59*/60void GAP_presentation(FILE *file, struct pcp_vars *pcp, int aspcgroup)61{62register int *y = y_address;6364int i;65int j;66int k;67int l;68int p1;69int p2;70int weight;71int comma;72int ndgen = pcp->ndgen;73int dgen = pcp->dgen;7475#include "access.h"7677/* construct a free group with enough generators */78fprintf(file, "F := FreeGroup( %d );\n", pcp->lastg);7980if (aspcgroup) {81fprintf(file, "F := PcGroupFpGroupNC( F / [\n");82} else83fprintf(file, "F := F / [\n");8485/* write power-relators with possible non-trivial rhs */86comma = 0;87k = y[pcp->clend + pcp->cc - 1];88for (i = 1; i <= k; i++) {89if (comma)90fprintf(file, ",\n");91else92comma = 1;93p2 = y[pcp->ppower + i];94if (p2 == 0)95fprintf(file, " F.%d^%d", i, pcp->p);96else {97fprintf(file, " F.%d^%d /", i, pcp->p);98print_GAP_word(file, p2, pcp);99}100}101102/* write power-relators with trivial rhs */103for (i = k + 1; i <= pcp->lastg; ++i) {104if (comma)105fprintf(file, ",\n");106else107comma = 1;108fprintf(file, " F.%d^%d", i, pcp->p);109}110111/* write commutator-relators */112for (i = 2; i <= k; i++) {113weight = WT(y[pcp->structure + i]);114p1 = y[pcp->ppcomm + i];115l = MIN(i - 1, y[pcp->clend + pcp->cc - weight]);116for (j = 1; j <= l; j++) {117p2 = y[p1 + j];118if (p2 != 0) {119fprintf(file, ",\n");120fprintf(file, " Comm( F.%d, F.%d ) /", i, j);121print_GAP_word(file, p2, pcp);122}123}124}125126if (aspcgroup)127fprintf(file, "] );\n");128else129fprintf(file, "];\n");130131/* store the relation between pc gens and fp gens */132fprintf(file, "MapImages := [];\n");133for (i = 1; i <= ndgen; i++) {134p2 = y[dgen + i];135fprintf(file, "MapImages[%d] := ", i);136print_GAP_word(file, p2, pcp);137fprintf(file, ";\n");138}139}140141142/****************************************************************************143**144*F MakeNameList145** create p-group generation identifier for group146*/147char *nextnumber(char *ident)148{149while (*ident != '\0' && *ident != '#')150ident++;151if (*ident == '#')152ident++;153return ident;154}155156void MakeNameList(FILE *file, char *ident)157{158int first = 1;159160fprintf(file, "SetANUPQIdentity( F, [ ");161while (*(ident = nextnumber(ident)) != '\0') {162if (!first)163fprintf(file, ",");164first = 0;165fprintf(file, "[");166do167fprintf(file, "%c", *ident);168while (*++ident != ';');169ident++;170fprintf(file, ",");171do {172fprintf(file, "%c", *ident);173ident++;174} while ('0' <= *ident && *ident <= '9');175fprintf(file, "]");176}177fprintf(file, " ] );\n");178}179180181/****************************************************************************182**183*F write_GAP_library184** write GAP library file in form suitable for reading into GAP185*/186int countcall = 0;187188void write_GAP_library(FILE *file, struct pcp_vars *pcp)189{190/* if this is the first call initialise 'ANUgroups' */191if (countcall == 0) {192fprintf(file, "ANUPQgroups := [];\n");193fprintf(file, "ANUPQautos := [];\n\n");194}195countcall++;196197/* write function call to <countcall>.th position of <ANUPQgroups> */198fprintf(file, "## group number: %d\n", countcall);199fprintf(file, "ANUPQgroups[%d] := function( L )\n", countcall);200fprintf(file, "local MapImages, F;\n\n");201202/* write the GAP presentation to file */203GAP_presentation(file, pcp, 0);204205/* convert <F> to a pc group in descendants case206... has to be done here; otherwise, we lose the property/attributes */207fprintf(file, "if IsList(L) then\n F := PcGroupFpGroupNC(F);\nfi;\n");208209/* add info. whether group is capable, and its nuclear and mult'r ranks*/210fprintf(file, "SetIsCapable(F, %s);\n", (pcp->newgen) ? "true" : "false");211fprintf(file, "SetNuclearRank(F, %d);\n", pcp->newgen);212fprintf(file, "SetMultiplicatorRank (F, %d);\n", pcp->multiplicator_rank);213214/* add the pq identitfier */215MakeNameList(file, pcp->ident);216217/* add the group <F> to <L> */218fprintf(file, "if IsList(L) then\n Add( L, F );\n");219fprintf(file, "else\n L.group := F;\n L.map := MapImages;\nfi;");220221fprintf(file, "\nend;\n\n\n");222}223224225/****************************************************************************226**227*F GAP_auts228** write a description of the automorphism group of the current229** group to a file in a format suitable for input to GAP230*/231void GAP_auts(FILE *file,232int ***central,233int ***stabiliser,234struct pga_vars *pga,235struct pcp_vars *pcp)236{237register int *y = y_address;238239int i, j, k, ngens, first;240241/* if this is the first call something is wrong ' */242if (countcall == 0) {243fprintf(stderr, "internal error in 'GAP_auts'");244exit(FAILURE);245}246247/* write function call to <countcall>.th position of <ANUPQgroups> */248fprintf(file, "## automorphisms number: %d\n", countcall);249fprintf(file, "ANUPQautos[%d] := function( G )\n", countcall);250fprintf(file, "local frattGens,\n");251fprintf(file, " relOrders,\n");252fprintf(file, " centralAutos,\n");253fprintf(file, " otherAutos;\n");254255256/* write information about automorphisms to file */257ngens = y[pcp->clend + 1];258fprintf(file,259"SetIsPcgsAutomorphisms(G,%s);\n",260pga->soluble ? "true" : "false");261fprintf(file, "SetIsCapable(G,%s);\n", pga->capable ? "true" : "false");262263/* first write the Frattini generators */264fprintf(file, "frattGens := [");265for (k = 1; k <= ngens; k++) {266if (k != 1)267fprintf(file, ",");268fprintf(file, "G.%d", k);269}270fprintf(file, "];\n");271272fprintf(file,273"centralAutos := []; # nr of central autos: %d\n",274pga->nmr_centrals);275276/* write out all central automorphisms */277for (i = 1; i <= pga->nmr_centrals; ++i) {278fprintf(file, "Add( centralAutos, [");279for (j = 1; j <= pga->ndgen; ++j) {280if (j != 1)281fprintf(file, ",");282first = 1;283for (k = 1; k <= pcp->lastg; ++k) {284if (0 != central[i][j][k]) {285if (!first)286fprintf(file, "*");287first = 0;288if (1 != central[i][j][k])289fprintf(file, "G.%d^%d", k, central[i][j][k]);290else291fprintf(file, "G.%d", k);292}293}294if (first) {295fprintf(stderr, "internal error in 'GAP_auts'\n");296exit(FAILURE);297}298}299fprintf(file, "] );\n");300}301302303fprintf(file,304"otherAutos := []; # nr of other autos: %d\n",305pga->nmr_stabilisers);306307/* write out all other automorphisms */308for (i = 1; i <= pga->nmr_stabilisers; ++i) {309fprintf(file, "Add( otherAutos, [");310for (j = 1; j <= pga->ndgen; ++j) {311if (j != 1)312fprintf(file, ",");313first = 1;314for (k = 1; k <= pcp->lastg; ++k) {315if (0 != stabiliser[i][j][k]) {316if (!first)317fprintf(file, "*");318first = 0;319if (1 != stabiliser[i][j][k])320fprintf(file, "G.%d^%d", k, stabiliser[i][j][k]);321else322fprintf(file, "G.%d", k);323}324}325if (first) {326fprintf(stderr, "internal error in 'GAP_auts'\n");327exit(FAILURE);328}329}330fprintf(file, "] );\n");331}332333334fprintf(file, "relOrders := [");335if (pga->nmr_soluble > 0) {336for (i = 1; i <= pga->nmr_soluble; ++i)337fprintf(file, "%d, ", pga->relative[i]);338fprintf(file, "%d", pga->relative[pga->nmr_soluble]);339}340fprintf(file, "];\n");341342343fprintf(file, "ANUPQSetAutomorphismGroup( ");344fprintf(file, "G, frattGens, centralAutos, otherAutos, relOrders, ");345fprintf(file, "%s );\n", pga->soluble ? "true" : "false");346fprintf(file, "end;\n\n\n");347}348349350