GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#ifdef TEST_PRIVATE1#include "ZZ_P.h"2#include "ZZ_irr_const_P.h"3#include "ZZ_cen_fun_P.h"4#else5#include "ZZ.h"6#endif78/*{{{}}} */9/*{{{ ZZ_usage */10void11ZZ_usage (progname)12char *progname;13{14fprintf (stderr, "Usage: %s -bghl <#level> n <#number> pqrstu <file>\n\n", progname);15fprintf (stderr, "-b : Print only the matrices of change of base and their inverse.\n");16fprintf (stderr, "-g : Do not compute elementary divisors of the gram matrix.\n");17fprintf (stderr, "-h : Print this help\n");18fprintf (stderr, "-l #: Stop after reaching level #level (default #=%d).\n", LEVEL);19fprintf (stderr, "-n #: Stop after computation of #number \"Zentrierungen\" (default #=%d).\n", NUMBER);20fprintf (stderr, "-p<d0>/<d1>/<d2> ... : treat the lattice as a direct sum of <d0> sublattices\n");21fprintf (stderr, " of dimensions <d1>, <d2> etc. (0 <= d0 <= 6) and compute only those\n");22fprintf (stderr, " centerings that have surjective projections on them.\n");23fprintf (stderr, "-q : Quiet mode. Suppress any messages to stdin/stdout.\n");24fprintf (stderr, "-r : With ZZ_lll-reduction.\n");25fprintf (stderr, "-s : Print less information.\n");26fprintf (stderr, "-t : Create the data-file \"ZZ.tmp\".\n");27fprintf (stderr, "-u : Do not compute elementary divisors of the change of base\n\n");28}2930/*}}} */313233void34foo ()35{36/* printf("Hello world!\n"); */37}3839#ifndef TEST_PRIVATE40/*{{{ main */41void42main (argc, argv)43int argc;44char *argv[];45{46bravais_TYP *group;47matrix_TYP *gram;48char *file_name = NULL;49char *prog_name;50int retval;51char options[256];52int is_option;53int projections[7];54char *help;55int num_proj;5657/* skipped the function atexit because some compiler won't have it58tilman 28/07/97:59atexit (foo); */60prog_name = argv[0];61options[0] = '\0';62is_option = 0;63argv++;64argc--;65while (argc >= 2)66{67if (**argv == '-')68{69(*argv)++;70is_option = 1;71}72if (is_option)73{74strcat (options, *argv);75if ((help = strchr (*argv, 'p')) != NULL)76{77projections[0] = atoi (help + 1);78if (projections[0] == 0)79{ /* is in next argv */80argv++;81argc--;82projections[0] = atoi (argv[0]);83}84if (projections[0] == 0)85{86fprintf (stderr, "\"p\" option requires number of sublattices and their dimensions to be given.\n");87ZZ_usage (prog_name);88exit (31);89}90else if (projections[0] > 6)91{92fprintf (stderr, "Maximal dimensionis 6\n");93}94else95{96printf ("%d\n", projections[0]);97help = argv[0];98for (num_proj = 1; num_proj <= projections[0]; num_proj++)99{100if ((help = strchr (help, '/')) != NULL)101{102help++;103projections[num_proj] = atoi (help);104if (projections[num_proj] == 0)105{106fprintf (stderr, "\"p\" option requires number of sublattices and their dimensions to be given.\n");107ZZ_usage (prog_name);108exit (31);109}110}111else112{113fprintf (stderr, "\"p\" option requires number of sublattices and their dimensions to be given.\n");114ZZ_usage (prog_name);115exit (31);116}117}118}119}120}121argv++;122argc--;123}124file_name = *argv;125if (file_name == NULL)126{127fprintf (stderr, "No filename specified.\n");128ZZ_usage (prog_name);129exit (31);130}131132group = get_bravais (file_name);133134gram = group->form[0];135136ZZ (group, gram, group->divisors, options, projections[0],137projections[1],138projections[2],139projections[3],140projections[4],141projections[5],142projections[6]);143144fprintf (stderr, "num_zentr: %d\n", group->zentr_no);145cleanup_prime ();146free_bravais (group);147148#ifdef MEM_DEBUG149debug_meminfo ();150#endif151152exit (retval);153154}155/*}}} */156#else157/*{{{ main */158void159main (argc, argv)160161int argc;162char *argv[];163{164matrix_TYP *Gram, **help2;165ZZ_data_t data;166ZZ_tree_t tree;167168int i, j, k;169170char *file_name;171172scan_arg (argc, argv, &file_name);173Gram = ZZ_fget_data (&data, &tree, file_name);174if (constituents == 1)175{176for (i = 0; i < data.p_consts.k; i++)177{178help2 = ZZ_irr_const (data.DELTA, data.r,179data.p_consts.p[i],180&data.p_consts.s[i]);181data.n[i] = (int *) malloc (data.p_consts.s[i] * sizeof (int), "main:data.n[i]");182data.p_consts.Delta[i] = (matrix_TYP ***) malloc (data.p_consts.s[i] * sizeof (matrix_TYP **), "main:data.p_consts.Delta[i]");183for (j = 0; j < data.p_consts.s[i]; j++)184{185data.p_consts.Delta[i][j] = (matrix_TYP **) malloc (data.r * sizeof (matrix_TYP *), "main:data.p_consts.Delta[i][j]");186for (k = 0; k < data.r; k++)187{188data.p_consts.Delta[i][j][k] = help2[j * data.r + k];189data.p_consts.Delta[i][j][k]->prime = data.p_consts.p[i];190}191data.n[i][j] = data.p_consts.Delta[i][j][0]->rows;192}193free (help2);194}195ZZ_test_konst (&data);196/*{{{ */197/*{{{ */198for (i = 0; i < data.p_consts.k; i++)199{200/*{{{ */201/*------------------------------------------------------------*\202| initialize Endomorphisms |203\*------------------------------------------------------------*/204data.EnCo[i] = (ZZ_prod_t *) malloc (data.p_consts.s[i] * sizeof (ZZ_prod_t), "main:data.EnCo[i]");205data.Endo[i] = (matrix_TYP ***) malloc (data.p_consts.s[i] * sizeof (matrix_TYP **), "main:data.Endo[i]");206}207208data.epi_base = NULL;209data.epi = init_mat (data.N, data.N, "ik");210tree.root->k_vec = (int **) malloc (data.p_consts.k * sizeof (int *), "main:tree.root->k_vec");211data.VK = (int **) malloc (data.p_consts.k * sizeof (int *), "main:data.VK");212for (i = 0; i < data.p_consts.k; i++)213{214tree.root->k_vec[i] = (int *) calloc (data.p_consts.s[i], sizeof (int), "main:tree.root->k_vec[i]");215data.VK[i] = (int *) calloc (data.p_consts.s[i] + 1, sizeof (int), "main:data.VK[i]");216data.VK[i]++;217}218ZZ_make_endo (&data);219/*}}} */220/*}}} */221/*}}} */222}223if (verbose == TRUE)224{225/*{{{ */226for (i = 0; i < data.p_consts.k; i++)227{228fprintf (stderr, "Primzahl: %d\n", data.p_consts.p[i]);229for (j = 0; j < data.p_consts.s[i]; j++)230{231fprintf (stderr, "Konstituent %d:\n", j);232for (k = 0; k < data.r; k++)233{234fprintf (stderr, "Erzeuger %d:\n", k);235fput_mat (stderr, data.p_consts.Delta[i][j][k], "Konstituent", 0);236}237}238}239/*}}} */240}241ZZ_intern (Gram, &data, &tree);242ZZ_fput_data (&data, &tree);243ZZ_free_data (&data);244free (Gram);245}246/*}}} */247#endif248249250