void stabiliser_option(int option, int ***auts, int **perms, int *a, int *b, char *c, int *orbit_length, struct pga_vars *pga, struct pcp_vars *pcp) { int t; int i; /*Logical soluble_group;*/ FILE *OutputFile; char *StartName; int *rep; int *length; rep = allocate_vector(1, 1, 0); length = allocate_vector(1, 1, 0); t = runTime(); query_solubility(pga); if (pga->soluble) query_space_efficiency(pga); else pga->space_efficient = FALSE; /*soluble_group = (pga->soluble || pga->Degree == 1 || pga->nmr_of_perms == 0);*/ query_terminal(pga); query_exponent_law(pga); query_metabelian_law(pga); query_group_information(pga->p, pga); query_aut_group_information(pga); StartName = GetString("Enter output file name: "); OutputFile = OpenFileOutput(StartName); pga->final_stage = (pga->q == pga->multiplicator_rank); pga->nmr_of_descendants = 0; pga->nmr_of_capables = 0; if (option == STABILISER) { read_value(TRUE, "Input the orbit representative: ", &rep[1], 1); /* find the length of the orbit having this representative */ for (i = 1; i <= pga->nmr_orbits && pga->rep[i] != rep[1]; ++i) ; if (pga->rep[i] == rep[1]) length[1] = orbit_length[i]; else { printf("%d is not an orbit representative\n", rep[1]); return; } } if (option == STABILISER) setup_reps(rep, 1, length, perms, a, b, c, auts, OutputFile, OutputFile, pga, pcp); else setup_reps(pga->rep, pga->nmr_orbits, orbit_length, perms, a, b, c, auts, OutputFile, OutputFile, pga, pcp); /* #if defined (GAP_LINK) if (!soluble_group) QuitGap (); #endif */ RESET(OutputFile); printf("Time to process representative is %.2f seconds\n", (runTime() - t) * CLK_SCALE); }
void isom_options (int format, struct pcp_vars *pcp) { register int *y = y_address; FILE *Status; FILE *FileName; FILE *Subgroup; struct pga_vars pga; Logical user_supplied = FALSE; Logical group_present = FALSE; Logical identity_map; Logical finished; Logical valid; Logical equal; int output = DEFAULT_STANDARD_PRINT; int start_class, final_class; int option; int t; int status; int complete; int iteration; int *seq1; int *seq2; int len1, len2; int nmr_items; int ***auts; int x_dim, y_dim; FILE * GAP_library; char *name; int nmr_of_exponents; StandardPresentation = TRUE; pga.nmr_soluble = 0; list_isom_menu (); do { option = read_option (MAXOPTION); switch (option) { case -1: list_isom_menu (); break; case START_INFO: t = runTime (); group_present = setup_start_info (FALSE, 0, stdin, format, &pga, pcp); handle_error (group_present); user_supplied = TRUE; t = runTime () - t; /* it is possible that the p-quotient is trivial */ if (pcp->cc == 0) { group_present = FALSE; break; } printf ("Class %d %d-quotient and its %d-covering group computed in %.2f seconds\n", pcp->cc - 1, pcp->p, pcp->p, t * CLK_SCALE); break; case CONSTRUCT: if (!user_supplied) { name = GetString ("Enter input file name for group information: "); FileName = OpenFile (name, "r"); if (FileName == NULL) break; } name = GetString ("Enter output file name for group information: "); read_value (TRUE, "Standardise presentation to what class? ", &final_class, 0); if (user_supplied && final_class < pcp->cc) { printf ("Value supplied for end class must be at least %d\n", pcp->cc); } /* read in data from file and set up group to end of start_class and compute its p-covering group */ if (!user_supplied) { group_present = setup_start_info (FALSE, 0, FileName, FILE_INPUT, &pga, pcp); handle_error (group_present); if (final_class < pcp->cc) { CloseFile (FileName); printf ("Value supplied for end class must be at least %d\n", pcp->cc); } } if (pcp->cc == 0) { printf ("%d-quotient is trivial\n", pcp->p); break; } complete = (pcp->newgen == 0) ? TERMINAL : CAPABLE; iteration = 0; for (start_class = pcp->cc; start_class <= final_class && complete != TERMINAL; ++start_class) { t = runTime (); identity_map = FALSE; Subgroup = OpenFile ("ISOM_Subgroup", "w"); do { ++iteration; set_defaults (&pga); /* pga.space_efficient = TRUE; */ /* either prompt for information or read it from file */ if (user_supplied) { auts = read_auts (STANDARDISE, &pga.m, &nmr_of_exponents, pcp) ; pga.fixed = 0; query_solubility (&pga); user_supplied = FALSE; #ifdef HAVE_GMP autgp_order (&pga, pcp); #endif } else { auts = read_auts_from_file (FileName, &pga.m, pcp); nmr_items = fscanf (FileName, "%d", &pga.fixed); verify_read (nmr_items, 1); nmr_items = fscanf (FileName, "%d", &pga.soluble); verify_read (nmr_items, 1); #ifdef HAVE_GMP fscanf (FileName, "\n"); mpz_init (&pga.aut_order); mpz_inp_str (&pga.aut_order, FileName, 10); #endif CloseFile (FileName); } x_dim = pga.m; y_dim = pcp->lastg; /* construct standard presentation relative to smallest permissible characteristic subgroup in p-multiplicator */ standard_presentation (&identity_map, output, auts, &pga, pcp); free_array (auts, x_dim, y_dim, 1); /* was the characteristic subgroup chosen in this iteration the whole of the p-multiplicator? */ Status = OpenFile ("ISOM_Status", "r"); fscanf (Status, "%d", &status); fscanf (Status, "%d", &complete); CloseFile (Status); /* have we finished the construction? */ finished = (status == END_OF_CLASS && (start_class == final_class || complete == TERMINAL)); /* organise to write modified presentation + automorphisms to file ISOM_PP */ if (!identity_map || finished) { copy_file( "ISOM_present", "ISOM_PP" ); append_file( "ISOM_NextClass", "ISOM_PP" ); } else copy_file( "ISOM_NextClass", "ISOM_PP" ); if (finished) break; /* if necessary, set up new presentation + other information */ FileName = OpenFile ("ISOM_PP", "r"); group_present = setup_start_info (identity_map, status, FileName, FILE_INPUT, &pga, pcp); handle_error (group_present); /* if appropriate, factor subgroup from p-multiplicator */ if (status != END_OF_CLASS) factor_subgroup (pcp); /* reinitialise pga structure */ initialise_pga (&pga, pcp); pga.m = 0; pga.ndgen = y[pcp->clend + 1]; set_values (&pga, pcp); } while (status != END_OF_CLASS && complete != TERMINAL); CloseFile (Subgroup); /* the group may have completed only when relations are enforced; this is an attempt to determine this case */ if (pga.nuclear_rank != 0 && pcp->complete) break; t = runTime () - t; printf ("Computing standard presentation for class %d took %.2f seconds\n", start_class, t * CLK_SCALE); } /* we currently may have presentation for p-covering group; or is the starting group terminal? if so, we may want to use last_class to revert to group presentation */ if (!user_supplied && iteration == 0 && !pcp->complete) last_class (pcp); /* is the group terminal? */ if (complete == TERMINAL) printf ("The largest %d-quotient of the group has class %d\n", pcp->p, pcp->cc); if (iteration == 0) break; /* rename file ISOM_PP containing iteration info to nominated file */ rename( "ISOM_PP", name ); break; case PRINT_PCP: if (group_present) print_presentation (TRUE, pcp); break; case SAVE_PRES: name = GetString ("Enter output file name: "); FileName = OpenFileOutput (name); if (group_present && FileName != NULL) { save_pcp (FileName, pcp); CloseFile (FileName); printf ("Presentation written to file\n"); } break; case COMPARE: valid = get_description ("Enter file name storing first presentation: ", &len1, &seq1, pcp); if (!valid) break; valid = get_description ("Enter file name storing second presentation: ", &len2, &seq2, pcp); if (!valid) break; equal = (len1 == len2) ? compare_sequences (seq1, seq2, len1): FALSE; printf ("Identical presentations? %s\n", equal == TRUE ? "True" : "False"); free_vector (seq1, 1); free_vector (seq2, 1); break; case STANDARD_PRINT_LEVEL: read_value (TRUE, "Input print level for construction (0-2): ", &output, 0); /* allow user to supply same max print level as for p-quotient calculations */ if (output == MAX_STANDARD_PRINT + 1) --output; if (output > MAX_STANDARD_PRINT) { printf ("Print level must lie between %d and %d\n", MIN_STANDARD_PRINT, MAX_STANDARD_PRINT); output = DEFAULT_STANDARD_PRINT; } break; case PQ_MENU: options (ISOM_MENU, format, pcp); break; case ISOM_OPTION: FileName = OpenFile (name, "r"); group_present = setup_start_info (FALSE, 0, FileName, FILE_INPUT, &pga, pcp); pcp->multiplicator_rank = pcp->lastg - y[pcp->clend + pcp->cc-1]; last_class (pcp); auts = read_auts_from_file (FileName, &pga.m, pcp); nmr_items = fscanf (FileName, "%d", &pga.fixed); verify_read (nmr_items, 1); nmr_items = fscanf (FileName, "%d", &pga.soluble); verify_read (nmr_items, 1); printf ("Images of user-supplied generators are listed last below\n"); print_map (pcp); #ifdef HAVE_GMP fscanf (FileName, "\n"); mpz_init (&pga.aut_order); mpz_inp_str (&pga.aut_order, FileName, 10); #endif CloseFile (FileName); GAP_library = OpenFile ("GAP_library", "a+"); write_GAP_library (GAP_library, pcp); pga.nmr_centrals = pga.m; pga.nmr_stabilisers = 0; GAP_auts (GAP_library, auts, auts, &pga, pcp); CloseFile (GAP_library); printf ("Presentation listing images of user-supplied generators written to GAP_library\n"); break; case EXIT: case MAXOPTION: unlink( "ISOM_present" ); unlink( "ISOM_Subgroup" ); unlink( "ISOM_cover_file" ); unlink( "ISOM_group_file" ); unlink( "ISOM_XX" ); unlink( "ISOM_NextClass" ); unlink( "ISOM_Status" ); printf ("Exiting from ANU p-Quotient Program\n"); break; } /* switch */ } while (option != 0 && option != MAXOPTION); }