1 /****************************************************************************
2 **
3 *A print_presentation.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 /* print relationship between group defining generators and
15 consistent power-commutator presentation generators */
16
print_map(struct pcp_vars * pcp)17 void print_map(struct pcp_vars *pcp)
18 {
19 register int *y = y_address;
20
21 int ndgen = pcp->ndgen;
22 int dgen = pcp->dgen;
23 int p2;
24 int i;
25
26 #if defined(GROUP)
27 printf("\nRelationship between group defining generators and ");
28 printf("consistent\npower-commutator presentation generators:\n");
29 #endif
30
31 for (i = 1; i <= ndgen; i++) {
32 p2 = y[dgen + i];
33 printf("%d", i);
34 printf(" ");
35 printf(" =");
36 print_word(p2, pcp);
37 p2 = y[dgen - i];
38 if (p2 <= 0) {
39 printf("%d", i);
40 printf("^-1 =");
41 print_word(p2, pcp);
42 }
43 }
44 }
45
46 /* print the pcp presentation of the group; if full output, print
47 non-trivial power and commutator relations; if diagnostic output,
48 also print relationship and structure information */
49
print_presentation(Logical full,struct pcp_vars * pcp)50 void print_presentation(Logical full, struct pcp_vars *pcp)
51 {
52 register int *y = y_address;
53
54 register int i;
55 register int k;
56 register int l;
57 register int length;
58
59 register int relp = pcp->relp;
60 register int ndrel = pcp->ndrel;
61 register int gen, pointer;
62
63 Logical commutator_relation;
64
65 char *s;
66
67 #if defined(GROUP)
68 printf("\nGroup: %s to lower exponent-%d central class %d has order %d^%d\n",
69 pcp->ident,
70 pcp->p,
71 pcp->cc,
72 pcp->p,
73 pcp->lastg);
74 #endif
75
76 if (!full)
77 return;
78
79 if (pcp->diagn) {
80
81 /* print out the defining relations of the group */
82
83 #if defined(GROUP)
84 s = "Group";
85 #endif
86 if (pcp->ndrel != 0)
87 printf("\n%s defining relations:\n", s);
88 for (k = 1; k <= ndrel; ++k) {
89 for (l = 1; l <= 2; ++l) {
90 i = (k - 1) * 2 + l;
91 pointer = y[relp + i];
92 commutator_relation = (y[pointer] < 0);
93 length = abs(y[pointer]);
94 if (length == 0)
95 printf("0");
96 else
97 printf("%d", y[pointer + 1]);
98 if (commutator_relation)
99 printf(" [");
100 for (i = 2; i <= length; ++i) {
101 gen = y[pointer + i];
102 printf(" %d", gen);
103 }
104 if (commutator_relation)
105 printf(" ]");
106 printf("\n");
107 }
108 printf("\n");
109 }
110
111 /* print map from defining generators to pcp generators */
112 print_map(pcp);
113
114 #if defined(GROUP)
115 printf("\nValues of power-commutator presentation generators\n");
116 #endif
117 print_structure(1, pcp->lastg, pcp);
118 }
119
120 if (pcp->cc != 1)
121 print_pcp_relations(pcp);
122 }
123
124 /* print out non-trivial pcp relations */
125
print_pcp_relations(struct pcp_vars * pcp)126 void print_pcp_relations(struct pcp_vars *pcp)
127 {
128 register int *y = y_address;
129
130 register int i;
131 register int j;
132 register int k;
133 register int l;
134 register int p1;
135 register int p2;
136 register int weight;
137
138 #include "access.h"
139
140 k = y[pcp->clend + pcp->cc - 1];
141 /*
142 int start, finish;
143 printf ("input start, finish: ");
144 scanf ("%d %d", &start, &finish);
145 */
146
147 #if defined(GROUP)
148 printf("\nNon-trivial powers:\n");
149 /*
150 for (i = start; i <= finish; i++) {
151 */
152 for (i = 1; i <= k; i++) {
153 p2 = y[pcp->ppower + i];
154 if (p2 != 0) {
155 printf(" .%d^%d =", i, pcp->p);
156 print_word(p2, pcp);
157 }
158 }
159
160 printf("\nNon-trivial commutators:\n");
161 #endif
162
163 /*
164 for (i = start; i <= finish; i++) {
165 */
166 for (i = 2; i <= k; i++) {
167 weight = WT(y[pcp->structure + i]);
168 p1 = y[pcp->ppcomm + i];
169 l = MIN(i - 1, y[pcp->clend + pcp->cc - weight]);
170 for (j = 1; j <= l; j++) {
171 p2 = y[p1 + j];
172 if (p2 != 0) {
173 printf("[ .%d, .%d ] =", i, j);
174 print_word(p2, pcp);
175 }
176 }
177 }
178 }
179