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 close_relations.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 "pga_vars.h"
13
#include "pq_functions.h"
14
#define SORT_FACTOR 25
15
16
/* close a queue of relations under the action of the automorphisms;
17
18
each of length entries in the queue is a pointer to
19
a relation of the sort
20
21
x = y1^a1 ... yq^aq
22
23
where each of x and y<i> are among the new generators introduced;
24
apply automorphism alpha to this relation and rewrite to obtain
25
26
(y1^a1 ... yq^aq)<alpha> * x<alpha>^-1 = identity
27
28
this new relation is now echelonised */
29
30
void close_relations(Logical report,
31
int limit,
32
int queue_type,
33
int *head,
34
int *list,
35
int *queue,
36
int length,
37
int *long_queue,
38
int *long_queue_length,
39
struct pcp_vars *pcp)
40
{
41
register int *y = y_address;
42
43
char *s;
44
char *t;
45
int nmr_reds = 0;
46
47
int current = 1;
48
int gen;
49
50
int relation_length;
51
int generator, exponent;
52
53
register int offset;
54
55
int *copy;
56
57
int alpha, i;
58
int cp, p1;
59
int start = y[pcp->clend + pcp->cc - 1] + 1;
60
int prime = pcp->p;
61
int pm1 = pcp->pm1;
62
#include "access.h"
63
64
while (current <= length) {
65
66
gen = queue[current];
67
++current;
68
69
if (gen == 0)
70
continue;
71
72
if (current % SORT_FACTOR == 1) {
73
copy = queue + current - 1;
74
bubble_sort(copy, length - current + 1, pcp);
75
}
76
77
/* apply automorphism alpha to the relation */
78
for (alpha = 1; alpha <= pcp->m; ++alpha) {
79
80
if (is_space_exhausted(2 * pcp->lastg, pcp)) {
81
pcp->overflow = TRUE;
82
return;
83
}
84
85
cp = pcp->lused;
86
for (i = 1; i <= 2 * pcp->lastg; ++i)
87
y[cp + i] = 0;
88
89
offset = (alpha - 1) * pcp->lastg;
90
91
/* is the relation trivial? */
92
if (y[pcp->structure + gen] == 0)
93
traverse_list(1, head[offset + gen], list, cp, pcp);
94
else {
95
/* the relation was non-trivial; first, set up (gen<alpha>)^-1 */
96
traverse_list(pm1, head[offset + gen], list, cp, pcp);
97
98
/* now apply the automorphism to each entry of
99
the string pointed to by y[pcp->structure + gen] */
100
101
p1 = -y[pcp->structure + gen];
102
relation_length = y[p1 + 1];
103
104
if (queue_type == 1 && relation_length > limit) {
105
long_queue[++*long_queue_length] = gen;
106
break;
107
}
108
109
for (i = 1; i <= relation_length; ++i) {
110
generator = FIELD2(y[p1 + 1 + i]);
111
exponent = FIELD1(y[p1 + 1 + i]);
112
traverse_list(exponent, head[offset + generator], list, cp, pcp);
113
}
114
115
/* now reduce the entries mod p */
116
for (i = start; i <= pcp->lastg; ++i)
117
y[cp + i] %= prime;
118
}
119
120
relation_length = echelon(pcp);
121
if (pcp->complete)
122
return;
123
124
/* if appropriate, add a new relation to the queue */
125
if (pcp->eliminate_flag) {
126
++nmr_reds;
127
if (relation_length <= limit || queue_type == 2)
128
queue[++length] = pcp->redgen;
129
if (relation_length > limit || queue_type == 2)
130
long_queue[++*long_queue_length] = pcp->redgen;
131
}
132
}
133
}
134
135
if (report || pcp->fullop || pcp->diagn) {
136
if (queue_type == 1)
137
s = "Short";
138
else
139
s = "Long";
140
if (nmr_reds == 1)
141
t = "y";
142
else
143
t = "ies";
144
printf("%s queue gave %d redundanc%s\n", s, nmr_reds, t);
145
}
146
}
147
148
/* add exponent times the action of automorphism with pointer head
149
to the contents of the exponent-vector with base address cp */
150
151
void
152
traverse_list(int exponent, int head, int *list, int cp, struct pcp_vars *pcp)
153
{
154
register int *y = y_address;
155
156
register int value;
157
register int length = list[++head];
158
#include "access.h"
159
160
while (length != 0) {
161
value = list[head + length];
162
y[cp + FIELD2(value)] += FIELD1(value) * exponent;
163
--length;
164
}
165
}
166
167