GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include"typedef.h"1/**************************************************************************\2@---------------------------------------------------------------------------3@---------------------------------------------------------------------------4@ FILE: orb_division.c5@---------------------------------------------------------------------------6@---------------------------------------------------------------------------7@8\**************************************************************************/91011/*****************************************12@ matrix_TYP *orbit_representatives(M, Manz, G, option, orbit_no, is_sorted)13@ matrix_TYP **M;14@ bravais_TYP *G;15@ int *option, Manz, *orbit_no;16@ int is_sorted;17@18@ The function 'orbit_representatives' calculates representatives19@ of a group 'G' (*bravais_TYP) on a set 'M' (**matrix_TYP) of matrices.20@ 'Manz' denotes the number of matrices in 'M'.21@ The number of representatives is return via the pointer (int *orbit_no).22@ If the set 'M' is sorted (with respect to the order defined in the23@ function 'cmp_mat()') the function makes use of it by searching24@ orbit elements in a sorted list.25@ if is_sorted = 1, it is assumed that 'M' is sorted.26@ CAUTION: This is not checked !27@ So is_sorted = 1 for unsorted 'M' yields a wrong result.28@ if is_sorted = 0, it is assumed that 'M' is unsorted.29@30@ The options are the same as in 'orbit_alg'.31******************************************/3233matrix_TYP *orbit_representatives(M, Manz, G, option, orbit_no, is_sorted)34matrix_TYP **M;35bravais_TYP *G;36int *option, Manz, *orbit_no;37int is_sorted;38{39matrix_TYP *erg, **or;40int i,j,k, no;41int *merk, found;4243extern matrix_TYP *init_mat();44extern matrix_TYP **orbit_alg();45extern int mat_comp();4647erg = init_mat(2, Manz, "");48if((merk = (int *)calloc(Manz , sizeof(int))) == NULL)49{50printf("calloc of 'merk' in 'orbit_representatives' failed\n");51exit(2);52}5354i = 0;55no = 0;56while(i<Manz)57{58while(i<Manz && merk[i] != 0)59i++;60if(i<Manz)61{62erg->array.SZ[0][no] = i;63or = orbit_alg(M[i], G, NULL, option, &(erg->array.SZ[1][no]));64merk[i] = no+1;65if(is_sorted == 1)66{67for(j=1;j<erg->array.SZ[1][no];j++)68{69found = mat_search(or[j], M, Manz, mat_comp);70if(found != -1)71merk[found] = no+1;72}73}74else75{76for(j=1;j<erg->array.SZ[1][no];j++)77{78found = FALSE;79for(k=i+1;k<Manz && found == FALSE;k++)80{81if(merk[k] != 1 && cmp_mat(or[j], M[k]) == 0)82{83merk[k] = no+1;84found = TRUE;85}86}87}88}89for(j=0;j<erg->array.SZ[1][no];j++)90free_mat(or[j]);91free(or);92no++;93}94}95real_mat(erg, 2, no);96*orbit_no = no;97free(merk);98return(erg);99}100101102