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_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 "pq_functions.h"
13
14
/* collect defining relations and solve corresponding equations;
15
a commutator relation is stored with a negative length */
16
17
void collect_relations(struct pcp_vars *pcp)
18
{
19
register int *y = y_address;
20
21
register int i;
22
register int j;
23
register int k;
24
register int p1;
25
register int length;
26
register int cp, cp1, cp2;
27
28
register int relp = pcp->relp;
29
register int ndrel = pcp->ndrel;
30
register int lastg = pcp->lastg;
31
32
for (i = 1; i <= ndrel; ++i) {
33
34
/* space is required for two collected parts set up here
35
and possibly for 5 * pcp->lastg in collect_def_comm */
36
if (is_space_exhausted(7 * lastg + 7, pcp))
37
return;
38
39
cp1 = pcp->lused;
40
cp2 = cp1 + lastg;
41
42
/* original zero out -- bug reported by John Cannon October 1998 */
43
/*
44
for (j = 1; j <= lastg; ++j)
45
y[cp1 + j] = y[cp2 + j] = 0;
46
*/
47
48
for (j = 1; j <= 2; ++j) {
49
p1 = y[++relp];
50
if (p1 != 0) {
51
cp = (j == 1) ? cp1 : cp2;
52
/* bug fix */
53
for (k = 1; k <= lastg; ++k)
54
y[cp + k] = 0;
55
length = y[p1];
56
/* is the relation a word or a commutator? */
57
if (length > 0)
58
collect_gen_word(p1, length, cp, pcp);
59
else if (length < 0) {
60
/* we may need to update pcp->lused, as space immediately
61
above it is used in commutator routines */
62
if (j == 2)
63
pcp->lused += lastg;
64
collect_def_comm(p1, cp, pcp);
65
if (j == 2)
66
pcp->lused -= lastg;
67
}
68
if (!pcp->valid)
69
return;
70
}
71
}
72
73
echelon(pcp);
74
if ((pcp->fullop && pcp->eliminate_flag) || pcp->diagn)
75
text(1, i, 0, 0, 0);
76
if (pcp->overflow || pcp->complete != 0)
77
return;
78
}
79
}
80
81