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

563640 views
1
/* last change: 13.02.2001 by Oliver Heidbuechel */
2
3
4
#include <typedef.h>
5
#include <presentation.h>
6
#include <matrix.h>
7
#include <bravais.h>
8
#include <base.h>
9
#include <datei.h>
10
#include <graph.h>
11
#include <gmp.h>
12
#include <zass.h>
13
#include <longtools.h>
14
15
16
17
/* -------------------------------------------------------------------------- */
18
/* Test if S is a proper k-subgroup of R */
19
/* T(R) = Z^n */
20
/* P = P(R) has to be P(S) (generators don't have to be equal) */
21
/* (generating set without Id's from translations of the space group) */
22
/* n: the last n matrices generate the translationlattice of S */
23
/* (we need this, if the presentation includes no information for this */
24
/* matrices) */
25
/* pres: presentation of P(R) */
26
/* -------------------------------------------------------------------------- */
27
boolean is_k_subgroup(bravais_TYP *S,
28
bravais_TYP *R,
29
bravais_TYP *P,
30
int n,
31
matrix_TYP *pres)
32
{
33
matrix_TYP *coz_s_neu, *coz_r, *diff, **INV, *ID, **Id, *T;
34
35
rational eins, minuseins;
36
37
int i, j, k, d = S->gen[0]->rows - 1;
38
39
word *relator;
40
41
boolean FLAG = TRUE;
42
43
bravais_TYP *S_neu;
44
45
46
47
48
/* sublattice check for the last n generators */
49
for (i = 1; i <= n; i++){
50
Check_mat(S->gen[S->gen_no - i]);
51
if (S->gen[S->gen_no - i]->kgv != 1)
52
return(FALSE);
53
}
54
55
/* compare cocycles */
56
coz_s_neu = sg(S, P);
57
S_neu = extract_r(P, coz_s_neu);
58
eins.z = eins.n = minuseins.n = 1; minuseins.z = -1;
59
coz_r = extract_c(R);
60
diff = mat_add(coz_s_neu, coz_r, eins, minuseins);
61
Check_mat(diff);
62
if (diff->kgv != 1){
63
free_mat(coz_r);
64
free_mat(coz_s_neu);
65
free_mat(diff);
66
free_bravais(S_neu);
67
return(FALSE);
68
}
69
free_mat(diff);
70
free_mat(coz_r);
71
free_mat(coz_s_neu);
72
73
/* compare translation lattices */
74
INV = (matrix_TYP **)calloc(S_neu->gen_no, sizeof(matrix_TYP *));
75
Id = (matrix_TYP **)calloc(pres->rows, sizeof(matrix_TYP *));
76
relator = (word *)calloc(pres->rows, sizeof(word));
77
for (i = 0; i < pres->rows; i++){
78
matrix_2_word(pres, relator + i, i);
79
}
80
for (i = 0; i < pres->rows; i++){
81
Id[i] = matrizen_in_word(S_neu->gen, INV, relator[i]);
82
}
83
T = init_mat(d, n + pres->rows, "");
84
for (i = 0; i < n; i++){
85
for (j = 0; j < d; j++)
86
T->array.SZ[j][i] = S->gen[S->gen_no - 1 - i]->array.SZ[j][d];
87
}
88
for (i = 0; i < pres->rows && FLAG; i++){
89
if (Id[i]->kgv != 1)
90
FLAG = FALSE;
91
for (j = 0; j < d && FLAG; j++){ /* rows */
92
for (k = 0; k < d && FLAG; k++){ /* colums */
93
if (j == k){
94
if (Id[i]->array.SZ[j][k] != 1)
95
FLAG = FALSE;
96
}
97
else{
98
if (Id[i]->array.SZ[j][k] != 0)
99
FLAG = FALSE;
100
}
101
}
102
}
103
for (j = 0; j < d && FLAG; j++){ /* last column */
104
T->array.SZ[j][i + n] = Id[i]->array.SZ[j][d];
105
}
106
}
107
ID = init_mat(d, d, "1");
108
if (FLAG == TRUE){
109
long_col_hnf(T);
110
real_mat(T, T->rows, T->rows);
111
112
if (cmp_mat(T, ID) != 0)
113
FLAG = TRUE;
114
else
115
FLAG = FALSE;
116
}
117
118
/* clean */
119
free_mat(ID);
120
free_mat(T);
121
for (i = 0; i < S_neu->gen_no; i++){
122
if (INV[i] != NULL)
123
free_mat(INV[i]);
124
}
125
free(INV);
126
free_bravais(S_neu);
127
for (i = 0; i < pres->rows; i++)
128
free_mat(Id[i]);
129
free(Id);
130
for (i = 0; i < pres->rows; i++)
131
wordfree(relator + i);
132
free(relator);
133
134
return(FLAG);
135
}
136
137