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

563690 views
1
#include"typedef.h"
2
#include"longtools.h"
3
#include"getput.h"
4
#include"bravais.h"
5
#include"matrix.h"
6
7
int INFO_LEVEL;
8
9
int main (int argc, char *argv[])
10
{
11
12
bravais_TYP *G,
13
*G_tr;
14
15
matrix_TYP *tmp,
16
*tmp2;
17
18
int i,
19
j,
20
prime=1949,
21
eps=100;
22
23
char comment[1000];
24
25
read_header(argc, argv);
26
if(FILEANZ < 1)
27
{
28
printf("Usage: %s 'file' [-i] [-f]\n",argv[0]);
29
printf("\n");
30
printf("file: bravais_TYP containing the finite unimodular group G.\n");
31
printf("\n");
32
printf("Calculates the elementatry divisors of the trace bifo\n");
33
printf("of the group G given in file, i.e. takes a Z-basis B (resp. B')\n");
34
printf("of the invariant forms of G (respectively G^tr), and\n");
35
printf("gives the Smith normal form of Trace(B_i * B'_j)_i,j.\n");
36
printf("\n");
37
printf("Options:\n");
38
printf("\n");
39
printf("-i : Use the function invar_space to calculate the space of invarinat forms.\n");
40
printf("-f : Force the formspace of G to be computed again, even if\n");
41
printf(" it is given.\n");
42
printf("\n");
43
44
if (is_option('h')){
45
exit(0);
46
}
47
else{
48
exit(31);
49
}
50
}
51
52
G = get_bravais(FILENAMES[0]);
53
G_tr = (bravais_TYP *) malloc(1 * sizeof(bravais_TYP));
54
G_tr->gen = (matrix_TYP **) malloc(G->gen_no*sizeof(matrix_TYP*));
55
56
for (i=0;i<G->gen_no;i++){
57
G_tr->gen[i] = tr_pose(G->gen[i]);
58
}
59
60
/* calculate the formspace if it's not known or the secure option -f is
61
given */
62
if ((G->form==NULL) || is_option('f')){
63
/* decide which way the user wants to formspace to be computed */
64
if (is_option('i')){
65
G->form = p_formspace(G->gen,G->gen_no,prime,1,&G->form_no);
66
G->form = invar_space(G->gen,G->gen_no,G->form_no,1,eps,&G->form_no);
67
}
68
else{
69
G->form = formspace(G->gen,G->gen_no,1,&G->form_no);
70
}
71
}
72
73
if (is_option('i')){
74
G_tr->form = invar_space(G_tr->gen,G->gen_no,G->form_no+1,1,eps,
75
&G_tr->form_no);
76
}
77
else{
78
G_tr->form = formspace(G_tr->gen,G->gen_no,1,&G_tr->form_no);
79
}
80
81
tmp = trace_bifo(G->form,G_tr->form,G->form_no);
82
83
tmp2 = long_elt_mat(NULL,tmp,NULL);
84
85
sprintf(comment,"elementary divisors of the trace_bifo for G in %s",
86
FILENAMES[0]);
87
put_mat(tmp2,NULL,comment,2);
88
89
free_mat(tmp);
90
free_mat(tmp2);
91
free_bravais(G);
92
93
94
exit(0);
95
}
96
97