GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include <typedef.h>1#include <getput.h>2#include <matrix.h>3#include <base.h>45#include <longtools.h>6#include <bravais.h>7#include <idem.h>89int INFO_LEVEL;10extern int SFLAG;111213main(int argc,char **argv){1415bravais_TYP *G;1617matrix_TYP *form,18**idem,19*id;2021int i,22anz,23dim,24dimc,25dimcc,26options[2];2728char comment[1000];2930read_header(argc,argv);3132if ((is_option('h') && optionnumber('h')==0) || (FILEANZ < 1)){33printf("Usage: %s file [-d] [-o]\n",argv[0]);34printf("\n");35printf("file: bravais_TYP containing generators of a finite unimodular group.\n");36printf("\n");37printf("Calculates the central primitive idempotents of the rational commuting (or \n");38printf("equivalently envelloping) algebra of the group in file. (This is used\n");39printf("for splitting the natural module Q^n into homogeneous components.)\n");40printf("\n");41printf("CAUTION: The program might give wrong answers for degrees bigger than 6.\n");42printf("\n");43printf("Options:\n");44printf(" -d : Outputs the dimensions of the commuting algebra and its centre.\n");45printf(" -o : Gives a Z-basis of the commuting algebra and its centre.\n");46printf("\n");47if (is_option('h')){48exit(0);49}50else{51exit(31);52}53}5455INFO_LEVEL = optionnumber('h');5657if (INFO_LEVEL & 12){58SFLAG = 1;59}6061G = get_bravais(FILENAMES[0]);6263/* avoid silly mistakes */64for (i=0;i<G->gen_no;i++){65if (!G->gen[i]->flags.Integral){66fprintf(stderr,"The generators for the bravais group have to be\n");67fprintf(stderr,"integral.\n");68exit(3);69}70}7172id = init_mat(G->dim,G->dim,"1");73form = rform(G->gen,G->gen_no,id,101);7475idem = idempotente(G->gen,G->gen_no,form,&anz,&dimc,&dimcc,options);7677printf("#%d\n",anz);78for (i=0;i<anz;i++){79sprintf(comment,"%d-th idempotent for group in %s",i+1,FILENAMES[0]);80put_mat(idem[i],NULL,comment,2);81}8283if (is_option('o')){84/* tell the user the centralizer */85printf("#%d\n",dimc);86for (i=0;i<dimc;i++){87sprintf(comment,"centralizer of group in %s",FILENAMES[0]);88put_mat(idem[i+anz],NULL,comment,2);89}90/* and it's centre */91printf("#%d\n",dimcc);92for (i=0;i<dimc;i++){93sprintf(comment,"centre of centralizer for group in %s",FILENAMES[0]);94put_mat(idem[i+anz+dimc],NULL,comment,2);95}96}97if (is_option('d')){98printf("dimension of the centralizer: %d\n",dimc);99printf("dimension of it's centre: %d\n",dimcc);100}101102for (i=0;i<anz+dimc+dimcc;i++){103free_mat(idem[i]);104}105106if (idem != NULL) free(idem);107free_bravais(G);108free_mat(form);109free_mat(id);110111if (INFO_LEVEL & 12){112pointer_statistics(0,0);113}114115exit(0);116117} /* main */118119120