Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 418386#include "typedef.h"1#include "matrix.h"2345main (int argc, char *argv[])6{78matrix_TYP **F1, **F2, **Erz, *SV1, *SV2, *Iso, *tmp;9int i, Fanz, F2anz, Erzanz, options[6];10FILE *infile;11int Fmax;1213extern char **FILENAMES;14extern int FILEANZ;1516extern matrix_TYP *fget_mat ();17extern matrix_TYP **fmget_mat ();18extern matrix_TYP *short_vectors();19extern matrix_TYP *isometry();2021read_header(argc, argv);22if(FILEANZ != 2)23{24printf("Usage: %s 'file1' 'file2 [-d=n] [-s=n] [-b] [-b=n] [-B=n] [-g] [-v] [-p]\n",argv[0]);25printf("\n");26printf("file1: matrix_TYP containing a set of m NxN-matrices, the first of which,\n");27printf(" must be symmetric and positive definite.\n");28printf("file2: matrix_TYP containing a set of m NxN-matrices, the first of which,\n");29printf(" must be symmetric and positive definite.\n");30printf("\n");31printf("Computes a single g in GL_n(Z) with the property g^Tr * F_i_1 * g = F_i_2 for all\n");32printf("F_i_1 in 'file1' and F_i_2 in 'file2'.\n");33printf("\n");34printf("Options:\n");35printf("-d=n : Depth up to which scalar products are calculated. The value\n");36printf(" should be small.\n");37printf("-s=n : The n-point stabilizer with respect to different basis will be\n");38printf(" calculated.\n");39printf("-b=n : Use Bacher polynomials up to deepth n.\n");40printf("-B=n : Use Bacher polynomials with vectors having scalar product n\n");41printf("-v,-g : Read additional data from 'file'. If -v is given the program\n");42printf(" assumes that the short vectors of the first form in 'file'\n");43printf(" are given below the forms.\n");44printf(" If -g is given, the program assumes known generators for\n");45printf(" the automorphism group to be given below any other information in\n");46printf(" 'file'.\n");47printf("-p : Write additional output to the file ISOM.tmp\n");48printf("\n");49printf("Cf. Short, Shortest, Aut_grp\n");50if (is_option('h')){51exit(0);52}53else{54exit(31);55}56}57/*------------------------------------------------------------*\58| Open input file159\*------------------------------------------------------------*/60if ( (infile = fopen (FILENAMES[0], "r")) == NULL )61{62fprintf (stderr, "Could not open input-file %s\n", FILENAMES[0]);63exit (4);64}65/*------------------------------------------------------------*\66| Read the input67\*------------------------------------------------------------*/68F1 = fmget_mat(infile, &Fanz);69if(is_option('v') == TRUE)70SV1 = fget_mat(infile);71else72{73Fmax = F1[0]->array.SZ[0][0];74for(i=1;i<F1[0]->cols;i++)75{76if(F1[0]->array.SZ[i][i] > Fmax)77Fmax = F1[0]->array.SZ[i][i];78}79SV1 = short_vectors(F1[0], Fmax, 0, 0, 0, &i);8081}82/*------------------------------------------------------------*\83| Close input file84\*------------------------------------------------------------*/85if ( infile != stdin )86fclose (infile);8788/*------------------------------------------------------------*\89| Open input file290\*------------------------------------------------------------*/91if ( (infile = fopen (FILENAMES[1], "r")) == NULL )92{93fprintf (stderr, "Could not open input-file %s\n", FILENAMES[1]);94exit (4);95}96/*------------------------------------------------------------*\97| Read the input98\*------------------------------------------------------------*/99F2 = fmget_mat(infile, &F2anz);100if(F2anz != Fanz)101{102printf("Error: different number of matrices in 'isometry'\n");103exit(3);104}105if(is_option('v') == TRUE)106SV2 = fget_mat(infile);107else108SV2 = short_vectors(F2[0], Fmax, 0, 0, 0, &i);109if(is_option('g') == TRUE)110Erz = fmget_mat(infile, &Erzanz);111else112{ Erz = NULL, Erzanz = 0;}113/*------------------------------------------------------------*\114| Close input file115\*------------------------------------------------------------*/116if ( infile != stdin )117fclose (infile);118119/*------------------------------------------------------------*\120| Read the options121\*------------------------------------------------------------*/122123/*-------------------------------------------------------------------*\124| options is a pointer to integer (of length 6)125| The possible options are encoded in the following way:126| options[0]: The depth, up to wich scalar product combinations127| shall be calculated. The value should be small.128| options[0] > 0 should be used only, if the automorphismn129| group is expected to be small (with respect to the number130| of shortest vectors).131| options[1]: The n-point stabiliser with respect to different basis132| will be calculated.133| options[2]: If options[2] = 1, additional output is written to the134| file AUTO.tmp135| options[3]: If options[3] = 1, Bacher polynomials are used.136| If options[3] = 2, Bacher polynomial are used up to a deepth137| specified in options[4].138| If options[3] = 3, Bacher polynomials are used, using139| combinations of vectors having the scalar140| product specified in options[5]141| options[3] = 4 is the combination of options[3] = 2 and142| options[3] = 3.143| options[4]: A natural number number or zero (if options[3] = 2 or 4)144| options[5]: An integral number (if options[3] = 3 or 4)145|146| It is possible to use NULL for options,147| in this case option is assumed to be [0,0,0,0,0,0]148\*************************************************************************/149150for(i=0;i<6;i++)151options[i] = 0;152if(is_option('d') == TRUE)153options[0] = optionnumber('d');154if(is_option('s') == TRUE)155options[1] = optionnumber('s');156if(is_option('p'))157options[2] = 1;158if(is_option('B') || is_option('b'))159options[3] = TRUE;160if(optionnumber('b') > 0)161{162options[4] = optionnumber('b');163options[3] = 2;164}165if(optionnumber('B') > 0)166{167options[5] = optionnumber('4');168options[3] = 3;169}170if(optionnumber('B') > 0 && optionnumber('b') > 0)171options[3] = 4;172173174Iso = isometry(F1, F2, Fanz, SV1, SV2, Erz, Erzanz, options);175if(Iso != NULL) {176tmp = tr_pose(Iso);177put_mat(tmp, NULL, "isometry", 0);178free_mat(tmp);179}180else181printf("The forms are not isometric\n");182183184exit(0);185}186187188