Esempio n. 1
0
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);
}
Esempio n. 2
0
int reduced_covers (FILE *descendant_file, FILE *covers_file, int k, int ***auts, struct pga_vars *pga, struct pcp_vars *pcp)
{
   int lower_step, upper_step;
   int nmr_of_covers = 0;
   int *a, *b;                  /* arrays needed for orbit calculation */
   char *c;                     /* array needed for stabiliser calculation */
   int **perms;                 /* store all permutations */
   int *orbit_length;           /* length of orbits */
   FILE * LINK_input;        /* input file for GAP */
#if defined (GAP_LINK) 
   Logical process_fork = FALSE; /* has GAP process forked? */        
#endif
   Logical soluble_group;       /* indicates that orbits and stabilisers may 
				   be computed using soluble machinery */

   /* calculate the extended automorphisms */
   extend_automorphisms (auts, pga->m, pcp);
   if (pcp->overflow) return 0;

   if (pga->print_extensions && pga->m != 0) {  
      printf ("\nThe extension%s:\n", pga->m == 1 ? " is" : "s are");
      print_auts (pga->m, pcp->lastg, auts, pcp);
   }

   /* find range of permitted step sizes */
   step_range (k, &lower_step, &upper_step, auts, pga, pcp);

   /* set up space for definition sets */
   store_definition_sets (pga->r, lower_step, upper_step, pga);

   /* loop over each permitted step size */ 
   for (pga->s = lower_step; pga->s <= upper_step; ++pga->s) {

      if (pga->trace)
	 trace_details (pga);

      get_definition_sets (pga);
      compute_degree (pga);

      /* establish which automorphisms induce the identity 
	 on the relevant subgroup of the p-multiplicator */
      strip_identities (auts, pga, pcp);

      /* if possible, use the more efficient soluble code --
	 in particular, certain extreme cases can be handled */
      soluble_group = (pga->soluble || pga->Degree == 1 || 
		       pga->nmr_of_perms == 0);

      if (!soluble_group) {
#if defined (GAP_LINK) 
	 if (!process_fork) {
	    start_GAP_file (auts, pga);
	    process_fork = TRUE;
	 }
	 StartGapFile (pga);
#else
#if defined (GAP_LINK_VIA_FILE) 
	 start_GAP_file (&LINK_input, auts, pga, pcp);
#endif
#endif
      }

      perms = permute_subgroups (LINK_input, &a, &b, &c, auts, pga, pcp);

      if (!pga->space_efficient) {
	 if (soluble_group)
	    compute_orbits (&a, &b, &c, perms, pga);
	 else
	    insoluble_compute_orbits (&a, &b, &c, perms, pga);
      }
      orbit_length = find_orbit_reps (a, b, pga);

      if (pga->print_orbit_summary)
	 orbit_summary (orbit_length, pga);

      if (soluble_group && pga->print_orbit_arrays)
	 print_orbit_information (a, b, c, pga);

      pga->final_stage = (pga->q == pga->multiplicator_rank);

      if (!soluble_group) {
#if defined (GAP_LINK_VIA_FILE) 
	 CloseFile (LINK_input);
#endif 
      }

      setup_reps (pga->rep, pga->nmr_orbits, orbit_length, perms, a, b, c, 
		  auts, descendant_file, covers_file, pga, pcp);

      if (!pga->final_stage)
	 nmr_of_covers += pga->nmr_orbits;

      free_space (soluble_group, perms, orbit_length, 
		  a, b, c, pga); 
   }     

#if defined (GAP_LINK)
   if (process_fork) 
      QuitGap ();
#endif 

   free_vector (pga->list, 0);
   free_vector (pga->available, 0);
   free_vector (pga->offset, 0);

   return nmr_of_covers;
}