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

563596 views
1
#include "typedef.h"
2
#include "voronoi.h"
3
#include "getput.h"
4
#include "matrix.h"
5
#include "bravais.h"
6
#include "longtools.h"
7
#include "symm.h"
8
#include "autgrp.h"
9
#include "voronoi.h"
10
#include "reduction.h"
11
#include "sort.h"
12
#include "tools.h"
13
14
extern int INFO_LEVEL;
15
16
matrix_TYP *is_z_equivalent_datei(bravais_TYP *G,bravais_TYP *G_tr,
17
bravais_TYP *H,bravais_TYP *H_tr,voronoi_TYP ***gp,int *anz_gperfect)
18
{
19
int i,
20
j,
21
dim,
22
epsilon = 101,
23
ming,
24
minh,
25
prime = 1949,
26
anz_hneighbours,
27
anz_gneighbours,
28
max; /* will hold the maximal diagonal entry of a form */
29
30
bravais_TYP *GB; /* the bravais group of G for temporary purposes */
31
32
matrix_TYP *gtrbifo, /* the tracebifo of G,G_tr */
33
*htrbifo, /* the tracebifo of H,H_tr */
34
*tmp,
35
*tmp2,
36
*id,
37
*gperfect, /* will hold ONE G-perfect form modulo the
38
operation of the normalizer */
39
*hperfect, /* will hold ONE H-perfect form */
40
*HSV, /* will hold the short vectors of hperfect */
41
*GSV,
42
**hneighbours, /* holds all neighbours of hperfect */
43
**gneighbours,
44
*h_pair=NULL, /* h will be transformed in a way such that
45
we get a "nice" basis of the formspace */
46
*conj; /* the matrix that conjugates these both groups,
47
if this exists */
48
49
if (INFO_LEVEL & 4){
50
fprintf(stderr,"Entered is_z_equivalent_ZZ\n");
51
}
52
53
dim = G->dim;
54
55
/* checking all the trivialities */
56
if (G->dim != H->dim){
57
conj = NULL;
58
if (INFO_LEVEL & 4){
59
fprintf(stderr,"the groups don't even live in the same universe\n");
60
}
61
}
62
else if(G->form_no != H->form_no){
63
conj = NULL;
64
if (INFO_LEVEL & 4){
65
fprintf(stderr,"the groups are not conjugated\n");
66
fprintf(stderr,"Dimension of the Formspace of G: %d\n",G->form_no);
67
fprintf(stderr,"Dimension of the Formspace of H: %d\n",H->form_no);
68
}
69
}
70
/* the order is an criterion if it's known */
71
else if((G->order != H->order) && (G->order !=0) && (H->order !=0)){
72
conj = NULL;
73
if (INFO_LEVEL & 4){
74
fprintf(stderr,"the groups are not conjugated\n");
75
fprintf(stderr,"Order of G: %d\n",G->order);
76
fprintf(stderr,"Order of H: %d\n",H->order);
77
}
78
}
79
else{
80
/* now start the real bussiness */
81
82
/* firstly calculate the trace_bifo for G,H */
83
gtrbifo = trace_bifo(G->form,G_tr->form,G->form_no);
84
htrbifo = trace_bifo(H->form,H_tr->form,H->form_no);
85
86
/* inserted tilman 30.5.97 */
87
for (i=0;i<G->form_no;i++){
88
Check_mat(G->form[i]);
89
Check_mat(H->form[i]);
90
}
91
92
/* output for debugging
93
put_mat(gtrbifo,NULL,"gtrbifo",2);
94
put_mat(htrbifo,NULL,"htrbifo",2); */
95
96
/* the two trace bifos should have the same elementary devisors */
97
tmp = long_elt_mat(NULL,gtrbifo,NULL);
98
tmp2 = long_elt_mat(NULL,htrbifo,NULL);
99
100
if (mat_comp(tmp,tmp2) == 0){
101
free_mat(tmp);
102
free_mat(tmp2);
103
104
id = init_mat(dim,dim,"1");
105
106
if (INFO_LEVEL & 4){
107
fprintf(stderr,"\n");
108
}
109
110
/* now calculate one G-perfect form */
111
if (gp[0] == NULL && anz_gperfect[0] == 0){
112
tmp = rform(G->gen,G->gen_no,id,epsilon);
113
gperfect = first_perfect(tmp,G,G_tr->form,gtrbifo,&ming);
114
free_mat(tmp);
115
}
116
else{
117
gperfect = NULL;
118
}
119
120
/* now calculate one H-perfect form, and the short vectors
121
of it */
122
tmp = rform(H->gen,H->gen_no,id,epsilon);
123
hperfect = first_perfect(tmp,H,H_tr->form,htrbifo,&minh);
124
free_mat(tmp);
125
126
/* reduce H by pair_reduction, and transform H_tr accordingly */
127
h_pair = init_mat(H->dim,H->dim,"1");
128
tmp = pair_red(hperfect,h_pair);
129
free_mat(hperfect);
130
131
transform_pair(H,H_tr,h_pair);
132
133
free_mat(htrbifo);
134
htrbifo = trace_bifo(H->form,H_tr->form,H->form_no);
135
hperfect = first_perfect(tmp,H,H_tr->form,htrbifo,&minh);
136
free_mat(tmp);
137
138
max = max_diagonal_entry(hperfect);
139
HSV = short_vectors(hperfect,max,0,0,0,&i);
140
141
if (INFO_LEVEL & 4){
142
fprintf(stderr,"Got perfect forms for G and H.\n");
143
}
144
145
/* output for debugging */
146
if (INFO_LEVEL & 4){
147
put_mat(hperfect,NULL,"hperfect",2);
148
put_mat(htrbifo,NULL,"htrbifo",2);
149
printf("maximaler diagonaleintrag von hperfect %d\n",max);
150
}
151
152
/* now calculate all perfect neigbours of hperfect */
153
hneighbours = (matrix_TYP **) malloc(sizeof(matrix_TYP *));
154
hneighbours[0] = hperfect;
155
anz_hneighbours = neighbours(&hneighbours,H,H_tr->form,htrbifo,
156
HSV,minh);
157
158
if (INFO_LEVEL & 4){
159
fprintf(stderr,"Calculated the neighbours of hperfect.\n");
160
}
161
162
/* and calculate all G-perfect forms which represent the orbit
163
of the normalizer on them, i.e. the quotient graph */
164
if (gp[0]== NULL && anz_gperfect[0]==0){
165
GB = bravais_group(G,TRUE);
166
gp[0] = normalizer(gperfect,GB,G_tr,prime,anz_gperfect);
167
G->normal = GB->normal; G->normal_no = GB->normal_no;
168
GB->normal = NULL; GB->normal_no = 0;
169
free_bravais(GB);
170
}
171
172
if (INFO_LEVEL & 4){
173
fprintf(stderr,"Calculated the normalizer of G.\n");
174
}
175
176
/* now search for a G-perfect form which is isometric to the
177
H-perfect form and all of its neighbours are also */
178
conj = NULL;
179
i = 0;
180
while ((i<anz_gperfect[0]) && (conj == NULL)){
181
182
/* calculate the short vectors of the G-perfect form in question */
183
GSV = short_vectors(gp[0][i]->gram,max,0,0,0,&j);
184
185
/* let's see whether there is an isometry between this form
186
and hperfect */
187
conj = isometry(&hperfect,&gp[0][i]->gram,1,HSV,GSV,NULL,0,NULL);
188
189
if (INFO_LEVEL & 4){
190
fprintf(stderr,"calculating isometries\n");
191
fprintf(stderr,"%d-th of %d\n",i+1,anz_gperfect[0]);
192
if (conj!=NULL){
193
fprintf(stderr,"found a new isometry.\n");
194
put_mat(conj,NULL,"conj",2);
195
put_mat(hperfect,NULL,"hperfect",2);
196
put_mat(gp[0][i]->gram,NULL,"gp[i]->gram",2);
197
}
198
}
199
200
/* output for debugging
201
put_mat(hperfect,NULL,"hperfect",2);
202
put_mat(gp[i]->gram,NULL,"gp[i]->gram",2);
203
put_mat(conj,NULL,"conj",2);
204
put_mat(HSV,NULL,"HSV",2);
205
put_mat(GSV,NULL,"GSV",2); */
206
207
if (conj != NULL){
208
/* there is an isometry, let's see whether it respects the
209
neighbours also */
210
/* because we have an isometry, the forms will have the same
211
minimum */
212
ming = minh;
213
214
/* now calculate all perfect neigbours of hperfect */
215
gneighbours = (matrix_TYP **) malloc(sizeof(matrix_TYP));
216
gneighbours[0] = gp[0][i]->gram;
217
anz_gneighbours = neighbours(&gneighbours,G,G_tr->form,gtrbifo,
218
GSV,ming);
219
220
free_mat(conj);
221
conj = NULL;
222
223
if (anz_hneighbours == anz_gneighbours){
224
225
if (INFO_LEVEL & 4){
226
printf("anz_hneighbours %d\n",anz_hneighbours);
227
for (j=0;j<=anz_hneighbours;j++){
228
put_mat(hneighbours[j],NULL,"hneighbours[j]",2);
229
put_mat(gneighbours[j],NULL,"gneighbours[j]",2);
230
}
231
}
232
233
conj = extends_to_isometry(hneighbours,HSV,
234
anz_hneighbours+1,gneighbours,GSV,
235
anz_gneighbours+1,H->form_no,1);
236
237
238
}
239
/* cleaning up memory */
240
for (j=0;j<anz_gneighbours;j++){
241
free_mat(gneighbours[j+1]);
242
}
243
free(gneighbours);
244
245
}
246
247
free_mat(GSV);
248
i++;
249
}
250
251
/* clean up memory used only here */
252
free_mat(id);
253
free_mat(hperfect);
254
if (gperfect != NULL) free_mat(gperfect);
255
free_mat(HSV);
256
for (i=0;i<anz_hneighbours;i++){
257
free_mat(hneighbours[i+1]);
258
}
259
free(hneighbours);
260
261
}
262
else{
263
/* the groups are not conjugated, so clean up the memory used
264
so far and return NULL */
265
if (INFO_LEVEL & 4){
266
put_mat(tmp,NULL,"tmp",2);
267
put_mat(tmp2,NULL,"tmp2",2);
268
fprintf(stderr,
269
"The groups are not conjugated: elementary divisors\n");
270
}
271
free_mat(tmp);
272
free_mat(tmp2);
273
conj = NULL;
274
}
275
276
/* clean up memory used only in this stage */
277
free_mat(gtrbifo);
278
free_mat(htrbifo);
279
}
280
281
/* retransform H, H_tr to the original value, and fiddle around with
282
conj a bit */
283
if (h_pair != NULL){
284
tmp = long_mat_inv(h_pair);
285
transform_pair(H,H_tr,tmp);
286
if (conj != NULL){
287
mat_muleq(conj,h_pair);
288
}
289
free_mat(tmp);
290
free_mat(h_pair);
291
}
292
293
/* we will return the transposed matrix if there was one at all */
294
if (conj != NULL){
295
tmp = tr_pose(conj);
296
free_mat(conj);
297
conj = tmp;
298
}
299
300
return conj;
301
}
302
303