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: 02.11.00 by Oliver Heidbuechel */
2
3
4
5
#include <typedef.h>
6
#include <matrix.h>
7
#include <bravais.h>
8
#include <base.h>
9
#include <graph.h>
10
#include <zass.h>
11
#include <datei.h>
12
#include <longtools.h>
13
14
15
16
/* ----------------------------------------------------------------------------- */
17
/* this is a function which make the same as the program same_generators */
18
/* the code is taken out of the main-function of same_generators */
19
/* ----------------------------------------------------------------------------- */
20
matrix_TYP *sg(bravais_TYP *R,
21
bravais_TYP *P)
22
{
23
matrix_TYP **RG, *coz;
24
25
int **words, denominator,
26
j, k;
27
28
29
30
RG = (matrix_TYP **)calloc(R->gen_no, sizeof(matrix_TYP *));
31
words = (int **)calloc(P->gen_no, sizeof(int *));
32
denominator = 1;
33
for (j = 0; j < R->gen_no; j++){
34
RG[j] = copy_mat(R->gen[j]);
35
RG[j]->cols--;
36
RG[j]->rows--;
37
Check_mat(RG[j]);
38
if (!RG[j]->flags.Integral){
39
fprintf(stderr,"The point group has to be integral\n");
40
exit(3);
41
}
42
rat2kgv(R->gen[j]);
43
denominator *= (R->gen[j]->kgv / GGT(R->gen[j]->kgv, denominator));
44
}
45
46
/* stick the rigth INTEGRAL cozycle at the end of the RG[j] */
47
for (j = 0; j < R->gen_no; j++){
48
RG[j]->cols++;
49
RG[j]->rows++;
50
for (k = 0; k < RG[j]->rows-1; k++){
51
RG[j]->array.SZ[k][R->dim-1] = (denominator / R->gen[j]->kgv) *
52
R->gen[j]->array.SZ[k][R->dim-1];
53
RG[j]->array.SZ[R->dim-1][R->dim-1] = 1;
54
Check_mat(RG[j]);
55
}
56
}
57
58
/* get the cozycle on the right generators */
59
coz = reget_gen(RG, R->gen_no, P, words, TRUE);
60
61
/* the cozykle has to become the right denominator */
62
coz->kgv = denominator;
63
Check_mat(coz);
64
65
for (j = 0; j < R->gen_no; j++){
66
free_mat(RG[j]);
67
}
68
for (j = 0; j < P->gen_no; j++){
69
free(words[j]);
70
}
71
free(words);
72
free(RG);
73
74
return(coz);
75
}
76
77
78
79
/* ----------------------------------------------------------------------------- */
80
/* GL = <gl_1, ..., gl_m> = <s1, ..., s_m> = standard */
81
/* X: informations about the cohomology group of standard */
82
/* calculate the cocycles for g1_1, ..., gl_m */
83
/* ----------------------------------------------------------------------------- */
84
matrix_TYP *H1_of_standard_to_GL(bravais_TYP *GL,
85
bravais_TYP *standard,
86
matrix_TYP **X)
87
{
88
int i, j, X_first;
89
90
matrix_TYP *coz, *help;
91
92
bravais_TYP *RG;
93
94
95
96
for (X_first = 0; X_first < X[1]->cols && X[1]->array.SZ[X_first][X_first] == 1; X_first++);
97
coz = init_mat(X[0]->rows, X[0]->cols, "");
98
99
for (i = 0; i < X[0]->cols; i++){
100
help = init_mat(X[0]->rows, 1, "");
101
for (j = 0; j < X[0]->rows; j++){
102
help->array.SZ[j][0] = X[0]->array.SZ[j][i];
103
}
104
help->kgv = X[1]->array.SZ[i + X_first][i + X_first];
105
help->flags.Integral = FALSE;
106
RG = extract_r(standard, help);
107
free_mat(help);
108
help = sg(RG, GL);
109
if (help->kgv != X[1]->array.SZ[i + X_first][i + X_first]){
110
fprintf(stderr, "ERROR in H1_of_standard_to_GL!\n");
111
exit(17);
112
}
113
for (j = 0; j < X[0]->rows; j++){
114
coz->array.SZ[j][i] = help->array.SZ[j][0];
115
}
116
free_mat(help);
117
free_bravais(RG);
118
}
119
120
return(coz);
121
}
122
123
124
125
/* ----------------------------------------------------------------------------- */
126
/* calculate the kernel and H^1/Ker for phi */
127
/* ----------------------------------------------------------------------------- */
128
static void kernel_fkt(matrix_TYP *phi,
129
matrix_TYP *A,
130
int A_first,
131
matrix_TYP *B,
132
matrix_TYP **kernel,
133
H1_mod_ker_TYP *H1_mod_ker)
134
{
135
int i, j, rows, cols, B_first, counter = 0, flagge, zahl,
136
D_first, D_last, D_diff;
137
138
matrix_TYP *ker, *L, *R, *D, *Li;
139
140
141
for (B_first = 0; B_first < B->cols && B->array.SZ[B_first][B_first] == 1; B_first++);
142
143
/* expand phi */
144
rows = phi->rows;
145
cols = phi->cols;
146
real_mat(phi, rows, cols + rows);
147
for (i = 0; i < rows; i++){
148
phi->array.SZ[i][i + cols] = B->array.SZ[i + B_first][i + B_first];
149
}
150
151
/* calculate kernel */
152
ker = long_kernel_mat(phi);
153
kernel[0] = init_mat(cols, ker->cols, "");
154
for (i = 0; i < ker->cols; i++){
155
flagge = 0;
156
for (j = 0; j < cols; j++){
157
zahl = ker->array.SZ[j][i] % A->array.SZ[j + A_first][j + A_first];
158
if (zahl < 0)
159
zahl += A->array.SZ[j + A_first][j + A_first];
160
if (zahl != 0)
161
flagge = 1;
162
kernel[0]->array.SZ[j][counter] = zahl;
163
}
164
if (flagge == 1){
165
counter++;
166
}
167
}
168
free_mat(ker);
169
170
/* calculate A/ker(phi) */
171
if (counter == 0){
172
/* trivial part: ker(phi) = 0 */
173
H1_mod_ker[0].D = init_mat(cols, cols, "");
174
H1_mod_ker[0].M = (matrix_TYP **)calloc(cols, sizeof(matrix_TYP *));
175
H1_mod_ker[0].i = init_mat(cols, cols, "1");
176
for (i = 0; i < cols; i++){
177
H1_mod_ker[0].D->array.SZ[i][i] = A->array.SZ[i + A_first][i + A_first];
178
H1_mod_ker[0].M[i] = init_mat(cols, 1, "");
179
H1_mod_ker[0].M[i]->array.SZ[i][0] = 1;
180
}
181
H1_mod_ker[0].erz_no = cols;
182
H1_mod_ker[0].D_first = 0;
183
}
184
else{
185
real_mat(kernel[0], cols, counter + cols);
186
for (i = 0; i < cols; i++){
187
kernel[0]->array.SZ[i][i + counter] = A->array.SZ[i + A_first][i + A_first];
188
}
189
L = init_mat(cols, cols, "1");
190
R = init_mat(counter + cols, counter + cols, "1");
191
D = long_elt_mat(L, kernel[0], R);
192
Li = mat_inv(L);
193
/*
194
standard_form(L, A, A_first);
195
Li = graph_mat_inv(L, A, A_first);
196
*/
197
for (D_first = 0; D_first < D->rows && D->array.SZ[D_first][D_first] == 1; D_first++);
198
for (D_last = D_first; D_last < D->rows && D->array.SZ[D_last][D_last] != 0; D_last++);
199
D_diff = D_last - D_first;
200
H1_mod_ker[0].M = (matrix_TYP **)calloc(D_diff, sizeof(matrix_TYP *));
201
for (i = 0; i < D_diff; i++){
202
H1_mod_ker[0].M[i] = init_mat(cols, 1, "");
203
for (j = 0; j < cols; j++){
204
H1_mod_ker[0].M[i]->array.SZ[j][0] = Li->array.SZ[j][i + D_first] %
205
A->array.SZ[j + A_first][j + A_first];
206
if (H1_mod_ker[0].M[i]->array.SZ[j][0] < 0)
207
H1_mod_ker[0].M[i]->array.SZ[j][0] += A->array.SZ[j + A_first][j + A_first];
208
}
209
}
210
H1_mod_ker[0].erz_no = D_diff;
211
H1_mod_ker[0].D = D;
212
H1_mod_ker[0].D_first = D_first;
213
214
H1_mod_ker[0].i = L;
215
free_mat(Li);
216
free_mat(R);
217
D = NULL;
218
Li = NULL;
219
}
220
221
/* clean */
222
real_mat(phi, rows, cols);
223
real_mat(kernel[0], cols, counter);
224
}
225
226
227
228
/* -------------------------------------------------------------------------------- */
229
/* calculate phi: H^1(G, Q^n/L) -> H^1(G,Q^n/Z^n), i.e. */
230
/* calculate phi: H^1(given by Xi) -> H^1(given by Xj) */
231
/* -------------------------------------------------------------------------------- */
232
void calculate_phi(matrix_TYP *diag,
233
matrix_TYP *coz,
234
matrix_TYP **Xi,
235
matrix_TYP **Xj,
236
matrix_TYP *GLS,
237
matrix_TYP **phi,
238
matrix_TYP **kernel,
239
matrix_TYP ***image,
240
int *image_gen_no,
241
H1_mod_ker_TYP *H1_mod_ker)
242
{
243
matrix_TYP *H1_L,
244
*tmp,
245
*test;
246
247
int i, j,
248
dim_i, dim_j, first;
249
250
251
252
for (first = 0; first < Xj[1]->cols && Xj[1]->array.SZ[first][first] == 1; first++);
253
254
/* calculate cohomology group for the lattice */
255
if (coz->cols > 0)
256
H1_L = mat_mul(diag, coz);
257
else
258
H1_L = init_mat(diag->rows, 0, "");
259
260
dim_j = H1_L->cols;
261
dim_i = Xi[0]->cols;
262
phi[0] = init_mat(dim_i, dim_j, "");
263
264
/* calculate phi, kernel and image */
265
if (dim_i > 0 && dim_j > 0){
266
image[0] = (matrix_TYP **)calloc(dim_j, sizeof(matrix_TYP *));
267
/* some functions need the generating set for the image in the following form */
268
for (i = 0; i < dim_j; i++){
269
tmp = init_mat(H1_L->rows, 1, "");
270
for (j = 0; j < tmp->rows; j++)
271
tmp->array.SZ[j][0] = H1_L->array.SZ[j][i];
272
tmp->kgv = Xj[1]->array.SZ[i + first][i + first];
273
tmp->flags.Integral = 0;
274
Check_mat(tmp);
275
image[0][i] = standard_rep(tmp, GLS, Xi[1]);
276
free_mat(tmp);
277
for (j = 0; j < dim_i; j++){
278
phi[0]->array.SZ[j][i] = image[0][i]->array.SZ[j][0];
279
}
280
}
281
kernel_fkt(phi[0], Xj[1], first, Xi[1], kernel, H1_mod_ker);
282
image_gen_no[0] = dim_j;
283
H1_mod_ker[0].flag = 0;
284
}
285
else{
286
/* trivial part */
287
if (dim_i == 0){
288
kernel[0] = init_mat(dim_j, dim_j, "1");
289
}
290
else{
291
kernel[0] = init_mat(dim_j, 0, "");
292
}
293
image[0] = (matrix_TYP **)calloc(1, sizeof(matrix_TYP *));
294
image_gen_no[0] = 0;
295
if (dim_i == 0 && dim_j == 0)
296
H1_mod_ker[0].flag = 3;
297
else{
298
if (dim_i == 0)
299
H1_mod_ker[0].flag = 2;
300
else
301
H1_mod_ker[0].flag = 1;
302
}
303
}
304
305
/* clean */
306
free_mat(H1_L);
307
308
}
309
310
311
312
313
314