GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include"typedef.h"1/*******************************************************************\2| calculate the partial image of the matrices in 'perpbase'3| under the partial automorphism and check, whether it is4| equal to the IxI-submatrix (of the first I columns and rows)5| of one of the matrices in 'perp'6\*******************************************************************/789static int normal_aut_test(x, I, V)10int *x, I;11veclist V;12{13int i,j,k,l;14int o,u,m;15int found, tester;16int xl, xj;1718for(i=0;i<perpdim;i++)19{20for(l=0;l<=I;l++)21{22if(x[l] < 0) xl = -x[l]; else xl = x[l];23/***************************************************************\24| calculate the l-th row of perpprod[i]25\***************************************************************/26for(j=0;j<V.dim;j++)27{28perpvec[j] = 0;29for(k=0;k<V.dim;k++)30perpvec[j] += V.v[xl][k] * perpbase[i][k][j];31}32if(x[l] < 0)33{34for(j=0;j<V.dim;j++)35perpvec[j] = -perpvec[j];36}37for(j=0;j<=l;j++)38{39perpprod[i][l][j] = 0;40if(x[j] < 0) xj = -x[j]; else xj = x[j];41for(k=0;k<V.dim;k++)42perpprod[i][l][j] += perpvec[k] * V.v[xj][k];43if(x[j] < 0)44perpprod[i][l][j] = -perpprod[i][l][j];45}46}47/******************************************************************\48| Check, whether perprod[i] is a submatrix of a matrix in perp49| The matrices in perp are assumed to be sorted.50\******************************************************************/51found = FALSE;52u = 0; o = perp_no-1;53while(found == FALSE && o >=u )54{55m = (o+u)/2;56tester = 0;57for(j=0;j<=I && tester == 0;j++)58{59for(k=0;k<=j && tester == 0;k++)60{61if(perp[m][j][k] != perpprod[i][j][k])62{63if(perp[m][j][k] > perpprod[i][j][k])64tester = 1;65else tester = -1;66}67}68}69if(tester == 0)70found = TRUE;71else72{73if(tester == 1) o = m-1;74else u = m+1;75}76}77if(found == FALSE)78{79return(FALSE);80}81}82return(TRUE);83}8485868788static void mach_perp_matrices(fp, P, Pbase, n)89fpstruct fp;90matrix_TYP **P, **Pbase;91int n;92{93int i,j,k;9495if((perp = (int ***)malloc(perp_no *sizeof(int **))) == 0)96{97printf("malloc of 'perp' in 'perfect_normalizer' failed\n");98exit(2);99}100for(i=0;i<perp_no;i++)101{102if((perp[i] = (int **)malloc(n *sizeof(int *))) == 0){103printf("malloc of perp[%d] in 'perfect_normalizer' failed\n", i);104exit(2);105}106for(j=0;j<n;j++)107{108if((perp[i][j] = (int *)malloc(n *sizeof(int))) == 0){109printf("malloc of perp[%d][%d] in 'perfect_normalizer' failed\n", i, j);110exit(2);111}112}113for(j=0;j<n;j++)114for(k=0;k<n;k++)115perp[i][j][k] = P[i]->array.SZ[fp.per[j]][fp.per[k]];116}117if((perpbase = (int ***)malloc(perpdim *sizeof(int **))) == 0)118{119printf("malloc of 'perpbase' in 'perfect_normalizer' failed\n");120exit(2);121}122for(i=0;i<perpdim;i++)123{124if((perpbase[i] = (int **)malloc(n *sizeof(int *))) == 0)125{126printf("malloc of perpbase[%d] in 'perfect_normalizer' failed\n", i);127exit(2);128}129for(j=0;j<n;j++)130{131if((perpbase[i][j] = (int *)malloc(n *sizeof(int))) == 0)132{133printf("malloc of perpbase[%d][%d] in 'perfect_normalizer' failed\n", i, j);134exit(2);135}136}137for(j=0;j<n;j++)138for(k=0;k<n;k++)139perpbase[i][j][k] = Pbase[i]->array.SZ[j][k];140}141if((perpprod = (int ***)malloc(perpdim *sizeof(int **))) == 0)142{143printf("malloc of 'perpprod' in 'perfect_normalizer' failed\n");144exit(2);145}146for(i=0;i<perpdim;i++)147{148if((perpprod[i] = (int **)malloc(n *sizeof(int *))) == 0)149{150printf("malloc of 'perpprod[i]' in 'perfect_normalizer' failed\n");151exit(2);152}153for(j=0;j<n;j++)154{155if((perpprod[i][j] = (int *)malloc((j+1) *sizeof(int))) == 0)156{157printf("malloc of 'perpprod[i][j]' in 'perfect_normalizer' failed\n");158exit(2);159}160}161}162if((perpvec = (int *)malloc(n *sizeof(int))) == 0)163{164printf("malloc of 'perpvec' in 'perfect_normalizer' failed\n");165exit(2);166}167}168169static void free_perp_matrices(n)170int n;171{172int i,j;173for(i=0;i<perp_no;i++)174{175for(j=0;j<n;j++)176free(perp[i][j]);177free(perp[i]);178}179free(perp);180for(i=0;i<perpdim;i++)181{182for(j=0;j<n;j++)183free(perpbase[i][j]);184free(perpbase[i]);185}186free(perpbase);187for(i=0;i<perpdim;i++)188{189for(j=0;j<n;j++)190free(perpprod[i][j]);191free(perpprod[i]);192}193free(perpprod);194free(perpvec);195}196197198