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

563604 views
1
#include "typedef.h"
2
#include "voronoi.h"
3
#include "longtools.h"
4
#include "symm.h"
5
#include "bravais.h"
6
#include "autgrp.h"
7
#include "polyeder.h"
8
#include "matrix.h"
9
#include "reduction.h"
10
#include "orbit.h"
11
#include "tools.h"
12
/**************************************************************************\
13
@---------------------------------------------------------------------------
14
@---------------------------------------------------------------------------
15
@ FILE: normalizer.c
16
@---------------------------------------------------------------------------
17
@---------------------------------------------------------------------------
18
@
19
\**************************************************************************/
20
21
static matrix_TYP *search_normal_isometry(Vneu, V, Vanz, G, Gtr, bifo, no)
22
voronoi_TYP *Vneu, **V;
23
bravais_TYP *G, *Gtr;
24
matrix_TYP *bifo;
25
int Vanz, *no;
26
{
27
int i;
28
int found;
29
matrix_TYP *X;
30
31
found = FALSE;
32
*no = -1;
33
for(i=0;i<Vanz && found == FALSE;i++)
34
{
35
X = calc_voronoi_isometry(V[i], Vneu, G, Gtr, bifo);
36
if(X != NULL)
37
{
38
found = TRUE;
39
*no = i;
40
}
41
}
42
if(found == TRUE)
43
{
44
i = *no;
45
}
46
return(X);
47
}
48
49
50
/**************************************************************************\
51
@---------------------------------------------------------------------------
52
@ voronoi_TYP **normalizer(P, G, Gtr, prime, V_no)
53
@ matrix_TYP *P;
54
@ bravais_TYP *G, *Gtr;
55
@ int prime, *V_no;
56
@
57
@ The arguments of normalizer are
58
@ P: A G-perfect form (can be calculated with 'first_perfect')
59
@ G: A group given as 'bravais_TYP*' where 'G->form' must contain a
60
@ Z-Basis of the integral G-invariant matrices.
61
@ Gtr: The group G^{tr} given as 'bravais_TYP', also
62
@ with a Z-basis in 'G->form'
63
@ prime: a prime number (used to calculate determinates modulo p
64
@ for a simple criterion of two symmetric matrices been
65
@ not isometric.
66
@ V_no: via this pointer the number of returned 'voronoi_TYP'
67
@ is returned.
68
@
69
@ 'normalizer' calculates representatives of the G-perfect forms.
70
@ The are returned in a list 'voronoi_TYP**'
71
@ Furthermore generators of the integral normalizer of G are calculated
72
@ and written to G->normal. Their number is G->normal_no.
73
@
74
@---------------------------------------------------------------------------
75
@
76
\**************************************************************************/
77
voronoi_TYP **normalizer(P, G, Gtr, prime, V_no)
78
matrix_TYP *P;
79
bravais_TYP *G, *Gtr;
80
int prime, *V_no;
81
{
82
int i,j,k,l;
83
int dim, fdim;
84
voronoi_TYP **V;
85
voronoi_TYP *Vneu;
86
matrix_TYP *Dir, **N, *X, *bifo;
87
int Vanz, Nanz, diranz, no;
88
int lc, rc;
89
90
dim = G->dim;
91
fdim = G->form_no;
92
if( (V = (voronoi_TYP **)malloc(1 *sizeof(voronoi_TYP *))) == NULL)
93
{
94
printf("malloc of 'V' in 'normalizer' failed\n");
95
exit(2);
96
}
97
V[0] = init_voronoi();
98
V[0]->gram = copy_mat(P);
99
Check_mat(V[0]->gram);
100
bifo = trace_bifo(G->form, Gtr->form, fdim);
101
calc_voronoi_complete(V[0], G, Gtr, bifo, prime);
102
Nanz = V[0]->stab->gen_no;
103
if( (N = (matrix_TYP **)malloc(Nanz *sizeof(matrix_TYP *))) == NULL)
104
{
105
printf("malloc of 'N' in 'normalizer' failed\n");
106
exit(2);
107
}
108
for(i=0;i<Nanz;i++)
109
N[i] = copy_mat(V[0]->stab->gen[i]);
110
Vanz = 1;
111
Vneu = init_voronoi();
112
for(i=0;i<Vanz;i++)
113
{
114
diranz = V[i]->dir_reps->cols;
115
real_mat(V[i]->dir_reps, 3, diranz);
116
117
/* geaendert testweise am 06.11.96 tilman */
118
for(j=0;j<diranz;j++)
119
{
120
/***************************************************************\
121
| Calculate 'Vneu', the neighbour of V[i] in direction j
122
\***************************************************************/
123
Dir = vec_to_form(V[i]->pol->vert[V[i]->dir_reps->array.SZ[0][j]]->v,
124
G->form, fdim);
125
Vneu->gram = voronoi_neighbour(V[i]->gram, Dir, V[i]->min, &lc, &rc);
126
free_mat(Dir);
127
128
/* changed: tilman 07/11/96 */
129
/* voronoi_neighbour returns NULL sometimes, and this causes
130
chrashes in calc_voronoi_basics */
131
if (Vneu->gram != NULL){
132
divide_by_gcd(Vneu->gram);
133
calc_voronoi_basics(Vneu, G, Gtr, prime);
134
/***************************************************************\
135
| Check if 'Vneu' is a new typ of perfect form or not
136
| if 'Vneu' is new, 'no = -1' and 'X = NULL'
137
| if not, 'X' is an isometry in the integral normalizer of 'G'
138
| and 'Vneu' is isometric to V[no].
139
\***************************************************************/
140
X = search_normal_isometry(Vneu, V, Vanz, G, Gtr, bifo, &no);
141
if(no == -1)
142
{
143
V[i]->dir_reps->array.SZ[2][j] = Vanz;
144
calc_voronoi_complete(Vneu, G, Gtr, bifo, prime);
145
146
l = Vneu->stab->gen_no;
147
Nanz += l;
148
if((N =(matrix_TYP **)realloc(N,Nanz *sizeof(matrix_TYP *)))
149
== NULL)
150
{
151
printf("realloc of 'N' in 'normalizer' failed\n");
152
exit(2);
153
}
154
for(k=0;k<l; k++)
155
N[Nanz-l+k] = copy_mat(Vneu->stab->gen[k]);
156
157
Vanz++;
158
if((V=(voronoi_TYP **)realloc(V,Vanz *sizeof(voronoi_TYP *)))
159
== NULL)
160
{
161
printf("realloc of 'V' in 'normalizer' failed\n");
162
exit(2);
163
}
164
V[Vanz-1] = Vneu;
165
Vneu = init_voronoi();
166
}
167
else
168
{
169
V[i]->dir_reps->array.SZ[2][j] = no;
170
Nanz ++;
171
if((N=(matrix_TYP **)realloc(N,Nanz *sizeof(matrix_TYP *)))
172
== NULL)
173
{
174
printf("realloc of 'N' in 'normalizer' failed\n");
175
exit(2);
176
}
177
N[Nanz-1] = X;
178
clear_voronoi(Vneu);
179
}
180
}
181
}
182
}
183
*V_no = Vanz;
184
if(G->normal_no != 0)
185
{
186
for(i=0;i<G->normal_no;i++)
187
free_mat(G->normal[i]);
188
free(G->normal);
189
}
190
G->normal = N;
191
G->normal_no = Nanz;
192
free_mat(bifo);
193
if (Vneu != NULL){
194
clear_voronoi(Vneu);
195
free(Vneu);
196
Vneu = NULL;
197
}
198
199
/* inserted tilman 20.06.97 to reduce the number of generators for
200
the normalizer */
201
red_normal(G);
202
203
return(V);
204
}
205
206