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"2#include"bravais.h"3#include"orbit.h"4#include"getput.h"5#include"sort.h"67int SFLAG;8int INFO_LEVEL;910main (int argc, char *argv[])11{1213matrix_TYP **M,14*Mat,15**erg,16**representatives,17**tmp;1819bravais_TYP *G,20*Stab,21*UNITY; /* the unity group */2223int length,24l,25i,26j,27no_of_orbits=1,28Manz;2930int *option;3132extern char **FILENAMES;33extern int FILEANZ;3435read_header(argc, argv);3637if (is_option('h')){38INFO_LEVEL = optionnumber('h');39}40if (INFO_LEVEL == 8) SFLAG = 1;4142if(FILEANZ != 2)43{44printf("Usage: %s 'file1' 'file2' [-i] [-r] [-l] [-k] [-t] [-L=n] [-S=n] [-p] [-u] [-g] [-R]\n",argv[0]);45printf("\n");46printf("file1: matrix_TYP, contains a matrix X whose orbit is to be calculated \n");47printf("file2: bravais_TYP, contains generators of a group G\n");48printf("\n");49printf("Calulates the orbit of the matrix X in file1 under the group G in file2,\n");50printf("where the action is specified by the options. Default option is action by\n");51printf("left multiplication.\n");52printf("\n");53printf("Options:\n");54printf("-i : Use the generators given in file2 and their\n");55printf(" inverses to calculate the orbit.\n");56printf("-r : Operate from the right.\n");57printf("-l : Operate from the left (default).\n");58printf("-k : Operate via conjugation, ie. x -> g x g^-1 \n");59printf("-L=n : Calculate at most n elements of the orbit.\n");60printf(" 0 means infinity.\n");61printf("-S=n : If given as -S or -S=0 a generating set for\n");62printf(" the stabilizer is calculated. If given as\n");63printf(" -S=n at most n matrices of the stabilizer\n");64printf(" are calculated.\n");65printf(" S=-1 means ONLY the stabilizer is calculated.\n");66printf("-p : Operate on pairs of the form {M,-M}.\n");67printf("-u : Operate on the set of rows of the matrix given\n");68printf(" in file1.\n");69printf("-f : Operates on quadratic forms via x -> g^-tr x g^-1\n");70printf("-g : Operate on sublattices of Z^n spanned by the columns\n");7172printf(" (rows) of the matrices gX (Xg) with g in G. Brakets \n");73printf(" apply if given with the -r option.\n");74printf("-R : Give representatives of the G-orbits at the end of\n");75printf(" the output.\n");76printf("WARNING: If the orbit is infinite use option -L!\n");77printf("\n");78printf("Cf. Order, Is_finite.\n");79/* printf("Cf. Orbit_representatives, Order, Is_finite.\n"); */80if (is_option('h')){81exit(0);82}83else{84exit(31);85}86}8788M = mget_mat(FILENAMES[0],&Manz);89Mat = M[0];90G = get_bravais(FILENAMES[1]);91option = make_orbit_options();92Stab = (bravais_TYP *)malloc(sizeof(bravais_TYP));93Stab->gen_no = Stab->form_no = Stab->zentr_no = 0;94Stab->normal_no = Stab->cen_no = 0;95UNITY = init_bravais(G->dim);96UNITY->gen = (matrix_TYP **) malloc(1 * sizeof(matrix_TYP *));97UNITY->gen[0] = init_mat(G->dim,G->dim,"1");98UNITY->gen_no = 1;99representatives = (matrix_TYP **) malloc(Manz * sizeof(matrix_TYP *));100101if (is_option('S') && Manz > 1){102fprintf(stderr,"which matrix to you want to calculate the\n");103fprintf(stderr,"stabilizer of?");104exit(3);105}106107erg = orbit_alg(Mat, G, Stab, option, &length);108representatives[0] = erg[0];109110for (i=1;i<Manz;i++){111112mat_quicksort(erg,0,length-1,mat_comp);113114/* standartize M[i] (in a funny way) */115tmp = orbit_alg(M[i], UNITY, Stab, option, &l);116if (l != 1){117fprintf(stderr,"ERROR in orbit\n");118exit(3);119}120free_mat(M[i]);121M[i] = tmp[0];122free(tmp);123124if (mat_search(M[i],erg,length,mat_comp) == -1){125tmp = orbit_alg(M[i],G, Stab, option, &l);126erg = (matrix_TYP **) realloc(erg,(length+l)*sizeof(matrix_TYP));127for (j=0;j<l;j++){128erg[length+j] = tmp[j];129}130length += l;131representatives[no_of_orbits] = tmp[0];132no_of_orbits++;133free(tmp);134}135}136137if (!is_option('S') || optionnumber('S') >= 0){138printf("#%d\n", length);139for(i=0;i<length;i++)140put_mat(erg[i], NULL, "", 2);141}142if(is_option('S') == TRUE)143put_bravais(Stab, NULL, "Stabilizer of the operation");144145if (is_option('R')){146printf("===== Number of orbits: \n#%d\n",no_of_orbits);147for (i=0;i<no_of_orbits;i++){148put_mat(representatives[i],0,"representative of orbit",2);149}150}151152free_bravais(UNITY);153free_bravais(Stab);154free_bravais(G);155for(i=0;i<length;i++)156free_mat(erg[i]);157158for (i=0;i<Manz;i++)159free_mat(M[i]);160free(M);161free(erg);162free(representatives);163if (option != NULL) free(option);164if (INFO_LEVEL == 8) pointer_statistics(0,0);165166exit(0);167}168169170