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 compact.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
13
/* compact the group tables from pcp->gspace onwards */
14
15
void compact(struct pcp_vars *pcp)
16
{
17
register int *y = y_address;
18
19
register int i;
20
register int j;
21
register int p1;
22
register int new_address;
23
register int bound;
24
25
new_address = pcp->gspace - 1;
26
i = pcp->gspace;
27
28
#ifndef DEBUG
29
if (pcp->fullop || pcp->diagn)
30
#endif
31
text(2, pcp->lused, pcp->structure, 0, 0);
32
33
while (i < pcp->lused) {
34
35
/* the next block is currently allocated */
36
if (y[i] > 0) {
37
p1 = y[i];
38
++new_address;
39
y[p1] = -new_address;
40
y[new_address] = y[i];
41
bound = y[i + 1] + 1;
42
for (j = 1; j <= bound; ++j)
43
y[++new_address] = y[++i];
44
++i;
45
} else if (y[i] == 0)
46
/* this block is currently deallocated */
47
i += y[i + 1] + 2;
48
else
49
/* this block consists only of the header block of length 1 */
50
++i;
51
}
52
53
pcp->lused = new_address;
54
55
#ifndef DEBUG
56
if (pcp->fullop || pcp->diagn)
57
#endif
58
PRINT("After compaction Lused = %d\n", pcp->lused);
59
60
return;
61
}
62
63