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

563642 views
1
#include "typedef.h"
2
#include "matrix.h"
3
#include "orbit.h"
4
#include "symm.h"
5
#include "tools.h"
6
7
/**************************************************************************\
8
@---------------------------------------------------------------------------
9
@---------------------------------------------------------------------------
10
@ FILE: vor_vertices.c
11
@---------------------------------------------------------------------------
12
@---------------------------------------------------------------------------
13
@
14
\**************************************************************************/
15
16
17
18
/**************************************************************************\
19
@---------------------------------------------------------------------------
20
@ matrix_TYP **voronoi_vertices(form, grp, anz, form_min, SV_no)
21
@ matrix_TYP *form;
22
@ bravais_TYP *grp;
23
@ int *anz, *form_min, *SV_no;
24
@
25
@ calculates the voronoi_vertices, i.e. the matrices in the space of
26
@ symmetric matrices, that are invariant under the action of G^{tr},
27
@ where the voronoi vertices are defined by the sum over all g in the
28
@ group 'grp' of
29
@ g x^{tr}x g,
30
@ where x is a shortest vector of 'form'.
31
@
32
@ The number of these vertices is returned via (int *anz)
33
@ the number of shortest vectors of 'form' via (int *SV_no) and
34
@ the minimum of 'form' via (int *form_min)
35
@---------------------------------------------------------------------------
36
@
37
\**************************************************************************/
38
matrix_TYP **voronoi_vertices(form, grp, anz, form_min, SV_no)
39
matrix_TYP *form;
40
bravais_TYP *grp;
41
int *anz, *form_min, *SV_no;
42
{
43
int min_norm, orbit_anz;
44
int *subdiv, *svi;
45
matrix_TYP *SV, **vf;
46
int i,j,k,l, n;
47
48
n = form->cols;
49
SV = shortest(form, &min_norm);
50
*SV_no = SV->rows;
51
*form_min = min_norm;
52
subdiv = orbit_subdivision(SV, grp, &orbit_anz);
53
if((vf = (matrix_TYP **)malloc(orbit_anz *sizeof(matrix_TYP *))) == NULL)
54
{
55
printf("malloc failed\n");
56
exit(2);
57
}
58
for(i=0;i<orbit_anz;i++)
59
{
60
vf[i] = init_mat(n, n, "");
61
vf[i]->flags.Symmetric = TRUE;
62
}
63
for(i=0;i<SV->rows;i++)
64
{
65
svi = SV->array.SZ[i];
66
j = subdiv[i]-1;
67
for(k=0;k<n;k++)
68
for(l=0;l<=k;l++)
69
{
70
vf[j]->array.SZ[k][l] += (svi[k] * svi[l]);
71
if(k!= l)
72
vf[j]->array.SZ[l][k] = vf[j]->array.SZ[k][l];
73
}
74
}
75
for(i=0;i<orbit_anz;i++)
76
{
77
l = 0;
78
for(j=0;j<n && l != 1;j++)
79
for(k=0;k<=j && l != 1 ;k++)
80
{
81
if(vf[i]->array.SZ[j][k] != 0)
82
{
83
if(l == 0)
84
l = vf[i]->array.SZ[j][k];
85
else
86
l = GGT(l, vf[i]->array.SZ[j][k]);
87
if(l<0)
88
l = -l;
89
}
90
}
91
if(l != 1)
92
{
93
for(j=0;j<n;j++)
94
for(k=0;k<=j;k++)
95
{
96
vf[i]->array.SZ[j][k] /= l;
97
vf[i]->array.SZ[k][j] = vf[i]->array.SZ[j][k];
98
}
99
}
100
}
101
free(subdiv);
102
free_mat(SV);
103
*anz = orbit_anz;
104
return(vf);
105
}
106
107