GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include"typedef.h"1#include"longtools.h"2#include"getput.h"3#include"bravais.h"4#include"matrix.h"56int INFO_LEVEL;78int main (int argc, char *argv[])9{1011bravais_TYP *G,12*G_tr;1314matrix_TYP *tmp,15*tmp2;1617int i,18j,19prime=1949,20eps=100;2122char comment[1000];2324read_header(argc, argv);25if(FILEANZ < 1)26{27printf("Usage: %s 'file' [-i] [-f]\n",argv[0]);28printf("\n");29printf("file: bravais_TYP containing the finite unimodular group G.\n");30printf("\n");31printf("Calculates the elementatry divisors of the trace bifo\n");32printf("of the group G given in file, i.e. takes a Z-basis B (resp. B')\n");33printf("of the invariant forms of G (respectively G^tr), and\n");34printf("gives the Smith normal form of Trace(B_i * B'_j)_i,j.\n");35printf("\n");36printf("Options:\n");37printf("\n");38printf("-i : Use the function invar_space to calculate the space of invarinat forms.\n");39printf("-f : Force the formspace of G to be computed again, even if\n");40printf(" it is given.\n");41printf("\n");4243if (is_option('h')){44exit(0);45}46else{47exit(31);48}49}5051G = get_bravais(FILENAMES[0]);52G_tr = (bravais_TYP *) malloc(1 * sizeof(bravais_TYP));53G_tr->gen = (matrix_TYP **) malloc(G->gen_no*sizeof(matrix_TYP*));5455for (i=0;i<G->gen_no;i++){56G_tr->gen[i] = tr_pose(G->gen[i]);57}5859/* calculate the formspace if it's not known or the secure option -f is60given */61if ((G->form==NULL) || is_option('f')){62/* decide which way the user wants to formspace to be computed */63if (is_option('i')){64G->form = p_formspace(G->gen,G->gen_no,prime,1,&G->form_no);65G->form = invar_space(G->gen,G->gen_no,G->form_no,1,eps,&G->form_no);66}67else{68G->form = formspace(G->gen,G->gen_no,1,&G->form_no);69}70}7172if (is_option('i')){73G_tr->form = invar_space(G_tr->gen,G->gen_no,G->form_no+1,1,eps,74&G_tr->form_no);75}76else{77G_tr->form = formspace(G_tr->gen,G->gen_no,1,&G_tr->form_no);78}7980tmp = trace_bifo(G->form,G_tr->form,G->form_no);8182tmp2 = long_elt_mat(NULL,tmp,NULL);8384sprintf(comment,"elementary divisors of the trace_bifo for G in %s",85FILENAMES[0]);86put_mat(tmp2,NULL,comment,2);8788free_mat(tmp);89free_mat(tmp2);90free_bravais(G);919293exit(0);94}959697