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

563665 views
1
2
#include <signal.h>
3
#include "typedef.h"
4
#include "getput.h"
5
#include "tools.h"
6
#include "bravais.h"
7
#include "orbit.h"
8
#include "base.h"
9
#include "matrix.h"
10
#include "longtools.h"
11
#include "voronoi.h"
12
#include "sort.h"
13
#include "reduction.h"
14
#include "autgrp.h"
15
#include "ZZ_P.h"
16
#include "ZZ_irr_const_P.h"
17
#include "ZZ_lll_P.h"
18
#include "ZZ_cen_fun_P.h"
19
#include "ZZ_zclass_P.h"
20
21
extern int INFO_LEVEL;
22
23
24
static int position(matrix_TYP **a,matrix_TYP *x,int n)
25
/* returns the first index i<n such that a[i] == x, and
26
-1 if none exists */
27
{
28
int i=0;
29
30
while (i<n){
31
if (mat_comp(a[i],x) == 0){
32
return i;
33
}
34
i++;
35
}
36
return -1;
37
}
38
39
40
/*------------------------------------------------------------------------------- */
41
static matrix_TYP *is_conjugated_ZZ(n,new)
42
ZZ_node_t *n, *new;
43
{
44
int i,
45
Nanz;
46
47
matrix_TYP *Tmp1,
48
*Tmp2,
49
*A,
50
*X = NULL,
51
**BASE,
52
**N;
53
54
bravais_TYP *H=NULL;
55
56
/* save the normailzer of n->colgroup in case it exits */
57
N = n->col_group->normal;
58
Nanz = n->col_group->normal_no;
59
n->col_group->normal = NULL;
60
n->col_group->normal_no = 0;
61
62
/* bare in mind that is_z_equivalent has got an sideefect in
63
calculating the normalizer of the bravais group of the first
64
argument, and that it only calculates an isometry of formspaces. */
65
Tmp1 = is_z_equivalent_datei(n->col_group,
66
n->group,new->col_group,new->group,&n->perfect,&n->perfect_no);
67
68
/* look whether we already got the bravais group n->brav */
69
if (n->brav == NULL){
70
n->brav = bravais_group(n->col_group,TRUE);
71
}
72
73
if (n->col_group->normal != NULL &&
74
n->col_group->normal_no > 0){
75
/* stick the normalizer to the bravais group */
76
n->brav->normal = n->col_group->normal;
77
n->brav->normal_no = n->col_group->normal_no;
78
}
79
80
n->col_group->normal = N;
81
n->col_group->normal_no = Nanz;
82
83
if (Tmp1 != NULL){
84
/* we should get a stabchain for n->col_group */
85
if (n->stab_chain == NULL){
86
BASE = get_base(n->col_group);
87
n->stab_chain=strong_generators(BASE,n->col_group,FALSE);
88
/* free the base again */
89
for (i=0;i<n->col_group->dim;i++){
90
free_mat(BASE[i]);
91
}
92
free(BASE);
93
}
94
95
Tmp2 = long_mat_inv(Tmp1);
96
H = konj_bravais(new->col_group,Tmp2);
97
free_mat(Tmp2);
98
99
/* now we are in the position to look if H and n->col_group
100
are conjugated */
101
Nanz = n->brav->gen_no + n->brav->normal_no;
102
N = (matrix_TYP **) malloc(Nanz * sizeof(matrix_TYP *));
103
for (i=0;i<Nanz;i++){
104
if (i<n->brav->gen_no){
105
N[i] = n->brav->gen[i];
106
}
107
else{
108
N[i] = n->brav->normal[i-n->brav->gen_no];
109
}
110
}
111
112
if (n->brav->normal_no == 0){
113
fprintf(stderr,
114
"ZZ_zclass: bravais group has no normalizer\n");
115
exit(3);
116
}
117
118
A = conjugated(n->col_group,H,N,Nanz,
119
n->stab_chain);
120
121
free(N);
122
123
if (A == NULL){
124
free_mat(Tmp1);
125
}
126
else{
127
X = mat_mul(Tmp1, A);
128
free_mat(A);
129
free_mat(Tmp1);
130
}
131
}
132
133
if (H!=NULL){
134
free_bravais(H);
135
}
136
137
138
return (X);
139
}
140
141
142
143
/*------------------------------------------------------------------------------- */
144
int deal_with_ZCLASS(data, tree, father, new)
145
ZZ_data_t *data;
146
ZZ_tree_t *tree;
147
ZZ_node_t *father, *new;
148
{
149
150
int f,
151
g;
152
153
bravais_TYP *H;
154
155
ZZ_node_t *n;
156
157
matrix_TYP *X;
158
159
160
161
/* now calculate the (integral) representation
162
on the new lattice (bare in mind that it is
163
row invariant. There is a flaw: normalizer and
164
centralizer won't be correct */
165
f = tree->root->group->normal_no;
166
tree->root->group->normal_no=0;
167
g = tree->root->group->cen_no;
168
tree->root->group->cen_no=0;
169
new->group = konj_bravais(tree->root->group,new->U);
170
tree->root->group->normal_no = f;
171
tree->root->group->cen_no = g;
172
173
/* the second flaw of konj_bravais is the formspace */
174
for (f=0;f<new->group->form_no;f++)
175
new->group->form[f]->kgv = 1;
176
long_rein_formspace(new->group->form,new->group->form_no,1);
177
178
new->col_group = tr_bravais(new->group,1,FALSE);
179
180
/* see if we've got an Z-equivalent rep. already */
181
n = tree->root;
182
while (n != NULL){
183
X = is_conjugated_ZZ(n,new);
184
if (X != NULL){
185
free_mat(X);
186
return TRUE;
187
}
188
n = n->next;
189
}
190
191
/* exit(3); */
192
193
return FALSE;
194
}
195
196
197
198
199
/* -------------------------------------------------------------------------- */
200
matrix_TYP *special_deal_with_zclass(ZZ_tree_t *tree,
201
bravais_TYP *group,
202
int *nr)
203
{
204
ZZ_node_t *n,
205
*new;
206
207
matrix_TYP *X;
208
209
210
nr[0] = 0;
211
new = (ZZ_node_t *)calloc(1, sizeof(ZZ_node_t));
212
new->col_group = group;
213
new->group = tr_bravais(group, 1, FALSE);
214
215
n = tree->root;
216
while (n != NULL){
217
X = is_conjugated_ZZ(n, new);
218
if (X != NULL){
219
free_bravais(new->group);
220
new->col_group = NULL;
221
free(new);
222
n = NULL;
223
return(X);
224
}
225
nr[0]++;
226
n = n->next;
227
}
228
229
fprintf(stderr,"ERROR in special_deal_with_zclass\n");
230
exit(4);
231
}
232
233
234
235
236
/*------------------------------------------------------------------------------- */
237
static int is_contained(matrix_TYP *U,matrix_TYP *V)
238
{
239
240
int i,
241
j,
242
k,
243
sum;
244
245
for (i=0;i<U->cols;i++){
246
for (j=0;j<U->rows;j++){
247
sum = 0;
248
for (k=0;k<U->rows;k++){
249
sum += (V->array.SZ[i][k] * U->array.SZ[k][j]);
250
}
251
if ((sum % V->kgv) != 0)
252
return FALSE;
253
}
254
}
255
256
return TRUE;
257
/*
258
matrix_TYP *tmp;
259
260
tmp = mat_mul(V,U);
261
262
Check_mat(tmp);
263
264
if (tmp->kgv == 1){
265
free_mat(tmp);
266
return TRUE;
267
}
268
else{
269
free_mat(tmp);
270
return FALSE;
271
}
272
*/
273
274
}
275
276
277
278
/*------------------------------------------------------------------------------- */
279
static int suche_mat(matrix_TYP *mat,
280
matrix_TYP **liste,
281
int anz)
282
{
283
int i;
284
285
for (i = 0; i < anz; i++){
286
if (cmp_mat(mat, liste[i]) == 0)
287
return(i);
288
}
289
return(-1);
290
}
291
292
293
294
/*------------------------------------------------------------------------------- */
295
int in_bahn(matrix_TYP *lattice,
296
ZZ_node_t *father,
297
int *i)
298
{
299
int flag = 0;
300
301
302
303
for (i[0] = 0; i[0] < father->N_no_orbits && !flag; i[0]++){
304
flag = (mat_search(lattice, father->N_orbits[i[0]], father->N_lengths[i[0]], mat_comp) != -1);
305
}
306
307
return(flag);
308
}
309
310
311
312
/*------------------------------------------------------------------------------- */
313
int orbit_under_normalizer(data,tree,father,new,ii,jj,inzidenz,nr,nnn)
314
ZZ_data_t *data;
315
ZZ_tree_t *tree;
316
ZZ_node_t *father, *new;
317
int ii, jj;
318
QtoZ_TYP *inzidenz;
319
int *nr;
320
ZZ_node_t **nnn;
321
{
322
323
int i__,
324
j__,
325
i, pos, oflag = 0,
326
father_flag = FALSE,
327
flag = FALSE;
328
329
static int orb[6];
330
331
matrix_TYP *tmp;
332
333
ZZ_node_t *p;
334
335
ZZ_couple_t *laeufer;
336
337
bravais_TYP *G;
338
339
orb[0]=0;
340
orb[1]=4;
341
342
tmp = copy_mat(new->U);
343
long_row_hnf(tmp);
344
ZZ_transpose_array(tmp->array.SZ,tmp->cols);
345
346
/* search the whole tree */
347
p = tree->root;
348
while (p!= NULL){
349
for (i__=0;i__<p->N_no_orbits && p->level==father->level && !flag;i__++){
350
flag = (mat_search(tmp,p->N_orbits[i__], p->N_lengths[i__],mat_comp) != -1);
351
}
352
if (flag)
353
break;
354
p = p->next;
355
}
356
357
/* search the father
358
p = father;
359
for (i__=0;i__<p->N_no_orbits && !father_flag;i__++){
360
father_flag = (mat_search(tmp,p->N_orbits[i__],
361
p->N_lengths[i__]) != -1);
362
} */
363
free_mat(tmp);
364
365
/* next 14 lines: oliver 10.8.00: graph for QtoZ */
366
if (flag && GRAPH){
367
laeufer = p->child;
368
for (i = 0; i < p->N_no_orbits - i__; i++){
369
laeufer = laeufer->elder;
370
if (laeufer == NULL){
371
fprintf(stderr,"ERROR 1 in orbit_under_normalizer!\n");
372
exit(2);
373
}
374
}
375
nnn[0] = laeufer->he;
376
nr[0] = suche_mat(laeufer->he->U, inzidenz->gitter, inzidenz->anz);
377
if (nr[0] == -1){
378
fprintf(stderr,"ERROR 2 in orbit_under_normalizer!\n");
379
exit(3);
380
}
381
}
382
/* else { */
383
p = father;
384
if (!flag){
385
/* p = father; */
386
tmp = tr_pose(new->U);
387
if (p->N_no_orbits == 0){
388
p->N_orbits = (matrix_TYP ***) malloc(1 *
389
sizeof(matrix_TYP **));
390
p->N_lengths = (int *) malloc(1 * sizeof(int));
391
}
392
else{
393
p->N_orbits = (matrix_TYP ***) realloc(p->N_orbits,
394
(p->N_no_orbits+1)* sizeof(matrix_TYP **));
395
p->N_lengths = (int *) realloc(p->N_lengths,
396
(p->N_no_orbits + 1) * sizeof(int));
397
}
398
399
G = init_bravais(tree->root->group->dim);
400
401
/* tilman: changed on 06.05.1998:
402
G->gen_no = tree->root->col_group->normal_no;
403
G->gen = tree->root->col_group->normal; */
404
G->gen_no = tree->root->group->normal_no;
405
G->gen = tree->root->group->normal;
406
407
p->N_orbits[p->N_no_orbits] = orbit_alg(tmp,G,NULL,orb,
408
&p->N_lengths[p->N_no_orbits]);
409
410
/* sort it */
411
mat_quicksort(p->N_orbits[p->N_no_orbits],0,
412
p->N_lengths[p->N_no_orbits]-1,mat_comp);
413
414
p->N_no_orbits++;
415
416
G->gen_no = 0;
417
G->gen = NULL;
418
free_bravais(G);
419
free_mat(tmp);
420
}
421
422
if (!flag){
423
fprintf(stderr,"father: level %d number of orbits %d lengths %d\n",
424
p->level,p->N_no_orbits,p->N_lengths[p->N_no_orbits-1]);
425
}
426
427
if (INFO_LEVEL & 8){
428
if (flag || father_flag){
429
fprintf(stderr,"returned TRUE\n");
430
}
431
else{
432
fprintf(stderr,"returned FALSE\n");
433
}
434
}
435
436
return (flag || father_flag);
437
438
}
439
440
441
442
/* ---------------------------------------------------------------------------------------- */
443
matrix_TYP *konjugierende(matrix_TYP *Li,
444
bravais_TYP *G,
445
ZZ_node_t *n)
446
{
447
ZZ_node_t *new;
448
449
matrix_TYP *X;
450
451
bravais_TYP *group;
452
453
int f, g;
454
455
456
457
f = G->normal_no; G->normal_no = 0;
458
g = G->cen_no; G->cen_no = 0;
459
group = konj_bravais(G, Li);
460
G->normal_no = f;
461
G->cen_no = g;
462
for (f = 0; f < group->form_no; f++)
463
group->form[f]->kgv = 1;
464
long_rein_formspace(group->form, group->form_no, 1);
465
466
new = (ZZ_node_t *)calloc(1, sizeof(ZZ_node_t));
467
new->col_group = group;
468
new->group = tr_bravais(group, 1, FALSE);
469
470
X = is_conjugated_ZZ(n, new);
471
472
/* clean */
473
free_bravais(new->group);
474
free_bravais(new->col_group);
475
free(new);
476
477
return(X);
478
}
479
480
481
482
483
484
485
486
487
488
489
490
491