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
3
4
main (int argc, char *argv[])
5
{
6
7
matrix_TYP **Mat;
8
matrix_TYP **F, *V;
9
bravais_TYP *G;
10
int i, d, Fanz, anz;
11
12
extern char **FILENAMES;
13
extern int FILEANZ;
14
15
extern matrix_TYP **mget_mat();
16
extern bravais_TYP *get_bravais();
17
extern matrix_TYP *init_mat();
18
extern void put_mat ();
19
extern void form_to_vec();
20
21
read_header(argc, argv);
22
if(FILEANZ != 2 || (is_option('h') && optionnumber('h') == 0))
23
{
24
printf("Usage: %s 'file1' 'file2' [-m] [-d]\n",argv[0]);
25
printf("\n");
26
printf(" file1: matrix_TYP\n");
27
printf(" file2: matrix_TYP or bravais_TYP.\n");
28
printf("\n");
29
printf("For each matrix A in file1 a vector V is calculated\n");
30
printf("with the following property:\n");
31
printf(" A = 1/V[NO+1] * (V[1] * F_1 + V[2] * F_2 +...+ V[NO] * F_NO),\n");
32
printf("Where is F_i are the matrices in file2 if file2 is a\n");
33
printf("matrix_TYP, otherwise are the matrices describing the\n");
34
printf("form space of the bravais group in file2.\n");
35
printf("CAUTION: if not used with the option -d, the denominator\n");
36
printf(" is not printed, so you will get a vector with\n");
37
printf(" only NO columns.\n");
38
printf("\n");
39
printf("Options:\n");
40
printf(" -m: Use a modular (but exact) method to calculate \n");
41
printf(" the result. The result is calculated for a couple\n");
42
printf(" of big primes and fitted together with the chinese\n");
43
printf(" remainder theorem.\n");
44
printf(" This method is much faster and avoids trouble with\n");
45
printf(" overflow, BUT IS ABLE TO HANDLE THE CASE V[NO+1] == 1\n");
46
printf(" ONLY (AND WILL RUN INTO AN INFINITE LOOP OTHERWISE).\n");
47
printf(" -d: give the denominator in the NO+1-th colunm.\n");
48
printf("\n");
49
printf("\n");
50
if (is_option('h')){
51
exit(0);
52
}
53
else{
54
exit(31);
55
}
56
}
57
Mat = mget_mat (FILENAMES[0], &anz);
58
G = get_bravais(FILENAMES[1]);
59
if(G->form_no > 0)
60
{ F = G->form; Fanz = G->form_no;}
61
else
62
{ F = G->gen; Fanz = G->gen_no;}
63
V = init_mat(anz, Fanz+1, "");
64
if(is_option('m') == TRUE)
65
{
66
for(i=0;i<anz;i++)
67
form_to_vec_modular(V->array.SZ[i], Mat[i], F, Fanz);
68
V->cols--;
69
}
70
else
71
{
72
for(i=0;i<anz;i++)
73
{
74
form_to_vec(V->array.SZ[i], Mat[i], F, Fanz, &d);
75
V->array.SZ[i][Fanz] = d;
76
}
77
if(is_option('d'))
78
V->cols = Fanz+1;
79
else
80
V->cols = Fanz;
81
}
82
put_mat(V, NULL, "matrices written as linear combination", 0);
83
84
85
exit(0);
86
}
87
88