GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include"typedef.h"1#include"autgrp.h"2#include"getput.h"3#include"symm.h"45int SFLAG;6int INFO_LEVEL;78main (int argc, char *argv[])9{1011matrix_TYP **F, **Erz, *SV;12int i, Fanz, Erzanz, options[6];13bravais_TYP *G;14FILE *infile;15int Fmax;1617read_header(argc, argv);1819if (is_option('h') && optionnumber('h')==12){20SFLAG = 1;21}2223if(FILEANZ != 1)24{25printf("Usage: %s 'file' [-d=n] [-s=n] [-b] [-b=n] [-B=n] [-v] [-g] [-p]\n",argv[0]);26printf("\n");27printf("file: matrix_TYP containing a set of integral NxN-matrices, the first\n");28printf(" of which is symmetric and positive definite.\n");29printf("\n");30printf("Computes a generating set for the (finite) group of all g in GL_N(Z) with\n");31printf("g^Tr * F * g = F for all F in file.\n");32printf("NOTE: if all F are symmetric, this is a Bravais group, otherwise a\n");33printf(" generalised Bravais group (relevant for Bravais groups in families\n");34printf(" like 2-1',2-1' etc.).\n");35printf("\n");36printf("NOTE: CARAT was developed for crystallographic groups in dimensions\n");37printf(" up to 6. Most algorithms also work in higher dimensions.\n");38printf(" However, integer overflow is not trapped in general.\n");39printf("\n");40printf("Options:\n");41printf("-d=n : Depth up to which scalar products are calculated. The value\n");42printf(" should be small. Usefull if the automorphism group is expected\n");43printf(" to be small.\n");44printf("-s=n : The n-point stabilizer with respect to different basis will be\n");45printf(" calculated.\n");46printf("-b=n : Use Bacher polynomials up to depth n.\n");47printf("-B=n : Use Bacher polynomials with vectors having scalar product n\n");48printf("-v,-g : Read additional data from 'file'. If -v is given the program\n");49printf(" assumes that the short vectors of the first form in 'file'\n");50printf(" are given below the forms.\n");51printf(" If -g is given, the program assumes known generators for\n");52printf(" the automorphism group to be given below any other information in\n");53printf(" 'file'.\n");54printf("-p : Write additional output to the file AUTO.tmp\n");55printf("\n");56printf("Cf. Short, Shortest\n");57if (is_option('h')){58exit(0);59}60else{61exit(31);62}63}64/*------------------------------------------------------------*\65| Open input file66\*------------------------------------------------------------*/67if ( (infile = fopen (FILENAMES[0], "r")) == NULL )68{69fprintf (stderr, "Could not open input-file %s\n", FILENAMES[0]);70exit (4);71}72/*------------------------------------------------------------*\73| Read the input74\*------------------------------------------------------------*/75F = fmget_mat(infile, &Fanz);76if(is_option('v') == TRUE)77SV = fget_mat(infile);78else79{80Fmax = F[0]->array.SZ[0][0];81for(i=1;i<F[0]->cols;i++)82{83if(F[0]->array.SZ[i][i] > Fmax)84Fmax = F[0]->array.SZ[i][i];85}86SV = short_vectors(F[0], Fmax, 0, 0, 0, &i);87}88if(is_option('g') == TRUE)89Erz = fmget_mat(infile, &Erzanz);90else91{ Erz = NULL, Erzanz = 0;}92/*------------------------------------------------------------*\93| Close input file94\*------------------------------------------------------------*/95if ( infile != stdin )96fclose (infile);9798/*------------------------------------------------------------*\99| Read the options100\*------------------------------------------------------------*/101102/*-------------------------------------------------------------------*\103| options is a pointer to integer (of length 6)104| The possible options are encoded in the following way:105| options[0]: The depth, up to wich scalar product combinations106| shall be calculated. The value should be small.107| options[0] > 0 should be used only, if the automorphismn108| group is expected to be small (with respect to the number109| of shortest vectors).110| options[1]: The n-point stabiliser with respect to different basis111| will be calculated.112| options[2]: If options[2] = 1, additional output is written to the113| file AUTO.tmp114| options[3]: If options[3] = 1, Bacher polynomials are used.115| If options[3] = 2, Bacher polynomial are used up to a depth116| specified in options[4].117| If options[3] = 3, Bacher polynomials are used, using118| combinations of vectors having the scalar119| product specified in options[5]120| options[3] = 4 is the combination of options[3] = 2 and121| options[3] = 3.122| options[4]: A natural number number or zero (if options[3] = 2 or 4)123| options[5]: An integral number (if options[3] = 3 or 4)124|125| It is possible to use NULL for options,126| in this case option is assumed to be [0,0,0,0,0,0]127\*************************************************************************/128129for(i=0;i<6;i++)130options[i] = 0;131if(is_option('d') == TRUE)132options[0] = optionnumber('d');133if(is_option('s') == TRUE)134options[1] = optionnumber('s');135if(is_option('p'))136options[2] = 1;137if(is_option('B') || is_option('b'))138options[3] = TRUE;139if(optionnumber('b') > 0)140{141options[4] = optionnumber('b');142options[3] = 2;143}144if(optionnumber('B') != 0)145{146options[5] = optionnumber('B');147options[3] = 3;148}149if(optionnumber('B') != 0 && optionnumber('b') > 0)150options[3] = 4;151152153G = autgrp(F, Fanz, SV, Erz, Erzanz, options);154155put_bravais(G, NULL, "");156157158free_bravais(G);159free_mat(SV);160for (i=0;i<Fanz;i++) free_mat(F[i]);161free(F);162for (i=0;i<Erzanz;i++) free_mat(Erz[i]);163if (Erzanz != 0) free(Erz);164165if (is_option('h') && optionnumber('h')==12){166pointer_statistics(0,0);167}168}169170171