GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include"typedef.h"1/**************************************************************************\2@---------------------------------------------------------------------------3@---------------------------------------------------------------------------4@ FILE: modp_mat.c5@---------------------------------------------------------------------------6@---------------------------------------------------------------------------7@8\**************************************************************************/910/**************************************************************************\11@---------------------------------------------------------------------------12@ void modp_mat(M, p)13@ matrix_TYP *M;14@ int p;15@16@ reduces the entries of M modulo p such -|p/2| < x < |p/2|17@ for every entry x of M.18@ if p = 2 or p = -2, the entries are 0 or 1.19@---------------------------------------------------------------------------20@21\**************************************************************************/2223void modp_mat(M, prime)24matrix_TYP *M;25int prime;26{27int i,j, phalbe, mphalbe;2829if(prime < 0)30prime = -prime;31phalbe = prime/2;32mphalbe = -phalbe;33if(prime == 2)34mphalbe = 0;35for(i=0;i<M->rows;i++)36for(j=0;j<M->cols;j++)37{38M->array.SZ[i][j] %=prime;39if(M->array.SZ[i][j] < mphalbe)40M->array.SZ[i][j] +=prime;41if(M->array.SZ[i][j] > phalbe)42M->array.SZ[i][j] -=prime;43}44}454647