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