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

563516 views
1
#include"typedef.h"
2
#include"autgrp.h"
3
#include"getput.h"
4
#include"symm.h"
5
6
int SFLAG;
7
int INFO_LEVEL;
8
9
main (int argc, char *argv[])
10
{
11
12
matrix_TYP **F, **Erz, *SV;
13
int i, Fanz, Erzanz, options[6];
14
bravais_TYP *G;
15
FILE *infile;
16
int Fmax;
17
18
read_header(argc, argv);
19
20
if (is_option('h') && optionnumber('h')==12){
21
SFLAG = 1;
22
}
23
24
if(FILEANZ != 1)
25
{
26
printf("Usage: %s 'file' [-d=n] [-s=n] [-b] [-b=n] [-B=n] [-v] [-g] [-p]\n",argv[0]);
27
printf("\n");
28
printf("file: matrix_TYP containing a set of integral NxN-matrices, the first\n");
29
printf(" of which is symmetric and positive definite.\n");
30
printf("\n");
31
printf("Computes a generating set for the (finite) group of all g in GL_N(Z) with\n");
32
printf("g^Tr * F * g = F for all F in file.\n");
33
printf("NOTE: if all F are symmetric, this is a Bravais group, otherwise a\n");
34
printf(" generalised Bravais group (relevant for Bravais groups in families\n");
35
printf(" like 2-1',2-1' etc.).\n");
36
printf("\n");
37
printf("NOTE: CARAT was developed for crystallographic groups in dimensions\n");
38
printf(" up to 6. Most algorithms also work in higher dimensions.\n");
39
printf(" However, integer overflow is not trapped in general.\n");
40
printf("\n");
41
printf("Options:\n");
42
printf("-d=n : Depth up to which scalar products are calculated. The value\n");
43
printf(" should be small. Usefull if the automorphism group is expected\n");
44
printf(" to be small.\n");
45
printf("-s=n : The n-point stabilizer with respect to different basis will be\n");
46
printf(" calculated.\n");
47
printf("-b=n : Use Bacher polynomials up to depth n.\n");
48
printf("-B=n : Use Bacher polynomials with vectors having scalar product n\n");
49
printf("-v,-g : Read additional data from 'file'. If -v is given the program\n");
50
printf(" assumes that the short vectors of the first form in 'file'\n");
51
printf(" are given below the forms.\n");
52
printf(" If -g is given, the program assumes known generators for\n");
53
printf(" the automorphism group to be given below any other information in\n");
54
printf(" 'file'.\n");
55
printf("-p : Write additional output to the file AUTO.tmp\n");
56
printf("\n");
57
printf("Cf. Short, Shortest\n");
58
if (is_option('h')){
59
exit(0);
60
}
61
else{
62
exit(31);
63
}
64
}
65
/*------------------------------------------------------------*\
66
| Open input file
67
\*------------------------------------------------------------*/
68
if ( (infile = fopen (FILENAMES[0], "r")) == NULL )
69
{
70
fprintf (stderr, "Could not open input-file %s\n", FILENAMES[0]);
71
exit (4);
72
}
73
/*------------------------------------------------------------*\
74
| Read the input
75
\*------------------------------------------------------------*/
76
F = fmget_mat(infile, &Fanz);
77
if(is_option('v') == TRUE)
78
SV = fget_mat(infile);
79
else
80
{
81
Fmax = F[0]->array.SZ[0][0];
82
for(i=1;i<F[0]->cols;i++)
83
{
84
if(F[0]->array.SZ[i][i] > Fmax)
85
Fmax = F[0]->array.SZ[i][i];
86
}
87
SV = short_vectors(F[0], Fmax, 0, 0, 0, &i);
88
}
89
if(is_option('g') == TRUE)
90
Erz = fmget_mat(infile, &Erzanz);
91
else
92
{ Erz = NULL, Erzanz = 0;}
93
/*------------------------------------------------------------*\
94
| Close input file
95
\*------------------------------------------------------------*/
96
if ( infile != stdin )
97
fclose (infile);
98
99
/*------------------------------------------------------------*\
100
| Read the options
101
\*------------------------------------------------------------*/
102
103
/*-------------------------------------------------------------------*\
104
| options is a pointer to integer (of length 6)
105
| The possible options are encoded in the following way:
106
| options[0]: The depth, up to wich scalar product combinations
107
| shall be calculated. The value should be small.
108
| options[0] > 0 should be used only, if the automorphismn
109
| group is expected to be small (with respect to the number
110
| of shortest vectors).
111
| options[1]: The n-point stabiliser with respect to different basis
112
| will be calculated.
113
| options[2]: If options[2] = 1, additional output is written to the
114
| file AUTO.tmp
115
| options[3]: If options[3] = 1, Bacher polynomials are used.
116
| If options[3] = 2, Bacher polynomial are used up to a depth
117
| specified in options[4].
118
| If options[3] = 3, Bacher polynomials are used, using
119
| combinations of vectors having the scalar
120
| product specified in options[5]
121
| options[3] = 4 is the combination of options[3] = 2 and
122
| options[3] = 3.
123
| options[4]: A natural number number or zero (if options[3] = 2 or 4)
124
| options[5]: An integral number (if options[3] = 3 or 4)
125
|
126
| It is possible to use NULL for options,
127
| in this case option is assumed to be [0,0,0,0,0,0]
128
\*************************************************************************/
129
130
for(i=0;i<6;i++)
131
options[i] = 0;
132
if(is_option('d') == TRUE)
133
options[0] = optionnumber('d');
134
if(is_option('s') == TRUE)
135
options[1] = optionnumber('s');
136
if(is_option('p'))
137
options[2] = 1;
138
if(is_option('B') || is_option('b'))
139
options[3] = TRUE;
140
if(optionnumber('b') > 0)
141
{
142
options[4] = optionnumber('b');
143
options[3] = 2;
144
}
145
if(optionnumber('B') != 0)
146
{
147
options[5] = optionnumber('B');
148
options[3] = 3;
149
}
150
if(optionnumber('B') != 0 && optionnumber('b') > 0)
151
options[3] = 4;
152
153
154
G = autgrp(F, Fanz, SV, Erz, Erzanz, options);
155
156
put_bravais(G, NULL, "");
157
158
159
free_bravais(G);
160
free_mat(SV);
161
for (i=0;i<Fanz;i++) free_mat(F[i]);
162
free(F);
163
for (i=0;i<Erzanz;i++) free_mat(Erz[i]);
164
if (Erzanz != 0) free(Erz);
165
166
if (is_option('h') && optionnumber('h')==12){
167
pointer_statistics(0,0);
168
}
169
}
170
171