GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include"typedef.h"1#include"tools.h"2#include"matrix.h"3#include"getput.h"4#include"longtools.h"56789main (int argc, char *argv[])10{11matrix_TYP **M, *Trf, *E;12int Manz, i;1314extern char **FILENAMES;15extern int FILEANZ;161718read_header(argc, argv);19if(FILEANZ != 1)20{21printf("Usage: %s 'file' [-t]\n",argv[0]);22printf("\n");23printf("file: matrix_TYP containing a set of matrices\n");24printf("\n");25printf("Calculates the Smith normal form of the matrices\n");26printf("given in file, resp. the isomorphism type of the factor group of\n");27printf("two lattices, where the matrix is interpreted as the coordinate\n");28printf("columns of a generating set of the second lattice in terms of a\n");29printf("basis of the first one.\n");30printf("\n");31printf("CAUTION: If the given matrix is rational, the\n");32printf(" Smith normal form is calculated for the least\n");33printf(" integral multiple of it.\n");34printf("\n");35printf("Options:\n");36printf("-t : gives the left tranformation matrix as well.\n");37printf("\n");38if (is_option('h')){39exit(0);40}41else{42exit(31);43}44}4546M = mget_mat(FILENAMES[0], &Manz);47for(i=0;i<Manz;i++)48{49if (!M[i]->flags.Integral) rat2kgv(M[i]);5051if(is_option('t'))52Trf = init_mat(M[i]->rows, M[i]->rows, "1");53else54Trf = NULL;55E = long_elt_mat(Trf, M[i], NULL);56put_mat(E, NULL, "ELT of matrix", 0);57free_mat(E);58if(is_option('t'))59{60put_mat(Trf, NULL, "Transformtion matrix", 0);61free_mat(Trf);62}63}646566exit(0);67}686970