GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include "typedef.h"1#include "gmp.h"2/* #include "gmp-impl.h" */3#include "longtools.h"4#include "matrix.h"5/**************************************************************************\6@---------------------------------------------------------------------------7@---------------------------------------------------------------------------8@ FILE: long_qbase.c9@---------------------------------------------------------------------------10@---------------------------------------------------------------------------11@12\**************************************************************************/131415/**************************************************************************\16@---------------------------------------------------------------------------17@ matrix_TYP *long_qbase(Mat)18@ matrix_TYP *Mat;19@20@ long_qbase calculetes a matrix M1 with rows from Mat, such that21@ the rows of M1 form a qbase of the vectorspace generated by22@ the rows of Mat.23@---------------------------------------------------------------------------24@25\**************************************************************************/26matrix_TYP *long_qbase(Mat)27matrix_TYP *Mat;28{29int i,j, rang, neurang, n;30MP_INT **M;31matrix_TYP *erg;3233n = Mat->cols;34if(Mat->rows < Mat->cols)35n = Mat->rows;36M = init_MP_mat(n, Mat->cols);37erg = init_mat(n, Mat->cols, "");38rang = 0;39for(i=0;i<Mat->rows && rang < n;i++)40{41for(j=0;j<Mat->cols;j++)42mpz_set_si(&M[rang][j], Mat->array.SZ[i][j]);43neurang = MP_row_gauss(M, rang+1, Mat->cols);44if(neurang != rang)45{46for(j=0;j<Mat->cols;j++)47erg->array.SZ[rang][j] = Mat->array.SZ[i][j];48rang++;49}50}51if(rang != n)52real_mat(erg, rang, Mat->cols);53free_MP_mat(M,n, Mat->cols);54free(M);55return(erg);56}575859