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

563665 views
1
#include "typedef.h"
2
#include "voronoi.h"
3
#include "matrix.h"
4
#include "bravais.h"
5
#include "polyeder.h"
6
#include "tools.h"
7
#include "getput.h"
8
#include "bravais.h"
9
#include "datei.h"
10
11
/**************************************************************************\
12
@---------------------------------------------------------------------------
13
@---------------------------------------------------------------------------
14
@ FILE: init_voronoi.c
15
@---------------------------------------------------------------------------
16
@---------------------------------------------------------------------------
17
@
18
\**************************************************************************/
19
20
21
/**************************************************************************\
22
@---------------------------------------------------------------------------
23
@ voronoi_TYP *init_voronoi()
24
@
25
@ allocates storage for a pointer to voronoi_TYP and sets all intergers
26
@ and all pointers of it to 0 resp. NULL.
27
@---------------------------------------------------------------------------
28
@
29
\**************************************************************************/
30
voronoi_TYP *init_voronoi()
31
{
32
voronoi_TYP *V;
33
34
if( (V = (voronoi_TYP *)malloc(sizeof(voronoi_TYP))) == NULL)
35
{
36
printf("malloc of 'V' in 'init_voronoi' failed\n");
37
exit(2);
38
}
39
V->gram = NULL;
40
V->SV_no = 0;
41
V->min = 0;
42
V->pdet = 0;
43
V->prime = 0;
44
V->vert_no = 0;
45
V->vert = NULL;
46
V->pol = NULL;
47
V->red_inv = NULL;
48
V->T = NULL;
49
V->Ti = NULL;
50
V->Gtrred = NULL;
51
V->SVi = NULL;
52
V->stab = NULL;
53
V->linstab = NULL;
54
V->dir_reps = NULL;
55
56
return(V);
57
}
58
59
60
/**************************************************************************\
61
@---------------------------------------------------------------------------
62
@ void clear_voronoi(V)
63
@ voronoi_TYP *V;
64
@
65
@ frees all pointers that are allocated in the the voronoi_TYP *V
66
@ and sets them to NULL
67
@ All integers are set 0.
68
@---------------------------------------------------------------------------
69
@
70
\**************************************************************************/
71
void clear_voronoi(V)
72
voronoi_TYP *V;
73
{
74
int i;
75
76
if(V->gram != NULL)
77
free_mat(V->gram);
78
V->gram = NULL;
79
V->SV_no = 0;
80
V->min = 0;
81
V->pdet = 0;
82
V->prime = 0;
83
for(i=0;i<V->vert_no;i++)
84
free_wall(&V->vert[i]);
85
if(V->vert != NULL)
86
free(V->vert);
87
V->vert = NULL;
88
V->vert_no = 0;
89
if(V->pol != NULL)
90
{
91
free_polyeder(V->pol);
92
/* deleted 16/197 tilman
93
free(V->pol); */
94
V->pol = NULL;
95
}
96
V->pol = NULL;
97
if(V->red_inv != NULL)
98
free_mat(V->red_inv);
99
V->red_inv = NULL;
100
if(V->T != NULL)
101
free_mat(V->T);
102
V->T = NULL;
103
if(V->Ti != NULL)
104
free_mat(V->Ti);
105
V->Ti = NULL;
106
if(V->Gtrred != NULL)
107
{
108
free_bravais(V->Gtrred);
109
/* deleted 16/1/97 tilman
110
free(V->Gtrred); */
111
V->Gtrred = NULL;
112
}
113
V->Gtrred = NULL;
114
if(V->SVi != NULL)
115
free_mat(V->SVi);
116
V->SVi = NULL;
117
if(V->stab != NULL)
118
{
119
free_bravais(V->stab);
120
/* deleted 16/1/97 tilman
121
free(V->stab); */
122
V->stab = NULL;
123
}
124
V->stab = NULL;
125
if(V->linstab != NULL)
126
{
127
free_bravais(V->linstab);
128
/* deleted 16/1/97 tilman
129
free(V->linstab); */
130
V->linstab = NULL;
131
}
132
V->linstab = NULL;
133
if(V->dir_reps != NULL)
134
free_mat(V->dir_reps);
135
V->dir_reps = NULL;
136
137
}
138
139
140
141
/**************************************************************************\
142
@---------------------------------------------------------------------------
143
@ void put_voronoi(V)
144
@ voronoi_TYP *V;
145
@
146
@ Prints the informations in V to standard-output with comments
147
@---------------------------------------------------------------------------
148
@
149
\**************************************************************************/
150
void put_voronoi(V)
151
voronoi_TYP *V;
152
{
153
int i,j;
154
155
put_mat(V->gram, NULL, "matrix of perfect form", 2);
156
printf("%d %% number of shortest vectors\n", V->SV_no);
157
printf("%d %% minimum of perfect form\n", V->min);
158
printf("%d %d %% determinant modulo prime number\n", V->pdet, V->prime);
159
printf("%dx%d %% matrix of the Voronoi vertices\n", V->vert_no, V->vert[0]->dim);
160
for(i=0;i<V->vert_no;i++)
161
{
162
for(j=0;j<V->vert[i]->dim;j++)
163
printf("%d ", V->vert[i]->gl[j]);
164
printf("\n");
165
}
166
printf("%% Voronoi polyedral:\n");
167
put_polyeder(V->pol);
168
put_bravais(V->stab, NULL, "Stabilizer of perfect form");
169
put_bravais(V->linstab, NULL, "action of the stabilizer on the space of forms");
170
put_mat(V->dir_reps, NULL, "representatives of the Voronoi directions", 0);
171
}
172
173