> < ^ Date: Wed, 13 Oct 1993 12:25:27 +0100
> < ^ From: Eamonn O'Brien <obrien@math.auckland.ac.nz >
> ^ Subject: Patch for anupq package in GAP 3.2

Below find a patch for the anupq package supplied as
part of the share library of GAP. It fixes known
bugs with the StandardPresentation machinery and
makes a few other minor changes. If you are using
the StandardPresentation or automorphism group
computation machinery, you should apply this patch.

To apply it, save the contents below --- as a file,
say pq.patch, then change to the anupq/srce directory,
copy it to this directory and issue the command

patch < pq.patch

Now recompile pq as described in Chapter 48 of the
GAP manual. If you have problems, please advise me.

Thanks,
Eamonn O'Brien
obrien@pell.anu.edu.au

----------------------------------------------------


diff -c srce.old/commute_dgen.c srce/commute_dgen.c
*** srce.old/commute_dgen.c     Sun Oct 10 15:12:06 1993
--- srce/commute_dgen.c Sun Oct 10 15:10:27 1993
***************
*** 105,110 ****
--- 105,112 ----
     for (i = 1; i < length; ++i) {
        generator = y[ptr + 1 + i];
        genval = y[pcp->dgen + generator];
+
+ #if defined (DEBUG)
        if (genval > 0)
         printf ("%d %d\n", generator, genval);
        else if (genval < 0) {
***************
*** 112,122 ****
         word_len = y[-genval + 1];
         for (j = 1; j <= word_len; ++j)
            printf (" %d", y[-genval + 1 + j]);
!       }
!       else
!        printf ("generator %d is trivial\n", generator);
        collect (genval, cp, pcp);
     }

     print_array (y, cp, cp + pcp->lastg + 1);
  }
--- 114,129 ----
         word_len = y[-genval + 1];
         for (j = 1; j <= word_len; ++j)
            printf (" %d", y[-genval + 1 + j]);
!       };
! #endif
!       if (genval == 0)
!        printf ("There is no defining generator %d -- take it to be identity\n",
!                   generator);
!
        collect (genval, cp, pcp);
     }

+ #if defined (DEBUG)
     print_array (y, cp, cp + pcp->lastg + 1);
+ #endif
  }
diff -c srce.old/interactive_pq.c srce/interactive_pq.c
*** srce.old/interactive_pq.c   Sun Oct 10 15:12:29 1993
--- srce/interactive_pq.c       Sun Oct 10 15:10:50 1993
***************
*** 66,71 ****
--- 66,73 ----

      case COLLECT:
         t = runTime ();
+          if (format != BASIC)
+             setup_symbols (pcp);
         type = WORD;
         if (!is_space_exhausted (3 * pcp->lastg + 2, pcp)) {
            cp = pcp->lused;
***************
*** 78,83 ****
--- 80,87 ----

      case SOLVE:
         t = runTime ();
+          if (format != BASIC)
+             setup_symbols (pcp);
         setup_to_solve_equation (format, pcp);
         t = runTime () - t;
         printf ("Solving the equation took %.2f seconds\n", t / 1000.0);
***************
*** 85,90 ****
--- 89,96 ----

      case COMMUTATOR:
         t = runTime ();
+          if (format != BASIC)
+             setup_symbols (pcp);
         calculate_commutator (format, pcp);
         cp = pcp->lused;
         echelon_ready = TRUE;
***************
*** 380,385 ****
--- 386,393 ----
         break;

      case REPRESENTATION:
+          if (format != BASIC)
+             setup_symbols (pcp);
         commute_defining_generators (format, pcp);
         break;

diff -c srce.old/isom_options.c srce/isom_options.c
*** srce.old/isom_options.c     Sun Oct 10 14:59:32 1993
--- srce/isom_options.c Sun Oct 10 15:11:42 1993
***************
*** 524,530 ****

        if (fscanf (Subgroup, "%d", &flag) == -1)
           continue;
!
        setup_symbols (pcp);
        cp = pcp->lused;
        setup_word_to_collect (Subgroup, PRETTY, WORD, cp, pcp);
--- 524,537 ----

        if (fscanf (Subgroup, "%d", &flag) == -1)
           continue;
!
!       /* should we eliminate (in order to renumber the generators)? */
!       if (flag == ELIMINATE)
!          eliminate (FALSE, pcp);
!
!       if (fscanf (Subgroup, "%d", &flag) == -1)
!          continue;
!
        setup_symbols (pcp);
        cp = pcp->lused;
        setup_word_to_collect (Subgroup, PRETTY, WORD, cp, pcp);
***************
*** 533,539 ****
           y[cp + pcp->lastg + i] = 0;

        echelon (pcp);
!       eliminate (FALSE, pcp);
     }
     CloseFile (Subgroup);
  }
--- 540,546 ----
           y[cp + pcp->lastg + i] = 0;

        echelon (pcp);
!
     }
     CloseFile (Subgroup);
  }
diff -c srce.old/runTime.c srce/runTime.c
*** srce.old/runTime.c  Sun Oct 10 15:12:12 1993
--- srce/runTime.c      Sun Oct 10 15:11:05 1993
***************
*** 9,25 ****
  #else
  #if defined (UNIX)

! #include <sys/types.h>
! #include <sys/times.h>

! /* compute user time in milliseconds */

  int runTime ()
  {
!    struct tms buf;

!    times (&buf);
!    return (buf.tms_utime * 50 / 3);
  }

  #else
--- 9,31 ----
  #else
  #if defined (UNIX)

! #include <sys/time.h>
! #include <sys/resource.h>
! /*
! #include "constants.h"
! */

! /* return user time in milliseconds; adapted from code by Werner Nickel */

  int runTime ()
  {
!    struct rusage buf;

!    if (getrusage (RUSAGE_SELF, &buf)) {
!        perror ("could not obtain timing");
!        exit (0);
!    }
!    return buf.ru_utime.tv_sec * 1000 + buf.ru_utime.tv_usec / 1000;
  }

  #else
diff -c srce.old/standard.c srce/standard.c
*** srce.old/standard.c Sun Oct 10 14:59:32 1993
--- srce/standard.c     Sun Oct 10 15:11:34 1993
***************
*** 272,278 ****
     enforce_laws (pga, pga, pcp);
     extend_automorphisms (auts, pga->m, pcp);

-
     /* critical */
     /*
       read_subgroup_rank (&k);
--- 272,277 ----
***************
*** 359,364 ****
--- 358,369 ----

orbit_option (STANDARDISE, perms, &a, &b, &c, &orbit_length, pga);

+ #if defined (CAYLEY_LINK) || defined (GAP_LINK_VIA_FILE)
+    if (!soluble_group) {
+          CloseFile (LINK_input);
+    }
+ #endif
+
     map = find_stabiliser (identity_map, non_standard, auts, perms, a, b, c,
                            orbit_length, pga, pcp);

***************
*** 454,461 ****
     pga->nmr_of_capables = 0;

     pga->combined = FALSE;
!    if (!soluble_group)
        combined_computation (auts, &a, &b, &c, perms, &orbit_length, pga, pcp);

     pga->terminal = TRUE;
     setup_reps (rep, 1, length, perms, a, b, c, auts,
--- 459,467 ----
     pga->nmr_of_capables = 0;

     pga->combined = FALSE;
!    if (!soluble_group) {
        combined_computation (auts, &a, &b, &c, perms, &orbit_length, pga, pcp);
+    }

     pga->terminal = TRUE;
     setup_reps (rep, 1, length, perms, a, b, c, auts,
***************
*** 526,534 ****
--- 532,545 ----
     char *word_perm;
     int i, l;
     char *d;
+    char temp;

word_map = allocate_char_vector (orbit_length, 1);

+    /* we store word which maps non-standard label to orbit representative;
+       in image_of_generator, the word is evaluated starting from the
+       last letter -- hence after computing the word, we reverse it */
+
     if (soluble_group) {
        d = find_permutation (b, c, pga);
        l = non_standard;
***************
*** 537,542 ****
--- 548,559 ----
           if ((perm_number = pga->map[d[l]]) != 0)
              l = inverse_image (l, perms[perm_number], pga);
        }
+       /* reverse word */
+       for (i = 1; i <= *word_length / 2; ++i) {
+           temp = word_map[i];
+           word_map[i] = word_map [*word_length - i + 1];
+           word_map [*word_length - i + 1] = temp;
+       }
        free_char_vector (d, 1);
     }
     else {
***************
*** 732,737 ****
--- 749,758 ----
        fprintf (Subgroup, ";\n");
     }

+    /* write out flag to indicate that we should now eliminate
+       redundant generators */
+    fprintf (Subgroup, "%d\n", ELIMINATE);
+
     CloseFile (Subgroup);
  }

> < [top]