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

563603 views
1
#include"typedef.h"
2
/*******************************************************************\
3
| calculate the partial image of the matrices in 'perpbase'
4
| under the partial automorphism and check, whether it is
5
| equal to the IxI-submatrix (of the first I columns and rows)
6
| of one of the matrices in 'perp'
7
\*******************************************************************/
8
9
10
static int normal_aut_test(x, I, V)
11
int *x, I;
12
veclist V;
13
{
14
int i,j,k,l;
15
int o,u,m;
16
int found, tester;
17
int xl, xj;
18
19
for(i=0;i<perpdim;i++)
20
{
21
for(l=0;l<=I;l++)
22
{
23
if(x[l] < 0) xl = -x[l]; else xl = x[l];
24
/***************************************************************\
25
| calculate the l-th row of perpprod[i]
26
\***************************************************************/
27
for(j=0;j<V.dim;j++)
28
{
29
perpvec[j] = 0;
30
for(k=0;k<V.dim;k++)
31
perpvec[j] += V.v[xl][k] * perpbase[i][k][j];
32
}
33
if(x[l] < 0)
34
{
35
for(j=0;j<V.dim;j++)
36
perpvec[j] = -perpvec[j];
37
}
38
for(j=0;j<=l;j++)
39
{
40
perpprod[i][l][j] = 0;
41
if(x[j] < 0) xj = -x[j]; else xj = x[j];
42
for(k=0;k<V.dim;k++)
43
perpprod[i][l][j] += perpvec[k] * V.v[xj][k];
44
if(x[j] < 0)
45
perpprod[i][l][j] = -perpprod[i][l][j];
46
}
47
}
48
/******************************************************************\
49
| Check, whether perprod[i] is a submatrix of a matrix in perp
50
| The matrices in perp are assumed to be sorted.
51
\******************************************************************/
52
found = FALSE;
53
u = 0; o = perp_no-1;
54
while(found == FALSE && o >=u )
55
{
56
m = (o+u)/2;
57
tester = 0;
58
for(j=0;j<=I && tester == 0;j++)
59
{
60
for(k=0;k<=j && tester == 0;k++)
61
{
62
if(perp[m][j][k] != perpprod[i][j][k])
63
{
64
if(perp[m][j][k] > perpprod[i][j][k])
65
tester = 1;
66
else tester = -1;
67
}
68
}
69
}
70
if(tester == 0)
71
found = TRUE;
72
else
73
{
74
if(tester == 1) o = m-1;
75
else u = m+1;
76
}
77
}
78
if(found == FALSE)
79
{
80
return(FALSE);
81
}
82
}
83
return(TRUE);
84
}
85
86
87
88
89
static void mach_perp_matrices(fp, P, Pbase, n)
90
fpstruct fp;
91
matrix_TYP **P, **Pbase;
92
int n;
93
{
94
int i,j,k;
95
96
if((perp = (int ***)malloc(perp_no *sizeof(int **))) == 0)
97
{
98
printf("malloc of 'perp' in 'perfect_normalizer' failed\n");
99
exit(2);
100
}
101
for(i=0;i<perp_no;i++)
102
{
103
if((perp[i] = (int **)malloc(n *sizeof(int *))) == 0){
104
printf("malloc of perp[%d] in 'perfect_normalizer' failed\n", i);
105
exit(2);
106
}
107
for(j=0;j<n;j++)
108
{
109
if((perp[i][j] = (int *)malloc(n *sizeof(int))) == 0){
110
printf("malloc of perp[%d][%d] in 'perfect_normalizer' failed\n", i, j);
111
exit(2);
112
}
113
}
114
for(j=0;j<n;j++)
115
for(k=0;k<n;k++)
116
perp[i][j][k] = P[i]->array.SZ[fp.per[j]][fp.per[k]];
117
}
118
if((perpbase = (int ***)malloc(perpdim *sizeof(int **))) == 0)
119
{
120
printf("malloc of 'perpbase' in 'perfect_normalizer' failed\n");
121
exit(2);
122
}
123
for(i=0;i<perpdim;i++)
124
{
125
if((perpbase[i] = (int **)malloc(n *sizeof(int *))) == 0)
126
{
127
printf("malloc of perpbase[%d] in 'perfect_normalizer' failed\n", i);
128
exit(2);
129
}
130
for(j=0;j<n;j++)
131
{
132
if((perpbase[i][j] = (int *)malloc(n *sizeof(int))) == 0)
133
{
134
printf("malloc of perpbase[%d][%d] in 'perfect_normalizer' failed\n", i, j);
135
exit(2);
136
}
137
}
138
for(j=0;j<n;j++)
139
for(k=0;k<n;k++)
140
perpbase[i][j][k] = Pbase[i]->array.SZ[j][k];
141
}
142
if((perpprod = (int ***)malloc(perpdim *sizeof(int **))) == 0)
143
{
144
printf("malloc of 'perpprod' in 'perfect_normalizer' failed\n");
145
exit(2);
146
}
147
for(i=0;i<perpdim;i++)
148
{
149
if((perpprod[i] = (int **)malloc(n *sizeof(int *))) == 0)
150
{
151
printf("malloc of 'perpprod[i]' in 'perfect_normalizer' failed\n");
152
exit(2);
153
}
154
for(j=0;j<n;j++)
155
{
156
if((perpprod[i][j] = (int *)malloc((j+1) *sizeof(int))) == 0)
157
{
158
printf("malloc of 'perpprod[i][j]' in 'perfect_normalizer' failed\n");
159
exit(2);
160
}
161
}
162
}
163
if((perpvec = (int *)malloc(n *sizeof(int))) == 0)
164
{
165
printf("malloc of 'perpvec' in 'perfect_normalizer' failed\n");
166
exit(2);
167
}
168
}
169
170
static void free_perp_matrices(n)
171
int n;
172
{
173
int i,j;
174
for(i=0;i<perp_no;i++)
175
{
176
for(j=0;j<n;j++)
177
free(perp[i][j]);
178
free(perp[i]);
179
}
180
free(perp);
181
for(i=0;i<perpdim;i++)
182
{
183
for(j=0;j<n;j++)
184
free(perpbase[i][j]);
185
free(perpbase[i]);
186
}
187
free(perpbase);
188
for(i=0;i<perpdim;i++)
189
{
190
for(j=0;j<n;j++)
191
free(perpprod[i][j]);
192
free(perpprod[i]);
193
}
194
free(perpprod);
195
free(perpvec);
196
}
197
198