CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
1
/****************************************************************************
2
**
3
*A collect_comm.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 "constants.h"
13
#include "pq_functions.h"
14
#include "pretty_filterfns.h"
15
#include "word_types.h"
16
17
/* collect a commutator relation in the defining generators of the group */
18
19
void collect_def_comm(int ptr, int cp, struct pcp_vars *pcp)
20
{
21
register int *y = y_address;
22
23
register int cp1, cp2, cp3, cp4, result;
24
register int lastg = pcp->lastg;
25
register int total;
26
int disp = 0;
27
int depth;
28
int exp;
29
30
cp1 = pcp->submlg - lastg - 2;
31
cp2 = cp1 - lastg;
32
cp3 = cp2 - lastg;
33
cp4 = cp3 - lastg;
34
result = cp4 - lastg;
35
36
/* fudge the value of submlg because of possible call to power */
37
total = 6 * lastg + 6;
38
pcp->submlg -= total;
39
40
depth = -y[ptr] - 1;
41
exp = y[ptr + 1];
42
43
collect_defining_generator(ptr + 2, cp2, pcp);
44
copy(cp2, lastg, cp3, pcp);
45
46
disp = 0;
47
while (--depth > 0) {
48
49
++disp;
50
collect_defining_generator(ptr + 2 + disp, cp1, pcp);
51
copy(cp1, lastg, cp4, pcp);
52
53
/* solve the equation (ba) * x = ab to obtain [a, b] */
54
find_commutator(cp1, cp2, cp3, cp4, result, pcp);
55
56
copy(result, lastg, cp2, pcp);
57
copy(result, lastg, cp3, pcp);
58
}
59
60
power(exp, result, pcp);
61
62
#ifdef DEBUG
63
/* print the commutator */
64
setup_word_to_print("commutator", result, pcp->lused, pcp);
65
#endif
66
67
/* copy result to cp */
68
copy(result, lastg, cp, pcp);
69
70
/* reset the value of submlg */
71
pcp->submlg += total;
72
}
73
74
/* collect value of defining generator stored at y[ptr] to
75
storage location cp */
76
77
void collect_defining_generator(int ptr, int cp, struct pcp_vars *pcp)
78
{
79
register int *y = y_address;
80
81
register int lastg = pcp->lastg;
82
int i, generator, genval;
83
84
#ifdef DEBUG
85
int j, word_len;
86
#endif
87
88
/* zero out lastg entries in array in order to store result */
89
for (i = 1; i <= lastg; ++i)
90
y[cp + i] = 0;
91
92
generator = y[ptr];
93
genval = y[pcp->dgen + generator];
94
95
/* check for illegal defining generators */
96
if (abs(generator) > pcp->ndgen || generator == 0)
97
report_error(0, generator, 0);
98
99
#ifdef DEBUG
100
if (genval > 0)
101
printf("%d %d\n", generator, genval);
102
else if (genval < 0) {
103
printf("%d %d ", generator, y[-genval]);
104
word_len = y[-genval + 1];
105
for (j = 1; j <= word_len; ++j)
106
printf(" %d", y[-genval + 1 + j]);
107
} else
108
printf("generator %d is trivial\n", generator);
109
#endif
110
111
collect(genval, cp, pcp);
112
113
#ifdef DEBUG
114
print_array(y, cp, cp + pcp->lastg + 1);
115
#endif
116
}
117
118