GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include "typedef.h"1#include "matrix.h"2#include "longtools.h"3#include "sort.h"4#include "bravais.h"56static matrix_TYP *formspace_operation(matrix_TYP **F,int Fno,matrix_TYP *N)7{89int i;1011matrix_TYP *res,12*tmp,13*N_tr;1415res = init_mat(Fno,Fno,"");16N_tr = tr_pose(N);1718for (i=0;i<Fno;i++){19tmp = scal_pr(N_tr,F[i],TRUE);20form_to_vec_modular(res->array.SZ[i],tmp,F,Fno);21free_mat(tmp);22}2324free_mat(N_tr);2526return res;27}282930static int position(matrix_TYP **a,matrix_TYP *x,int n)31/* returns the first index i<n such that a[i] == x, and32-1 if none exists */33{34int i=0;3536while (i<n){37if (mat_comp(a[i],x) == 0){38return i;39}40i++;41}42return -1;43}4445void red_normal(bravais_TYP *G)46{4748int i;4950matrix_TYP **REP,51*tmp;5253REP = (matrix_TYP **) malloc(G->normal_no * sizeof(matrix_TYP *));5455/* calculate the presentation on the formspace (bare in mind that it56is faithfull for N_GL_n(Z) (G)/G if G is a bravais_group */57for (i=0;i<G->normal_no;i++){58REP[i] = formspace_operation(G->form,G->form_no,G->normal[i]);59}6061/* see if the are nessesary */62for (i=1;i<G->normal_no;i++){63if (position(REP,REP[i],i) != (-1)){64/* throw it away */65free_mat(G->normal[i]);66G->normal[i] = NULL;67}68else{69/* we might got an inverse already */70tmp = long_mat_inv(REP[i]);71if (position(REP,tmp,i) != (-1)){72free_mat(G->normal[i]);73G->normal[i] = NULL;74}75free_mat(tmp);76}77}7879/* free REP */80for (i=0;i<G->normal_no;i++)81free_mat(REP[i]);82free(REP);8384/* now swap out the NULL's we got in G->normal */85for (i=0;i<G->normal_no;i++){86if (G->normal[i] == NULL){87G->normal_no--;88G->normal[i]= G->normal[G->normal_no];89i--;90}91}9293return;94}959697