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: 418384#include "defs.h"12extern char inf0[],inf1[],inf2[],inf3[],outf1[],outf2[],outf3[],temp1[],temp2[],3ofstr[],ngn[],expg,exph,cr,dcr,hg,triv,cong;4extern int trsp,trptr;5extern int nfuse,tree[],perm[],gorb[],lorbg[],lorbh[],base[],6fpt[],bpt[],coh_index[],*cp[],*trad[],*sv[],7*tailad[],**cpad[],**svgptr[],**svhptr[],8npt,**lcp,**ucp,*stop,*pst,*pend,nb,fnt,lnt,9ind,coind,oind,cind,bno,pt,**expp,npg;10extern FILE *ip,*op;1112/* The basic aim of this part of the program is to compute permutations of G13as permutations on the left cosets of H. This is used to compute double14coset reps if required.15*/16int17cnprg2 (void)18{ int i,j,k,l,m,n,ncp,pno,mexh,lorb,ndcr,nntb,*orb,rep,*q,**p,**conp,19*len,*orbptr,*cperm,flct,inch;20char ngth,fuse; int c;21if (exph)22{ mexh= (pend-pst)/npt; lcp=cp; j=0;23for (i=1;i<=lnt;i++) j+=(lorbh[i]-1);24if (j<mexh) for (i=1;i<=lnt;i++)25{ for (j=1;j<=npt;j++) expp[j]=0; expp[base[i]]=stop;26p=svhptr[i];27for (j=1;j<=npt;j++) if (p[j]!=0 && p[j]!=stop)28{ expp[j]=pst; ucp=lcp-1; addsvf(j,p);29for (k=1;k<=npt;k++) pst[k]=image(k); pst+=npt;30}31for (j=1;j<=npt;j++) p[j]=expp[j];32}33else {printf("Not enough room to expand H.\n"); exph=0; }34}35conp=cp+2*npt;36if (cong)37{ strcat(inf1,".cp"); op=fopen(inf1,"w"); fprintf(op,"%4d%4d\n",ind,npg);38printf("Computing coeffs of perms in G.\n");39for (pno=1;pno<=npg;pno++)40{ *conp= perm+(pno-1)*2*npt-1;41printf("Coeffs of permutation no %d.\n",pno);42/* The basic conversion algorithm now follows. In this case, coefficents43are being output, as well as the perms themselves.44*/45ucp=conp; q=tree;46for (bno=fnt;bno!= -1;bno=fpt[bno])47{ tailad[bno]=q; q+=2; cpad[bno]=ucp+1; }48for (cind=1;cind<=ind;cind++)49{ if (cind>1) advance(); lcp=conp; trptr=0;50for (bno=1;bno<=nb;bno++)51{ if (fpt[bno]!=0)52{ i=tree[trptr]; j=image(i);53while (svhptr[bno][j]==0)54{ trptr=tree[trptr+1]; i=tree[trptr]; j=image(i); }55if (expg)56{ q=svgptr[bno][i]; if (q!=stop) {lcp--; *lcp=q+npt; } }57else addsvb(i,svgptr[bno]);58trptr+=2;59}60else j=image(base[bno]);61if (exph) { q=svhptr[bno][j]; if (q!=stop) {ucp++; *ucp=q; }}62else addsvf(j,svhptr[bno]);63fprintf(op," %d",j);64}65fprintf(op," %6d ",tree[trptr]);66} /* for (cind=1;... */67fprintf(op,"\n");68} /* for (pno=1;... */69fclose(op);70} /* if (cong) */71if (hg==0) return(0);7273*conp= expg ? perm-1 : pst-1; flct= -1;74printf("Converting permutations from %s.\n",inf3);75if ((ip=fopen(inf3,"r"))==0)76{ fprintf(stderr,"Cannot open %s.\n",inf3); return(-1); }77fscanf(ip,"%d%d%d%d",&i,&ncp,&j,&k);78if (k!=0) k=3; else if (j>0) k=2; else k=1;79if (i!=npt) {fprintf(stderr,"npt wrong in %s.\n",inf3); return(-1); }80for (i=1;i<=k;i++) while ((c=getc(ip))!='\n');81op=fopen(temp1,"w"); fprintf(op,"%4d%4d%4d%4d\n",ind,ncp,0,0);8283while (1)84{ for (pno=1;pno<=ncp;pno++)85{ printf("Converting perm no %d.\n",pno);86q= *conp+1;87for (i=1;i<=npt;i++) {fscanf(ip,"%d",q); q++;}88while ((c=getc(ip))!='\n');89ucp=conp; q=tree;90for (bno=fnt;bno!= -1;bno=fpt[bno])91{ tailad[bno]=q; q+=2; cpad[bno]=ucp+1; }92for (cind=1;cind<=ind;cind++)93{ if (cind>1) advance(); lcp=conp; trptr=0;94for (bno=1;bno<=lnt;bno++)95{ if (fpt[bno]!=0)96{ i=tree[trptr]; j=image(i);97while (svhptr[bno][j]==0)98{ trptr=tree[trptr+1]; i=tree[trptr]; j=image(i); }99if (expg)100{ q=svgptr[bno][i]; if (q!=stop) {lcp--; *lcp=q+npt; } }101else addsvb(i,svgptr[bno]);102trptr+=2;103}104else j=image(base[bno]);105if (exph) { q=svhptr[bno][j]; if (q!=stop) {ucp++; *ucp=q; }}106else addsvf(j,svhptr[bno]);107}108fprintf(op," %3d",tree[trptr]);109}110fprintf(op,"\n");111} /* for (pno=1;... */112fclose(op); fclose(ip);113flct++; if (flct>nfuse) break;114if (flct==0)115{ strcpy(inf2,inf0); strcat(inf2,ngn);116if ((ip=fopen(inf2,"r"))==0)117{ flct++; if (flct>nfuse) break; ngth=0; }118else ngth=1;119}120if (flct>0)121{ strcpy(inf2,inf0); strcat(inf2,"dcr"); ofstr[0]=flct+'0';122strcat(inf2,ofstr);123}124strcpy(outf3,inf2); strcat(outf3,".nr");125if ((ip=fopen(inf2,"r"))==0)126{ fprintf(stderr,"Cannot open %s.\n",inf2); return(-1); }127fscanf(ip,"%d%d",&i,&ncp); while (getc(ip)!='\n');128if (i!=npt) {fprintf(stderr,"npt wrong in %s.\n",inf2); return(-1);}129op=fopen(outf3,"w"); fprintf(op,"%3d\n",ncp);130printf("Converting permutations from %s.\n",inf2);131} /* while(1) */132133/* We are now ready to compute orbits of the new perms if necessary, in order134to compute double coset reps. The tree information is no longer required,135and the tree space is used to store the new permutations.136*/137if (dcr)138{ if (trsp<4*ind)139{ fprintf(stderr,"No room to compute orbits. Increase TRSP.\n");return(-1);}140ndcr=ind-1; orb=tree-1; len=orb+ind; orbptr=len+ind; cperm=orbptr+ind;141for (i=1;i<=ind;i++) {orb[i]=i; len[i]=1; orbptr[i]=0;}142printf("Computing orbits of con perms from %s.\n",outf1);143ip=fopen(temp1,"r");fscanf(ip,"%d%d",&i,&ncp);144while ((c=getc(ip))!='\n'); flct= -1; fuse=0;145while (1)146{ for (i=1;i<=ncp;i++)147{ q=cperm;148for (j=1;j<=ind;j++) { q++; fscanf(ip,"%d",q); }149for (j=1;j<=ind;j++)150{ k=orb[j]; l=orb[cperm[j]];151if (k!=l)152{ if (fuse) {if (len[l]<len[k]) {m=k;k=l;l=m;}}153else len[k]+=len[l];154len[l]=0; n=k;155while ((m=orbptr[n])!=0) n=m;156orbptr[n]=l;157while (l!=0) {orb[l]=k;l=orbptr[l];}158ndcr--;159}160}161}162fclose(ip); flct++;163if (flct==0) unlink(temp1); else unlink(outf3);164if (flct>nfuse) break;165if (flct==0) {fuse=1; if (ngth==0) flct++; if (flct>nfuse) break;}166strcpy(outf3,inf0);167if (flct==0) strcat(outf3,ngn);168else { strcat(outf3,"dcr"); ofstr[0]=flct+'0'; strcat(outf3,ofstr);}169strcat(outf3,".nr");170ip=fopen(outf3,"r"); fscanf(ip,"%d",&ncp);171printf("Computing orbits of con perms from %s.\n",outf3);172}173printf("Computing dcreps.\n");174if (len[1]!=1) printf("Warning. Orb of 1 is greater than one.\n");175nntb=0; for (i=fnt;i!= -1;i=fpt[i]) nntb++;176lcp=cp; ip=fopen(temp2,"r"); op=fopen(outf2,"w");177fprintf(op,"%4d %3d%4d%4d\n",npt,ndcr,0,0);178for (rep=2;rep<=ind;rep++) if ((lorb=len[rep])>0)179{ ucp=lcp-1;180for (bno=fnt;bno!= -1;bno=fpt[bno])181{ fscanf(ip,"%d",&inch);182if (expg) { q=svgptr[bno][inch]; if (q!=stop) {ucp++; *ucp=q;} }183else addsvf(inch,svgptr[bno]);184}185if (npt>=1000)186for (i=1;i<=npt;i++) fprintf(op,"%5d",image(i));187else for (i=1;i<=npt;i++) fprintf(op,"%4d",image(i));188fprintf(op," %4d\n",lorb);189}190else for (i=1;i<=nntb;i++) fscanf(ip,"%d",&inch);191fclose(op); fclose(ip); unlink(temp2);192}193/* If we are keeping the converted permutations, then invert them, to194get action on right cosets195*/196if (hg && dcr==0)197{ ip=fopen(temp1,"r"); op=fopen(outf1,"w");198fscanf(ip,"%d%d",&i,&ncp); while ((c=getc(ip))!='\n');199if (triv) fprintf(op,"%4d%4d%4d%4d\n1\n",ind,ncp,1,0);200else fprintf(op,"%4d%4d%4d%4d\n",ind,ncp,0,0);201for (i=1;i<=ncp;i++)202{ for (j=1;j<=ind;j++) {fscanf(ip,"%d",&k); tree[k]=j;}203for (j=1;j<=ind;j++) fprintf(op," %3d",tree[j]); fprintf(op,"\n");204}205fclose(ip); fclose(op);206unlink(temp1);207}208return(0);209}210211212