GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
/****************************************************************************1**2*A FreeSpace.c ANUPQ source Eamonn O'Brien3**4*Y Copyright 1995-2001, Lehrstuhl D fuer Mathematik, RWTH Aachen, Germany5*Y Copyright 1995-2001, School of Mathematical Sciences, ANU, Australia6**7*/89#include "pq_defs.h"10#include "pga_vars.h"11#include "pcp_vars.h"1213/* free space used by vector, a, whose first index is start */1415void free_vector(int *a, int start)16{1718#ifdef DEBUG19printf("Free vector\n");20#endif2122if (start)23++a;24free(a);25}2627/* free space used by matrix, a, whose indices commence at either 0 or 1 */2829void free_matrix(int **a, int n, int start)30{31register int i;32#ifdef DEBUG33printf("Free matrix\n");34#endif3536if (n == 0)37n = 1;3839for (i = start; i < start + n; ++i) {40if (start)41++a[i];42free(a[i]);43}4445if (start)46++a;47free(a);48}4950/* free space used by array, a, whose indices commence at either 0 or 1 */5152void free_array(int ***a, int n, int m, int start)53{54register int i, j;55#ifdef DEBUG56printf("Free array\n");57#endif5859if (n == 0)60n = 1;61if (m == 0)62m = 1;6364for (i = start; i < start + n; ++i) {65for (j = start; j < start + m; ++j) {66if (start)67++a[i][j];68free(a[i][j]);69}70if (start)71++a[i];72free(a[i]);73}7475if (start)76++a;77free(a);78}7980/* free space used by character vector, a, whose first index is start */8182void free_char_vector(char *a, int start)83{8485#ifdef DEBUG86printf("Free char vector\n");87#endif8889if (start)90++a;91free(a);92}9394/* free space used by character matrix, a */9596void free_char_matrix(char **a, int n)97{98register int i;99#ifdef DEBUG100printf("Free char matrix\n");101#endif102103if (n == 0)104n = 1;105106for (i = 0; i < n; ++i)107free(a[i]);108109free(a);110}111112/* free space used in computing orbits and stabilisers */113114void free_space(Logical soluble_computation,115int **perms,116int *orbit_length,117int *a,118int *b,119char *c,120struct pga_vars *pga)121{122int nmr_of_perms = (pga->space_efficient ? 1 : pga->nmr_of_perms);123124#ifdef DEBUG125printf("Free space routine\n");126#endif127128free_matrix(perms, nmr_of_perms, 1);129free_vector(orbit_length, 1);130free_vector(a, 1);131if (soluble_computation) {132free_vector(b, 1);133free_char_vector(c, 1);134}135free_vector(pga->map, 1);136free_vector(pga->rep, 1);137free_vector(pga->powers, 0);138free_vector(pga->inverse_modp, 0);139}140141142