1 /****************************************************************************
2 **
3 *A class1_eliminate.c ANUPQ source Eamonn O'Brien
4 **
5 *Y Copyright 1995-2001, Lehrstuhl D fuer Mathematik, RWTH Aachen, Germany
6 *Y Copyright 1995-2001, School of Mathematical Sciences, ANU, Australia
7 **
8 */
9
10 #include "pq_defs.h"
11 #include "pcp_vars.h"
12 #include "pq_functions.h"
13
14 /* eliminate all redundant generators to construct the consistent
15 power commutator presentation for the class 1 quotient;
16
17 this procedure is called only for class 1 in order to
18 eliminate redundancies brought about by collecting and
19 then echelonising words against an existing consistent
20 class 1 presentation;
21
22 in all other circumstances, the usual eliminate procedure
23 is called */
24
class1_eliminate(struct pcp_vars * pcp)25 void class1_eliminate(struct pcp_vars *pcp)
26 {
27 register int *y = y_address;
28
29 register int i;
30 register int j;
31 register int k;
32 register int p1;
33 register int ba;
34 register int lg;
35 register int bound;
36
37 register int structure = pcp->structure;
38 register int current_class = pcp->cc;
39 register int lused = pcp->lused;
40 register int dgen = pcp->dgen;
41 register int ndgen = pcp->ndgen;
42
43 /* calculate new values for irredundant generators and set them up
44 in a renumbering table of length pcp->lastg - pcp->ccbeg + 1
45 which looks to compact like a normal exponent-generator string
46 pointed to by y[dgen] */
47
48 structure = pcp->structure;
49 lused = pcp->lused;
50 y[lused + 1] = dgen;
51 y[dgen] = -(lused + 1);
52 y[lused + 2] = pcp->lastg - pcp->ccbeg + 1;
53 ba = lused + 3 - pcp->ccbeg;
54 pcp->lused += pcp->lastg - pcp->ccbeg + 3;
55 lused = pcp->lused;
56 lg = pcp->ccbeg - 1;
57 for (i = pcp->ccbeg, bound = pcp->lastg; i <= bound; i++) {
58 y[ba + i] = 0;
59 if (y[structure + i] > 0)
60 y[ba + i] = ++lg;
61 }
62
63 /* update the redundant defining generators and inverses */
64 for (i = 1; i <= ndgen; i++) {
65 update(dgen + i, pcp);
66 if (pcp->overflow)
67 return;
68 update(dgen - i, pcp);
69 if (pcp->overflow)
70 return;
71 }
72
73 /* finally update and move structure information */
74
75 pcp->ppcomm = pcp->structure;
76 pcp->ppower = pcp->ppcomm;
77 k = pcp->ppower;
78 structure = pcp->structure;
79 for (i = pcp->lastg; i >= pcp->ccbeg; i--) {
80 if ((j = y[structure + i]) > 0) {
81 y[k] = j;
82 k--;
83 } else if (j < 0) {
84 /* deallocate equation for redundant generator i */
85 p1 = -j;
86 y[p1] = 0;
87 }
88 }
89
90 for (; i > 0; i--)
91 y[k--] = y[structure + i];
92 if (pcp->subgrp != structure)
93 delete_tables(0, pcp);
94 pcp->structure = k;
95 structure = pcp->structure;
96 pcp->words = k;
97 pcp->subgrp = k;
98 pcp->submlg = pcp->subgrp - lg;
99
100 pcp->lastg = lg;
101 y[pcp->clend + current_class] = pcp->lastg;
102
103 /* deallocate the renumbering table */
104 p1 = -y[dgen];
105 y[p1] = 0;
106 return;
107 }
108