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

563680 views
1
/* last change: 07.02.2001 by Oliver Heidbuechel */
2
3
4
#include <ZZ.h>
5
#include <typedef.h>
6
#include <presentation.h>
7
#include <matrix.h>
8
#include <bravais.h>
9
#include <base.h>
10
#include <datei.h>
11
#include <graph.h>
12
#include <gmp.h>
13
#include <zass.h>
14
#include <tools.h>
15
#include <longtools.h>
16
17
18
extern int OANZ;
19
extern matrix_TYP **OMAT;
20
extern int OFLAG;
21
/* boolean GRAPH = FALSE; */
22
23
24
25
26
/* -------------------------------------------------------------------- */
27
/* P < GL_n(Z) finite */
28
/* Returns the P-invariant maximal sublattices of Z^n */
29
/* (matrices in long_col_hnf - Form) */
30
/* with p_i-power-index, where p_i is a prime given in P->divisors. */
31
/* Returns the number of these sublattices via anz. */
32
/* set trivialflag[x] = TRUE iff lattices[x] = p_i * Z^n */
33
/* -------------------------------------------------------------------- */
34
matrix_TYP **max_sublattices(bravais_TYP *P,
35
int *anz,
36
int **trivialflag,
37
boolean debugflag)
38
{
39
matrix_TYP *F, *tmp, *std, **lattices;
40
41
int p, X[100], i, j;
42
43
bravais_TYP *PP;
44
45
46
anz[0] = 0;
47
OFLAG = TRUE;
48
OANZ = 0;
49
memcpy(X, P->divisors, 100 * sizeof(int));
50
OMAT = (matrix_TYP **)calloc(1000, sizeof(matrix_TYP *));
51
trivialflag[0] = (boolean *)calloc(1000, sizeof(boolean));
52
F = init_mat(P->dim, P->dim, "1");
53
54
for (p = 2; p < 100 ; p++){
55
if (X[p]){
56
PP = copy_bravais(P);
57
memset(PP->divisors, 0, 100 * sizeof(int));
58
PP->divisors[p] = 1;
59
60
/* PP is changed in ZZ */
61
ZZ(PP, F, PP->divisors, NULL, "rbgl1", 0, 0, 0);
62
free_bravais(PP);
63
64
if (OANZ == anz[0]){
65
/* trivial lattice isn't returned */
66
OMAT[OANZ] = init_mat(P->dim, P->dim, "");
67
for(i = 0; i < OMAT[OANZ]->rows; i++){
68
OMAT[OANZ]->array.SZ[i][i] = p;
69
}
70
Check_mat(OMAT[OANZ]);
71
trivialflag[0][OANZ] = TRUE;
72
OANZ++;
73
}
74
else{
75
for (i = anz[0]; i < OANZ; i++){
76
ZZ_transpose_array(OMAT[i]->array.SZ, OMAT[i]->cols);
77
long_col_hnf(OMAT[i]);
78
trivialflag[0][i] = FALSE;
79
}
80
}
81
cleanup_prime();
82
}
83
anz[0] = OANZ;
84
}
85
86
OANZ = 0;
87
OFLAG = FALSE;
88
free_mat(F);
89
lattices = (matrix_TYP **)calloc(anz[0], sizeof(matrix_TYP *));
90
91
for (i = 0; i < anz[0]; i++){
92
93
/* paranoia test */
94
if (debugflag){
95
std = copy_mat(OMAT[i]);
96
long_col_hnf(std);
97
for (j = 0; j < P->gen_no; j++){
98
tmp = mat_mul(P->gen[j], OMAT[i]);
99
long_col_hnf(tmp);
100
if (cmp_mat(std, tmp)){
101
fprintf(stderr, "Not G-invariant!!!\n");
102
exit(2);
103
}
104
free_mat(tmp);
105
}
106
free_mat(std);
107
}
108
109
lattices[i] = copy_mat(OMAT[i]);
110
free_mat(OMAT[i]);
111
}
112
free(OMAT);
113
memcpy(P->divisors, X, 100 * sizeof(int));
114
115
return(lattices);
116
}
117
118
119