GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include "typedef.h"1#include "voronoi.h"2#include "matrix.h"3#include "bravais.h"4#include "polyeder.h"5#include "tools.h"6#include "getput.h"7#include "bravais.h"8#include "datei.h"910/**************************************************************************\11@---------------------------------------------------------------------------12@---------------------------------------------------------------------------13@ FILE: init_voronoi.c14@---------------------------------------------------------------------------15@---------------------------------------------------------------------------16@17\**************************************************************************/181920/**************************************************************************\21@---------------------------------------------------------------------------22@ voronoi_TYP *init_voronoi()23@24@ allocates storage for a pointer to voronoi_TYP and sets all intergers25@ and all pointers of it to 0 resp. NULL.26@---------------------------------------------------------------------------27@28\**************************************************************************/29voronoi_TYP *init_voronoi()30{31voronoi_TYP *V;3233if( (V = (voronoi_TYP *)malloc(sizeof(voronoi_TYP))) == NULL)34{35printf("malloc of 'V' in 'init_voronoi' failed\n");36exit(2);37}38V->gram = NULL;39V->SV_no = 0;40V->min = 0;41V->pdet = 0;42V->prime = 0;43V->vert_no = 0;44V->vert = NULL;45V->pol = NULL;46V->red_inv = NULL;47V->T = NULL;48V->Ti = NULL;49V->Gtrred = NULL;50V->SVi = NULL;51V->stab = NULL;52V->linstab = NULL;53V->dir_reps = NULL;5455return(V);56}575859/**************************************************************************\60@---------------------------------------------------------------------------61@ void clear_voronoi(V)62@ voronoi_TYP *V;63@64@ frees all pointers that are allocated in the the voronoi_TYP *V65@ and sets them to NULL66@ All integers are set 0.67@---------------------------------------------------------------------------68@69\**************************************************************************/70void clear_voronoi(V)71voronoi_TYP *V;72{73int i;7475if(V->gram != NULL)76free_mat(V->gram);77V->gram = NULL;78V->SV_no = 0;79V->min = 0;80V->pdet = 0;81V->prime = 0;82for(i=0;i<V->vert_no;i++)83free_wall(&V->vert[i]);84if(V->vert != NULL)85free(V->vert);86V->vert = NULL;87V->vert_no = 0;88if(V->pol != NULL)89{90free_polyeder(V->pol);91/* deleted 16/197 tilman92free(V->pol); */93V->pol = NULL;94}95V->pol = NULL;96if(V->red_inv != NULL)97free_mat(V->red_inv);98V->red_inv = NULL;99if(V->T != NULL)100free_mat(V->T);101V->T = NULL;102if(V->Ti != NULL)103free_mat(V->Ti);104V->Ti = NULL;105if(V->Gtrred != NULL)106{107free_bravais(V->Gtrred);108/* deleted 16/1/97 tilman109free(V->Gtrred); */110V->Gtrred = NULL;111}112V->Gtrred = NULL;113if(V->SVi != NULL)114free_mat(V->SVi);115V->SVi = NULL;116if(V->stab != NULL)117{118free_bravais(V->stab);119/* deleted 16/1/97 tilman120free(V->stab); */121V->stab = NULL;122}123V->stab = NULL;124if(V->linstab != NULL)125{126free_bravais(V->linstab);127/* deleted 16/1/97 tilman128free(V->linstab); */129V->linstab = NULL;130}131V->linstab = NULL;132if(V->dir_reps != NULL)133free_mat(V->dir_reps);134V->dir_reps = NULL;135136}137138139140/**************************************************************************\141@---------------------------------------------------------------------------142@ void put_voronoi(V)143@ voronoi_TYP *V;144@145@ Prints the informations in V to standard-output with comments146@---------------------------------------------------------------------------147@148\**************************************************************************/149void put_voronoi(V)150voronoi_TYP *V;151{152int i,j;153154put_mat(V->gram, NULL, "matrix of perfect form", 2);155printf("%d %% number of shortest vectors\n", V->SV_no);156printf("%d %% minimum of perfect form\n", V->min);157printf("%d %d %% determinant modulo prime number\n", V->pdet, V->prime);158printf("%dx%d %% matrix of the Voronoi vertices\n", V->vert_no, V->vert[0]->dim);159for(i=0;i<V->vert_no;i++)160{161for(j=0;j<V->vert[i]->dim;j++)162printf("%d ", V->vert[i]->gl[j]);163printf("\n");164}165printf("%% Voronoi polyedral:\n");166put_polyeder(V->pol);167put_bravais(V->stab, NULL, "Stabilizer of perfect form");168put_bravais(V->linstab, NULL, "action of the stabilizer on the space of forms");169put_mat(V->dir_reps, NULL, "representatives of the Voronoi directions", 0);170}171172173