GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include"typedef.h"1#include"matrix.h"2#include"bravais.h"3/**************************************************************************\4@---------------------------------------------------------------------------5@---------------------------------------------------------------------------6@ FILE: tr_bravais.c7@---------------------------------------------------------------------------8@---------------------------------------------------------------------------9@10\**************************************************************************/111213/**************************************************************************\14@---------------------------------------------------------------------------15@ bravais_TYP *tr_bravais(B, calcforms, invert)16@ bravais_TYP *B;17@ int calcforms;18@ int invert;19@20@ 'tr_bravais' caclulates the group G = B^{tr}21@ The matrices in B->gen, B->zentr, B->normal and B->cen are transposed22@ (if exists)23@ If calcforms == 0, then the matrices of G->form are not calculated24@ If calcforms == 1, then G->form is calculated with 'formspace'25@ If calcforms == 2, then G->form is calculated with 'invar_space'26@ if B->form_no != 0, invar_space is started with27@ fdim = B->form_no, otherwise the argument 'fdim'28@ for invar_space is calculated by calculating the29@ formspace with p_formspace modulo 101.30@ If (invert == TRUE) the matrices in G->gen,G->cen,G->normal31@ are inverted.32@---------------------------------------------------------------------------33@34\**************************************************************************/35bravais_TYP *tr_bravais(B, calcforms,invert)36bravais_TYP *B;37int calcforms;38int invert;39{40bravais_TYP *G;41int i,j,k;42matrix_TYP **XX,43*tmp;4445G = init_bravais(B->dim);46if(B->gen_no != 0)47{48G->gen_no = B->gen_no;49if( (G->gen = (matrix_TYP **)malloc(G->gen_no *sizeof(matrix_TYP *))) == NULL)50{51printf("malloc of 'G->gen' in 'tr_bravais' failed\n");52exit(2);53}54for(i=0;i<G->gen_no;i++)55if (invert){56tmp = mat_inv(B->gen[i]);57G->gen[i] = tr_pose(tmp);58free_mat(tmp);59}60else{61G->gen[i] = tr_pose(B->gen[i]);62}63}64if(B->zentr_no != 0)65{66G->zentr_no = B->zentr_no;67if( (G->zentr = (matrix_TYP **)malloc(G->zentr_no *sizeof(matrix_TYP *))) == NULL)68{69printf("malloc of 'G->zentr' in 'tr_bravais' failed\n");70exit(2);71}72for(i=0;i<G->zentr_no;i++)73G->zentr[i] = tr_pose(B->zentr[i]);74}75if(B->normal_no != 0)76{77G->normal_no = B->normal_no;78if( (G->normal = (matrix_TYP **)malloc(G->normal_no *sizeof(matrix_TYP *))) == NULL)79{80printf("malloc of 'G->normal' in 'tr_bravais' failed\n");81exit(2);82}83for(i=0;i<G->normal_no;i++)84if (invert){85tmp = mat_inv(B->normal[i]);86G->normal[i] = tr_pose(tmp);87free_mat(tmp);88}89else{90G->normal[i] = tr_pose(B->normal[i]);91}92}93if(B->cen_no != 0)94{95G->cen_no = B->cen_no;96if( (G->cen = (matrix_TYP **)malloc(G->cen_no *sizeof(matrix_TYP *))) == NULL)97{98printf("malloc of 'G->cen' in 'tr_bravais' failed\n");99exit(2);100}101for(i=0;i<G->cen_no;i++)102if (invert){103tmp = mat_inv(B->cen[i]);104G->cen[i] = tr_pose(tmp);105free_mat(tmp);106}107else{108G->cen[i] = tr_pose(B->cen[i]);109}110}111if(calcforms == 1)112G->form = formspace(G->gen, G->gen_no, 1, &G->form_no);113if(calcforms == 2)114{115if(B->form_no != 0)116G->form = invar_space(G->gen, G->gen_no, B->form_no, 1, 100, &G->form_no);117else118{119XX = p_formspace(G->gen, G->gen_no, 101, 1, &i);120for(j=0;j<i;j++)121free_mat(XX[i]);122free(XX);123G->form = invar_space(G->gen, G->gen_no, i, 1, 100, &G->form_no);124}125}126127/* inserted a return: tilman 7/1/97 */128return G;129}130131132