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

563595 views
1
#include "typedef.h"
2
#include "matrix.h"
3
#include "getput.h"
4
#include "datei.h"
5
#include "orbit.h"
6
#include "longtools.h"
7
#include "sort.h"
8
#include "bravais.h"
9
/**************************************************************************\
10
@---------------------------------------------------------------------------
11
@---------------------------------------------------------------------------
12
@ FILE: gittstabneu.c
13
@---------------------------------------------------------------------------
14
@---------------------------------------------------------------------------
15
@
16
\**************************************************************************/
17
18
19
/**************************************************************************\
20
@---------------------------------------------------------------------------
21
@ bravais_TYP *gittstab(grp, X)
22
@ bravais_TYP *grp;
23
@ matrix_TYP *X;
24
@
25
@ gittstab calculates the stabilizer of a lattice X under the |
26
@ operation of the group 'grp' acting via left-multiplication |
27
@---------------------------------------------------------------------------
28
@
29
\**************************************************************************/
30
bravais_TYP *gittstabneu(grp, X)
31
bravais_TYP *grp;
32
matrix_TYP *X;
33
{
34
int i,
35
j,
36
search,
37
length,
38
options[6];
39
40
bravais_TYP *stab;
41
42
matrix_TYP **orbit,
43
*INV,
44
*Y;
45
46
/* make the options for orbit */
47
for (i=0;i<6;i++) options[i] = 0;
48
options[1] = 4;
49
options[3] = 1;
50
51
/* gauss reduce a copy of X */
52
Y = copy_mat(X);
53
long_col_hnf(Y);
54
55
/* reserve memory as asked for in orbit_alg */
56
stab = init_bravais(grp->dim);
57
58
orbit = orbit_alg(Y,grp,stab,options,&length);
59
60
/* throw away the orbit */
61
for (i=0;i<length;i++){
62
free_mat(orbit[i]);
63
}
64
free(orbit);
65
free_mat(Y);
66
67
/* try to reduce the number of generators */
68
/* firstly sort them */
69
mat_quicksort(stab->gen,0,stab->gen_no-1,mat_comp);
70
for (i=0;i<stab->gen_no-1;i++){
71
if (mat_comp(stab->gen[i],stab->gen[i+1]) == 0){
72
free_mat(stab->gen[i+1]);
73
stab->gen_no--;
74
for (j=i+1;j<stab->gen_no;j++){
75
stab->gen[j] = stab->gen[j+1];
76
}
77
i--;
78
}
79
}
80
81
/* second pass, use the inverses */
82
/* bare in mind that the generator list is sorted and does not have
83
duplicates */
84
for (i=0;i<stab->gen_no;i++){
85
INV = mat_inv(stab->gen[i]);
86
search = mat_search(INV,stab->gen,stab->gen_no,mat_comp);
87
free_mat(INV);
88
/* watch for elements of order 2 !!! */
89
if (search != -1 && search != i){
90
if (search<i){
91
fprintf(stderr,"Error in gittstabneu\n");
92
exit(3);
93
}
94
free_mat(stab->gen[search]);
95
stab->gen_no--;
96
for (j=search;j<stab->gen_no;j++){
97
stab->gen[j] = stab->gen[j+1];
98
}
99
}
100
}
101
102
/* reallocate the memory for stag->gen */
103
stab->gen = (matrix_TYP **) realloc(stab->gen,
104
sizeof(matrix_TYP *)*stab->gen_no);
105
106
/* calculate the order of the stabilizer (if possible) */
107
if (grp->order != 0){
108
stab->order = grp->order/length;
109
factorize_new(stab->order,stab->divisors);
110
}
111
else{
112
stab->order = 0;
113
for (i=0;i<100;i++) stab->divisors[i] = 0;
114
}
115
116
return(stab);
117
}
118
119