CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
1
#include <typedef.h>
2
#include <getput.h>
3
#include <matrix.h>
4
#include <base.h>
5
6
#include <gmp.h>
7
8
int INFO_LEVEL;
9
extern int SFLAG;
10
11
12
main(int argc,char **argv){
13
14
bravais_TYP *G;
15
16
matrix_TYP **base,
17
**K;
18
19
MP_INT Order;
20
21
int i,
22
j,
23
l,
24
siz,
25
anz,
26
factors[100],
27
order;
28
29
char comment[1000];
30
31
32
read_header(argc,argv);
33
34
if ((is_option('h') && optionnumber('h')==0) || (FILEANZ < 1)){
35
printf("Usage: %s 'file1' [-M] [-N]\n",argv[0]);
36
printf("\n");
37
printf("file1: bravais_TYP.\n");
38
printf("\n");
39
printf("Decides whether the given INTEGRAL matrix group is finite.\n");
40
printf("If it is so, it will echo the order of the group.\n");
41
printf("\n");
42
printf("Options:\n");
43
printf(" -M : Output generators for the Minkowski kernel (i.e the \n");
44
printf(" subgroup of all matrices congruent I mod 2) of\n");
45
printf(" the group. WARNING: these generators will be\n");
46
printf(" correct iff the group was finite. Otherwise\n");
47
printf(" the program terminates immediatly if it has calculated\n");
48
printf(" enough element of the kernel to prove the group to\n");
49
printf(" be infinite.\n");
50
printf(" -N : Assume the group to be generated by G->gen,G->normal\n");
51
printf(" and G->cen.\n");
52
printf(" -o : just output the order in a way that can be appended to\n");
53
printf(" a bravais_TYP.\n");
54
printf("\n");
55
printf("Cf. Order.\n");
56
if (is_option('h')){
57
exit(0);
58
}
59
else{
60
exit(31);
61
}
62
}
63
64
INFO_LEVEL = optionnumber('h');
65
66
if (INFO_LEVEL & 12){
67
SFLAG = 1;
68
}
69
70
G = get_bravais(FILENAMES[0]);
71
72
base = get_base(G);
73
74
mpz_init_set_si(&Order,0);
75
76
if (is_option('N')){
77
G->gen = (matrix_TYP **) realloc(G->gen,(G->gen_no+G->cen_no+G->normal_no)
78
*sizeof(matrix_TYP*));
79
for (i=0;i<G->cen_no;i++)
80
G->gen[i+G->gen_no] = G->cen[i];
81
82
for (i=0;i<G->normal_no;i++)
83
G->gen[i+G->gen_no+G->cen_no] = G->normal[i];
84
85
G->gen_no += (G->cen_no + G->normal_no);
86
87
if (G->cen != NULL && G->cen_no > 0) free(G->cen);
88
if (G->normal != NULL && G->normal_no > 0) free(G->normal);
89
G->cen_no = 0;
90
G->normal_no = 0;
91
G->cen = NULL;
92
G->normal = NULL;
93
}
94
95
siz = strong_generators_2(base,G,&K,&anz,&Order);
96
97
if (siz != FALSE){
98
if (is_option('o')){
99
order = mpz_get_si(&Order);
100
factorize_new(order,factors);
101
fput_order(stdout,factors,order);
102
}
103
104
fprintf(stderr,"The order of the group is: ");
105
mpz_out_str(stderr,10,&Order);
106
fprintf(stderr,"\n");
107
}
108
else{
109
fprintf(stderr,"The group infinite!\n");
110
}
111
112
if (is_option('M')){
113
printf("#%d\n",anz);
114
for (i=0;i<anz;i++){
115
sprintf(comment,"%dth-generator for the kernel of the Minkowski hom",
116
i+1);
117
put_mat(K[i],NULL,comment,2);
118
}
119
}
120
121
mpz_clear(&Order);
122
for (i=0;i<anz;i++) free_mat(K[i]);
123
free(K);
124
for (i=0;i<G->dim;i++) free_mat(base[i]);
125
free_bravais(G);
126
free(base);
127
128
if (INFO_LEVEL & 12){
129
pointer_statistics(0,0);
130
}
131
exit(0);
132
133
} /* main */
134
135