/** * Sets the state of the generator to values produced by * a \minstd_rand0 generator. */ BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(lagged_fibonacci_engine, UIntType, value) { minstd_rand0 intgen(static_cast<boost::uint32_t>(value)); detail::generator_seed_seq<minstd_rand0> gen(intgen); seed(gen); }
BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(subtract_with_carry_engine, IntType, value) { typedef linear_congruential_engine<uint32_t,40014,0,2147483563> gen_t; gen_t intgen(static_cast<pdalboost::uint32_t>(value == 0 ? default_seed : value)); detail::generator_seed_seq<gen_t> gen(intgen); seed(gen); }
void seed(uint32_t value = 331u) { minstd_rand0 intgen(value); seed(intgen); }
spact() /* Computes cohomology group H^i(P,M) or H^i(Q,M) */ { int i,j,k,l,m,n,ie,ct,cl,fg,wi,wj,*p,*q,*r,*nrpf,*v1,*v2, **swop,homcl,c; char inp; inp= (ch1 && act) ? 0 : 1; /* inp as in calcfm in case ch1 */ if (ingp(inp) == -1) return(-1); if (ch1 && act) { inf3offset=ftell(ip); fclose(ip);} ct=ngens; j=exp; for (i=1;i<=dim;i++) { j++; wt[j]=swt[i]; d1[j]=(sd1[i]>0) ? sd1[i]+exp : 0; d2[j]=sd2[i]; } printf("Computing matrices.\n"); /* Matrices for all pcp gens of P or Q are now computed */ if (maxm<2*facexp) { fprintf(stderr,"Not enough mat space. Increase MSP (of MV or MM).\n"); return(-1); } for (i=facexp;i>=1;i--) if (wt[i]==1) { if (i>ct) { swop=mat[i]; mat[i]=mat[ct]; mat[ct]=swop; for (j=1;j<=dim;j++) if (d2[exp+j]==ct) d2[exp+j]=i; } inv(mat[i],mat[facexp+i]); ct--; } if (ct!=0) {fprintf(stderr,"No of pgens wrong.\n"); return(-1); } for (i=2;i<=facexp;i++) if (wt[i]>1) { p= (d1[i]==d2[i]) ? *powptr[d1[i]] : *(comptr[d1[i]]+d2[i]); q=p+ *p-2; *cp=0; while (--q>p) { k= *(q+1); for (j=1;j<=k;j++) cp[++(*cp)]= *q+facexp; q--; } if (d1[i]==d2[i]) for (j=1;j<=prime;j++) cp[++(*cp)]=d1[i]; else { cp[++(*cp)]=d1[i]+facexp; cp[++(*cp)]=d2[i]+facexp; cp[++(*cp)]=d1[i]; cp[++(*cp)]=d2[i]; } prod(cp,mat[i]); inv(mat[i],mat[i+facexp]); } if (act==0) { op=fopen(outf2,"w"); fprintf(op,"%3d%3d%3d\n",prime,dim,facexp); for (i=1;i<=facexp;i++) printmat(mat[i]); fclose(op); } printf("Computing full pcp.\n"); /* pcp of P or Q in dual action on module is computed from the matrices. */ v1=mat[facexp+1][1]; v2=mat[facexp+1][2]; for (i=1;i<=dim;i++) v1[i]=0; ie=exp; for (i=1;i<=dim;i++) { if (i>1) v1[i-1]=0; v1[i]=1; ie++; for (j=1;j<=facexp;j++) if (comm(v1,v2,mat[j])) { *(comptr[ie]+j)=rpf+1; nrpf=rpf+2; l=0; for (k=1;k<=dim;k++) if ((m=v2[k])!=0) { *(nrpf++)=k+exp; *(nrpf++)=m; l+=2; } *(rpf+1)=l; m= *(nrpf-2); if (d1[m]==ie && d2[m]==j) *rpf=m; else *rpf=0; rpf=nrpf; } } if (ch1==0) { printf("Computing P-homs.\n"); fflush(stdout); homcl=0; /* Hom-P(FM,M) will now be computed as dual of tensor product, using NQA */ if (matcl+1>=mcl) { fprintf(stderr,"Class too big. Increase MCL.\n"); return(-1); } for (cl=matcl+1;cl>1;cl--) { printf("cl=%d.\n",cl); for (fg=facexp+1;dpth[fg]==1 && fg<=exp;fg++) for (i=exp+1;i<=exp+dim;i++) if (wt[i]+1==cl) { if (intgen(i,fg)== -1) return(-1); if ((k=wt[i]+wt[fg])>homcl) { homcl=k; if (homcl+1>=mcl) { fprintf(stderr,"Class too big. Increase MCL.\n"); return(-1); } } } while (fg<=exp) { for (i=exp+1;i<=exp+dim;i++) if (wt[i]+dpth[fg]==cl) { if (dpth[d1[fg]]==dpth[fg]-1) { if (assoc(i,d1[fg],d2[fg])) if (subrel(i,fg)== -1) return(-1); } else if (intgen(i,fg)== -1) return(-1); if ((k=wt[i]+wt[fg])>homcl) { homcl=k; if (homcl+1>=mcl) { fprintf(stderr,"Class too big. Increase MCL.\n"); return(-1); } } } fg++; } for (i=1;i<=facexp;i++) { wi=wt[i]; for (j=facexp+1;j<=exp;j++) { wj=dpth[j]; if (wi+wj>=cl) break; for (k=exp+1;k<=exp+dim;k++) if (wi+wj+wt[k]==cl) if (assoc(k,j,i)) { if ((l=prnrel())==0) goto nextcl; if (l== -1) return(-1); } } } nextcl:; } bgc(); rsp=rpb-rel+1; printf("Computing extensions. nng,homcl=%d,%d\n",nng,homcl); fflush(stdout); stage=2; onng=nng; chpdim=0; chsdim=0; extno=pcptr+ptrsp-onng-1; for (i=1;i<=nng;i++) extno[i]=0; } else { stage=4; printf("Computing first cohomology group.\n"); homcl=matcl; if (homcl+1>=mcl) { fprintf(stderr,"Class too big. Increase MCL.\n"); return(-1); } } /* H^2 or H^1 will now be computed */ for (cl=homcl+1;cl>=2;cl--) { printf("cl=%d\n",cl); if (cl<=matcl+1) { for (i=1;i<=facexp;i++) if (wt[i]==1) for (j=exp+1;j<=exp+dim;j++) if (wt[j]+1==cl) if (intgen(j,i)== -1) return(-1); for (i=1;i<=facexp;i++) { wi=wt[i]; if (wi>1) for (j=exp+1;j<=exp+dim;j++) if (wi+wt[j]==cl) if (assoc(j,d1[i],d2[i])) if (subrel(j,i)== -1) return(-1); } } for (i=1;i<=facexp;i++) for (j=i;j<=facexp;j++) for (k=exp+1;k<=exp+dim;k++) if ((i==j && wt[i]+1+wt[k]==cl) || (i!=j && wt[i]+wt[j]+wt[k]==cl)) if (assoc(k,j,i)) if (ch1) { if ((l=prnrel())==0) goto ncl; if (l== -1) return(-1); } else { l=prnrel(); if (l== -1) return(-1); if (l>1) nchg(); } ncl:; } if (ch1) printf("Cohomology grp has dim %d\n",nng); /* We now no longer need the data for Q in the back of rel. */ rpb=rel+rspk-1; if (act) { if (ch1) onng=nng; else unlink(outf1); } else { if (stage>2) {onng=nng; strcpy(outf1,outf0);} outgp(); if (ch1) { ipcopy=fopen(outf1,"r"); opcopy=fopen(outcopy,"w"); while ((c=getc(ipcopy))!= -1) putc(c,opcopy); fclose(ipcopy); fclose(opcopy); } } return(0); }