GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include "typedef.h"1#include "getput.h"2#include "name.h"3#include "gmp.h"4#include "bravais.h"5#include "datei.h"6#include "matrix.h"7#include "voronoi.h"8#include "autgrp.h"9#include "symm.h"10#include "base.h"11#include "zass.h"12#include "longtools.h"13#include "idem.h"1415matrix_TYP *z_equivalent(bravais_TYP *G,16bravais_TYP **G_tr,17bravais_TYP *H)18{1920bravais_TYP *H_tr,21*G_neu,22*Aut;2324matrix_TYP *erg,25**base,26**N,27**forms,28*SV,29*A,30*id;3132bahn **strong;3334int i,35tmp;3637if (G->form == NULL){38G->form = formspace(G->gen,G->gen_no,1,&tmp);39G->form_no = tmp;40}4142if (H->form == NULL){43H->form = formspace(H->gen,H->gen_no,1,&tmp);44H->form_no = tmp;45}4647if (*G_tr == NULL)48*G_tr = tr_bravais(G,1,FALSE);4950H_tr = tr_bravais(H,1,FALSE);515253/* look whether the bravais groups have the same type */54erg = is_z_equivalent(G,*G_tr,H,H_tr);5556if (INFO_LEVEL & 4){57printf("nach is_z_equivalent\n");58put_mat(erg,"erg","erg",2);59}6061if (erg != NULL){62/* conjugate the groups with this element */63G_neu = konj_bravais(G,erg);6465/* G_neu is not nessesarily the whole bravais_group */66/* and apply a trick to speed up for large generating sets */67id = init_mat(G->dim,G->dim,"1");68A = rform(G_neu->gen,G_neu->gen_no,id,101);69free_mat(id);707172forms = (matrix_TYP **) malloc((G->form_no+1)*sizeof(matrix_TYP *));73forms[0] = A;74SV = short_vectors(A,max_diagonal_entry(A),0,0,0,&i);75for (i=0;i<G_neu->form_no;i++){forms[i+1] = G_neu->form[i];}76Aut = autgrp(forms,G_neu->form_no+1,SV,NULL,0,NULL);77free_mat(SV);78free_mat(A);79free(forms);8081/* stick the right elements into N, i.e. the generators of Aut and82the generators of the normlizer of G_neu */83N = (matrix_TYP **) malloc((G_neu->normal_no + Aut->gen_no) *84sizeof(matrix_TYP *));85for (i=0;i<(G_neu->normal_no+Aut->gen_no);i++){86if (i<G_neu->normal_no){87N[i] = G_neu->normal[i];88}89else{90N[i] = Aut->gen[i-G_neu->normal_no];91}92}939495/* get strong generators for G_neu */96base = get_base(G_neu);97strong = strong_generators(base,G_neu,FALSE);98G_neu->order = size(strong);99if (is_option('d')) put_bravais(G_neu,NULL,NULL);100101/* let's see whether we can conjugate G_neu to a be a supergroup102of H */103A = conjugated(G_neu,H,N,G_neu->normal_no + Aut->gen_no, strong);104105/* we will need this space for strong generators for H */106for (i=0;i<G->dim;i++){107free_bahn(strong[i]);108free(strong[i]);109}110free(strong);111112if (A==NULL){113/* the groups have the same bravais type, but are not conjugates */114free_mat(erg);115erg = NULL;116}117else{118/* they are conjugate iff the have the same order */119strong = strong_generators(base,H,FALSE);120if (size(strong) == G_neu->order){121mat_muleq(A,erg);122free_mat(erg);123erg = A;124A = NULL;125}126else{127free_mat(erg);128erg = NULL;129free_mat(A);130}131for (i=0;i<G->dim;i++){132free_bahn(strong[i]);133free(strong[i]);134}135free(strong);136}137138/* cleaning up */139free_bravais(G_neu);140free(N);141free_bravais(Aut);142for (i=0;i<G->dim;i++) free_mat(base[i]);143free(base);144}145146free_bravais(H_tr);147148return erg;149150}151152153154