GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include"typedef.h"1#include"bravais.h"2#include"matrix.h"3/**************************************************************************\4@---------------------------------------------------------------------------5@---------------------------------------------------------------------------6@ FILE: normlin.c7@---------------------------------------------------------------------------8@---------------------------------------------------------------------------9@10\**************************************************************************/111213/**************************************************************************\14@---------------------------------------------------------------------------15@ matrix_TYP *normlin(Fo, N, fdim)16@ matrix_TYP **Fo, *N;17@ int fdim;18@19@ normlin calculates a matrix fdim x fdim - matrix X such that20@ X[i], the i-th row of X, has the property21@ X[i][0] * Fo[0] + ... + X[i][fdim-1] * Fo[fdim-1] = N^{tr} * Fo[i] * N22@ That means X describes the matrix of the linear action of N on23@ the vectorspace generated by the Fo[i] by F->N^{tr}F N with respect to24@ the basis Fo[0],..,Fo[fdim-1].25@ CAUTION: The matrix describes the action on rows !26@---------------------------------------------------------------------------27@28\**************************************************************************/29matrix_TYP *normlin(Fo, N, fdim)30matrix_TYP **Fo, *N;31int fdim;32{33int i,j,k, dim;34matrix_TYP *A, *waste, *erg, *Ntr;3536dim = Fo[0]->cols;37if(N->cols != dim || N->rows != dim)38{39printf("wrong dimension of 'N' in 'normlin'\n");40exit(3);41}42erg = init_mat(fdim, fdim, "");43Ntr = tr_pose(N);44for(i=0;i<fdim;i++)45{46waste = mat_mul(Ntr, Fo[i]);47A = mat_mul(waste, N);48form_to_vec(erg->array.SZ[i], A, Fo, fdim, &j);49if(j == -1)50{51for(k=0;k<fdim;k++)52erg->array.SZ[i][k] = -erg->array.SZ[i][k];53j = 1;54}55if(j != 1){56printf("Error in 'normlin': no Z-basis of formspace\n");57exit(3);58}59free_mat(A);60free_mat(waste);61}62free_mat(Ntr);63return(erg);64}656667