Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

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

563549 views
1
/****************************************************************************
2
**
3
*A extend_representation.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
15
/* compute a matrix which permits the extension of an existing
16
permutation representation for a group by a group of order
17
p^rank; the matrix rows are indexed from 0 .. p^rank - 1;
18
the matrix columns are indexed by the defining generators and
19
their inverses in the sequence 1, 1^-1, 2, 2^-1, etc.
20
21
M[i][j] = k, where a = (a_1,.....a_rank) is the vector of
22
coefficients of the p-adic expansion of i, b is the vector of
23
coefficients of the p-adic expansion of k, and within the
24
p-group b = a * im(j) */
25
26
void extend_representation(struct pcp_vars *pcp)
27
{
28
register int *y = y_address;
29
30
int *expand; /* array to store p-adic expansion */
31
register int rank = y[pcp->clend + pcp->cc];
32
register int i, j, gen, sum;
33
int bound;
34
int **M;
35
int index;
36
int *powers; /* store powers of p to avoid recomputation */
37
register int p = pcp->p;
38
int cp = pcp->lused;
39
int ptr;
40
41
bound = int_power(p, rank);
42
43
/* set up room to store p-adic expansion and powers of p */
44
expand = allocate_vector(rank, 0, TRUE);
45
powers = allocate_vector(rank, 0, FALSE);
46
47
for (i = 0; i < rank; ++i)
48
powers[i] = int_power(p, i);
49
50
/* set up matrix to store results */
51
M = allocate_matrix(bound, 2 * pcp->ndgen, 0, FALSE);
52
53
for (i = 0; i < bound; ++i) {
54
55
/* find the p-adic expansion of i */
56
compute_padic(powers, i, rank - 1, p, expand);
57
58
/* now process each defining generator and its inverse in turn */
59
60
for (gen = -pcp->ndgen; gen <= pcp->ndgen; ++gen) {
61
62
if (gen == 0)
63
continue;
64
65
/* now copy p-adic expansion to y */
66
for (j = 0; j < rank; ++j)
67
y[cp + j + 1] = expand[j];
68
69
#if defined(DEBUG)
70
printf("processing generator %d \n", gen);
71
printf("Stored p-adic expansion for %d in y is ", i);
72
for (j = 1; j <= pcp->lastg; ++j) {
73
printf("%d ", y[cp + j]);
74
}
75
printf("\n");
76
#endif
77
78
/* look up image of gen which is stored as a generator-exponent
79
string in y; post-multiply the p-adic expansion by this image */
80
81
ptr = y[pcp->dgen + gen];
82
if (ptr != 0)
83
collect(ptr, cp, pcp);
84
85
#if defined(DEBUG)
86
printf("result of collection is ");
87
for (j = 1; j <= pcp->lastg; ++j) {
88
printf("%d ", y[cp + j]);
89
}
90
printf("\n");
91
#endif
92
93
/* store the result of the multiplication */
94
sum = 0;
95
for (j = 1; j <= pcp->lastg; ++j)
96
sum += (y[cp + j] * powers[j - 1]);
97
98
index = (gen < 0) ? 2 * (-gen) - 1 : 2 * gen - 2;
99
M[i][index] = sum;
100
}
101
102
for (j = 0; j < rank; ++j)
103
expand[j] = 0;
104
}
105
106
printf("The extension matrix is\n");
107
print_matrix(M, bound, 2 * pcp->ndgen);
108
109
free_vector(expand, 0);
110
free_vector(powers, 0);
111
free_matrix(M, bound, 0);
112
}
113
114
/* compute p-adic expansion of x, where x < p^(k + 1) */
115
116
void compute_padic(int *powers, int x, int k, int p, int *expand)
117
{
118
register int alpha;
119
register int val;
120
121
while (x > 0 && k >= 0) {
122
val = powers[k];
123
if (val <= x) {
124
/* find largest multiple of p^k < x */
125
alpha = p - 1;
126
while (alpha * val > x)
127
--alpha;
128
expand[k] = alpha;
129
x -= alpha * val;
130
}
131
--k;
132
}
133
}
134
135