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 "longtools.h"3#include "symm.h"4#include "bravais.h"5#include "autgrp.h"6#include "polyeder.h"7#include "matrix.h"8#include "reduction.h"9#include "orbit.h"10#include "tools.h"11/**************************************************************************\12@---------------------------------------------------------------------------13@---------------------------------------------------------------------------14@ FILE: normalizer.c15@---------------------------------------------------------------------------16@---------------------------------------------------------------------------17@18\**************************************************************************/1920static matrix_TYP *search_normal_isometry(Vneu, V, Vanz, G, Gtr, bifo, no)21voronoi_TYP *Vneu, **V;22bravais_TYP *G, *Gtr;23matrix_TYP *bifo;24int Vanz, *no;25{26int i;27int found;28matrix_TYP *X;2930found = FALSE;31*no = -1;32for(i=0;i<Vanz && found == FALSE;i++)33{34X = calc_voronoi_isometry(V[i], Vneu, G, Gtr, bifo);35if(X != NULL)36{37found = TRUE;38*no = i;39}40}41if(found == TRUE)42{43i = *no;44}45return(X);46}474849/**************************************************************************\50@---------------------------------------------------------------------------51@ voronoi_TYP **normalizer(P, G, Gtr, prime, V_no)52@ matrix_TYP *P;53@ bravais_TYP *G, *Gtr;54@ int prime, *V_no;55@56@ The arguments of normalizer are57@ P: A G-perfect form (can be calculated with 'first_perfect')58@ G: A group given as 'bravais_TYP*' where 'G->form' must contain a59@ Z-Basis of the integral G-invariant matrices.60@ Gtr: The group G^{tr} given as 'bravais_TYP', also61@ with a Z-basis in 'G->form'62@ prime: a prime number (used to calculate determinates modulo p63@ for a simple criterion of two symmetric matrices been64@ not isometric.65@ V_no: via this pointer the number of returned 'voronoi_TYP'66@ is returned.67@68@ 'normalizer' calculates representatives of the G-perfect forms.69@ The are returned in a list 'voronoi_TYP**'70@ Furthermore generators of the integral normalizer of G are calculated71@ and written to G->normal. Their number is G->normal_no.72@73@---------------------------------------------------------------------------74@75\**************************************************************************/76voronoi_TYP **normalizer(P, G, Gtr, prime, V_no)77matrix_TYP *P;78bravais_TYP *G, *Gtr;79int prime, *V_no;80{81int i,j,k,l;82int dim, fdim;83voronoi_TYP **V;84voronoi_TYP *Vneu;85matrix_TYP *Dir, **N, *X, *bifo;86int Vanz, Nanz, diranz, no;87int lc, rc;8889dim = G->dim;90fdim = G->form_no;91if( (V = (voronoi_TYP **)malloc(1 *sizeof(voronoi_TYP *))) == NULL)92{93printf("malloc of 'V' in 'normalizer' failed\n");94exit(2);95}96V[0] = init_voronoi();97V[0]->gram = copy_mat(P);98Check_mat(V[0]->gram);99bifo = trace_bifo(G->form, Gtr->form, fdim);100calc_voronoi_complete(V[0], G, Gtr, bifo, prime);101Nanz = V[0]->stab->gen_no;102if( (N = (matrix_TYP **)malloc(Nanz *sizeof(matrix_TYP *))) == NULL)103{104printf("malloc of 'N' in 'normalizer' failed\n");105exit(2);106}107for(i=0;i<Nanz;i++)108N[i] = copy_mat(V[0]->stab->gen[i]);109Vanz = 1;110Vneu = init_voronoi();111for(i=0;i<Vanz;i++)112{113diranz = V[i]->dir_reps->cols;114real_mat(V[i]->dir_reps, 3, diranz);115116/* geaendert testweise am 06.11.96 tilman */117for(j=0;j<diranz;j++)118{119/***************************************************************\120| Calculate 'Vneu', the neighbour of V[i] in direction j121\***************************************************************/122Dir = vec_to_form(V[i]->pol->vert[V[i]->dir_reps->array.SZ[0][j]]->v,123G->form, fdim);124Vneu->gram = voronoi_neighbour(V[i]->gram, Dir, V[i]->min, &lc, &rc);125free_mat(Dir);126127/* changed: tilman 07/11/96 */128/* voronoi_neighbour returns NULL sometimes, and this causes129chrashes in calc_voronoi_basics */130if (Vneu->gram != NULL){131divide_by_gcd(Vneu->gram);132calc_voronoi_basics(Vneu, G, Gtr, prime);133/***************************************************************\134| Check if 'Vneu' is a new typ of perfect form or not135| if 'Vneu' is new, 'no = -1' and 'X = NULL'136| if not, 'X' is an isometry in the integral normalizer of 'G'137| and 'Vneu' is isometric to V[no].138\***************************************************************/139X = search_normal_isometry(Vneu, V, Vanz, G, Gtr, bifo, &no);140if(no == -1)141{142V[i]->dir_reps->array.SZ[2][j] = Vanz;143calc_voronoi_complete(Vneu, G, Gtr, bifo, prime);144145l = Vneu->stab->gen_no;146Nanz += l;147if((N =(matrix_TYP **)realloc(N,Nanz *sizeof(matrix_TYP *)))148== NULL)149{150printf("realloc of 'N' in 'normalizer' failed\n");151exit(2);152}153for(k=0;k<l; k++)154N[Nanz-l+k] = copy_mat(Vneu->stab->gen[k]);155156Vanz++;157if((V=(voronoi_TYP **)realloc(V,Vanz *sizeof(voronoi_TYP *)))158== NULL)159{160printf("realloc of 'V' in 'normalizer' failed\n");161exit(2);162}163V[Vanz-1] = Vneu;164Vneu = init_voronoi();165}166else167{168V[i]->dir_reps->array.SZ[2][j] = no;169Nanz ++;170if((N=(matrix_TYP **)realloc(N,Nanz *sizeof(matrix_TYP *)))171== NULL)172{173printf("realloc of 'N' in 'normalizer' failed\n");174exit(2);175}176N[Nanz-1] = X;177clear_voronoi(Vneu);178}179}180}181}182*V_no = Vanz;183if(G->normal_no != 0)184{185for(i=0;i<G->normal_no;i++)186free_mat(G->normal[i]);187free(G->normal);188}189G->normal = N;190G->normal_no = Nanz;191free_mat(bifo);192if (Vneu != NULL){193clear_voronoi(Vneu);194free(Vneu);195Vneu = NULL;196}197198/* inserted tilman 20.06.97 to reduce the number of generators for199the normalizer */200red_normal(G);201202return(V);203}204205206