GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include "typedef.h"1#include "longtools.h"2#include "zass.h"3#include "matrix.h"456/**********************************************************************7@8@----------------------------------------------------------------------9@10@ static void coboundary(bravais_TYP *G,11@ matrix_TYP *C,12@ matrix_TYP *T)13@14@----------------------------------------------------------------------15@16***********************************************************************/1718void coboundary(G,C,T)19bravais_TYP *G;20matrix_TYP *C,*T;21{2223int i,24k,25l,26n;2728matrix_TYP *A;29matrix_TYP **erg;3031n = G->dim;3233A = init_mat(n*G->gen_no,n+1,"k");3435/* belegen der matrix A */36for (i=0;i<G->gen_no;i++){37for (k=0;k<n;k++){38for (l=0;l<n;l++){39if (k == l){40A->array.SZ[k+i*n][l] = G->gen[i]->array.SZ[k][l] - 1;41}42else{43A->array.SZ[k+i*n][l] = G->gen[i]->array.SZ[k][l];44}45}46}47}4849for (i=0;i<G->gen_no;i++)50for (k=0;k<n;k++)51A->array.SZ[i*n+k][n] = C->array.SZ[i*n+k][0];5253k = long_row_gauss(A);54real_mat(A,k,A->cols);5556/* kick out the rows which have 0's in the first n entries */57for (i=A->rows-1;i>0;i--){58for (k=0;k<n && A->array.SZ[i][k] == 0;k++);59if (k == n){60if (A->array.SZ[i][n] % C->kgv){61fprintf(stderr,"error in coboundary\n");62exit(3);63}64else{65real_mat(A,A->rows-1,A->cols);66}67}68}697071real_mat(C,A->rows,1);7273for (i=0;i<A->rows;i++)74C->array.SZ[i][0] = A->array.SZ[i][n];7576real_mat(A,A->rows,n);7778Check_mat(A);79Check_mat(C);8081/* put_mat(A,0,0,0);82put_mat(C,0,0,0); */8384erg = long_solve_mat(A, C);8586if (erg == NULL || erg[0] == NULL){87fprintf(stderr,"error in coboundary\n");88exit(3);89}9091/* put_mat(erg[0],0,0,0); */9293iscal_mul(T,erg[0]->kgv);94for (i=0;i<G->dim;i++){95T->array.SZ[i][G->dim] = erg[0]->array.SZ[i][0];96}97T->kgv = erg[0]->kgv;98Check_mat(T);99100free_mat(A); A = NULL;101for(i=0;i<2;i++){102if (erg[i] != NULL) free_mat(erg[i]);103}104free(erg);105106return;107}108109110111112