int ingp(int inp) /* Input a group with pcp. Normally inp=1, and file inf1 is opened inside procedure. inp=0 when file is already open - i.e. when act=1, and pcp is the output from scrun.
*/
{ int i, j, k, l, sum, jump; short *orpf, **pcp, **pcpj, m; if (inp) {
ip = fopen(inf1, "r"); if (ip == 0) {
fprintf(stderr, "Cannot open %s\n", inf1); return (-1);
}
fscanf(ip, "%hd%hd%hd%hd%hd%hd", &prime, &exp, &facexp, &no, &class, &m); if (exp >= mexp) {
fprintf(stderr, "exp too big. Increase MEXP.\n"); return (-1);
} if (m != 0) {
fprintf(stderr, "Wrong version of nq.\n"); return (-1);
}
}
nng = 0;
sum = (stage == 2 || stage == 4) ? exp + dim : exp; if (inp) for (i = 1; i <= sum; i++)
fscanf(ip, "%hd", wt + i); if (stage < 2) { if (exp > facexp) for (i = 1; i <= exp; i++)
fscanf(ip, "%hd", dpth + i); else for (i = 1; i <= exp; i++)
dpth[i] = 0;
depth = dpth[exp];
} for (i = 1; i <= sum; i++)
fscanf(ip, "%hd", d1 + i); for (i = 1; i <= sum; i++)
fscanf(ip, "%hd", d2 + i); /* Now we start to read the pcp into rel, setting the commutator and power pointers comptr and powptr, as we go. Defs and powers [d[j],d[i]] and d[j]^p are only in the file for j<=no, so for the remaining ones we zero them. pcp is the current place of the pointer in array of pointers pcptr. opcb,pcb,npcb and npcb2 are externals used to record the values of pcp at various key places, for use in outgp and prnrel. Roughly, opcb=value of pcp at end of PCP of P itself. (=pcb when stage=0). pcb=value at end of definition of commutators in [d(M),P] (d(M)=dual of M). npcb=value at end. npcb2 is only used for ch1.
*/
rpf = rel;
rpb = rel + rsp - 1;
pcp = pcptr; for (i = 2; i <= no; i++) {
comptr[i] = pcp - 1 - tails;
m = (i > facexp) ? facexp : i - 1; for (j = 1; j <= m; j++) {
fscanf(ip, "%d%d", &k, &l); if (l == 0)
*(pcp++) = 0; else {
*(pcp++) = rpf + 1;
*(rpf++) = k;
*rpf = l;
orpf = rpf;
rpf += (l + 1); while ((++orpf) < rpf)
fscanf(ip, "%hd", orpf);
} if (tails)
*(pcp++) = 0;
}
} if (tails || no < facexp) for (i = no + 1; i <= exp; i++) {
comptr[i] = pcp - 1 - tails;
m = (i > facexp) ? facexp : i - 1; for (j = 1; j <= m; j++) {
*(pcp++) = 0; if (tails)
*(pcp++) = 0;
}
}
m = (no >= facexp) ? facexp : no; for (i = 1; i <= m; i++) {
powptr[i] = pcp;
fscanf(ip, "%d%d", &k, &l); if (l == 0)
*(pcp++) = 0; else {
*(pcp++) = rpf + 1;
*(rpf++) = k;
*rpf = l;
orpf = rpf;
rpf += (l + 1); while ((++orpf) < rpf)
fscanf(ip, "%hd", orpf);
} if (tails)
*(pcp++) = 0;
} for (i = no + 1; i <= facexp; i++) {
powptr[i] = pcp;
*(pcp++) = 0; if (tails)
*(pcp++) = 0;
} if (stage == 3)
no = exp; if (stage == 0)
pcb = pcp - 1; /* End of input of PCP of P */ else {
opcb = pcp - 1;
nd1 = d1 + exp + dim;
nd2 = d2 + exp + dim; if (stage == 2 || stage == 4) {
fscanf(ip, "%hd", &nng); for (i = 1; i <= nng; i++)
fscanf(ip, "%hd", nd1 + i); for (i = 1; i <= nng; i++)
fscanf(ip, "%hd", nd2 + i); if (stage == 4) {
jump = exp * dim;
pcpj = pcp + jump;
} else {
jump = 0;
pcpj = NULL;
}
} else {
jump = 0;
pcpj = NULL;
} for (i = exp + 1; i <= exp + dim; i++) {
comptr[i] = pcp - 1; if (stage == 4)
powptr[i] = pcpj - 1; for (j = 1; j <= exp; j++) if (stage == 3 || stage == 1)
*(pcp++) = 0; else {
fscanf(ip, "%d%d", &k, &l); if (l == 0)
*(pcp++) = 0; else {
*(pcp++) = rpf + 1;
*(rpf++) = k;
*rpf = l;
orpf = rpf;
rpf += (l + 1); while ((++orpf) < rpf)
fscanf(ip, "%hd", orpf);
} if (stage == 4) {
fscanf(ip, "%d%d", &k, &l); if (l == 0)
*(pcpj++) = 0; else {
orpf = rpb - l;
*(pcpj++) = orpf;
*(orpf - 1) = k;
*orpf = l; while ((++orpf) <= rpb)
fscanf(ip, "%hd", orpf);
rpb -= (l + 2);
}
}
}
}
pcb = pcp - 1; if (stage != 4 && stage != 2) for (i = exp + 1; i <= exp + dim; i++) {
powptr[i] = pcp - 1; for (j = 1; j <= facexp; j++)
*(pcp++) = 0;
} elseif (stage == 4)
pcp += jump;
npcb = pcp - 1;
npcb2 = npcb;
}
wsp = 0;
eexpnt = expnt + exp; if (stage)
eexpnt += dim;
enexpnt = nexpnt + nng; if (stage == 2) {
extno = pcptr + ptrsp - 1 - nng;
subno = extno - nng; for (i = 1; i <= nng; i++) {
extno[i] = 0;
subno[i] = 0;
}
fscanf(ip, "%hd", &chpdim); for (i = 1; i <= chpdim; i++) {
fscanf(ip, "%d", &j);
extno[j] = rpf;
fscanf(ip, "%hd", rpf);
l = *rpf;
rpf++; for (j = 1; j <= l; j++) {
fscanf(ip, "%hd", rpf);
rpf++;
}
}
fscanf(ip, "%hd", &chsdim); for (i = 1; i <= chsdim; i++) {
fscanf(ip, "%d", &j);
subno[j] = rpf;
fscanf(ip, "%hd", rpf);
l = *rpf;
rpf++; for (j = 1; j <= l; j++) {
fscanf(ip, "%hd", rpf);
rpf++;
}
}
} if (pcp - pcptr > ptrsp) {
fprintf(stderr, "Not enough pointer space. Increase PTRSP.\n"); return (-1);
} if (rpf - rel > rsp) {
fprintf(stderr, "Not enough space. Increase RSP.\n"); return (-1);
} if (inp)
fclose(ip); return (0);
}
int outgp(void) /* A group is output to outf1 */
{ int i, k, l, sum, nexp, jump; short **pcp, *b, *c, *e, *f, **pcpj; char jtl;
op = fopen(outf1, "w");
sum = (stage) ? exp + dim : (tails) ? exp + nng : exp; if (tails)
no = exp;
nexp = stage ? exp : sum; class = 1; for (i = 1; i <= sum; i++) if (wt[i] > class) class = wt[i];
fprintf(op, "%3d %5d %4d %5d %3d%3d\n", prime, nexp, facexp, no, class, 0); for (i = 1; i <= sum; i++)
fprintf(op, " %3d", wt[i]);
fprintf(op, "\n"); if (stage == 0) { for (i = 1; i <= sum; i++)
fprintf(op, " %3d", dpth[i]);
fprintf(op, "\n");
} for (i = 1; i <= sum; i++)
fprintf(op, " %3d", d1[i]);
fprintf(op, "\n"); for (i = 1; i <= sum; i++)
fprintf(op, " %3d", d2[i]);
fprintf(op, "\n");
jtl = 0;
pcp = pcptr;
e = NULL; while (pcp <= pcb) {
b = *pcp;
c = tails ? *(pcp + 1) : 0; if (b != 0) {
k = *(*pcp - 1);
l = **pcp;
e = b + l;
} else {
k = 0;
l = 0;
} if (c != 0) {
l += *c;
f = c + *c;
} if (k == 0 && l == 0)
fprintf(op, "%d %d", 0, 0); else
fprintf(op, "%3d %3d", k, l); if (b != 0) while (++b <= e)
fprintf(op, " %3d", *b); if (c != 0) while (++c <= f) {
fprintf(op, " %3d", *c + exp);
fprintf(op, " %3d", *(++c));
} if (jtl) { for (i = 1; i <= 10 - l; i++)
fprintf(op, " "); if (l == 0)
fprintf(op, " ");
pcpj++;
b = *pcpj; if (b != 0) {
l = *b;
k = *(b - 1);
} else {
k = 0;
l = 0;
}
e = b + l;
fprintf(op, "%3d %3d", k, l); while (++b <= e)
fprintf(op, " %3d", *b);
}
fprintf(op, "\n"); if (stage && pcp == opcb) {
fprintf(op, " %3d\n", onng); for (i = 1; i <= onng; i++)
fprintf(op, " %3d", nd1[i]);
fprintf(op, "\n"); for (i = 1; i <= onng; i++)
fprintf(op, " %3d", nd2[i]);
fprintf(op, "\n"); if (stage == 4) {
jump = dim * exp;
pcpj = pcp + jump;
jtl = 1;
}
}
pcp += (1 + tails);
} if (stage == 2) {
fprintf(op, "%3d\n", chpdim); for (i = 1; i <= onng; i++) if ((b = extno[i]) != 0) {
fprintf(op, "%3d %4d", i, *b);
c = b + *b; while (++b <= c)
fprintf(op, " %3d", *b);
fprintf(op, "\n");
}
fprintf(op, "%3d\n", chsdim); if (chsdim != 0) for (i = 1; i <= onng; i++) if ((b = subno[i]) != 0) {
fprintf(op, "%3d %4d", i, *b);
c = b + *b; while (++b <= c)
fprintf(op, " %3d", *b);
fprintf(op, "\n");
}
}
fclose(op); return (0);
}
void zero(short * p1, short * p2)
{ while ((++p1) <= p2)
*p1 = 0;
}
void setnr(short * p) /* Really a subprocedure of collect. Adjusts nexpnt by fac times string p. */
{ short *p1, *p2;
p1 = p + *p; while (++p < p1) {
p2 = nexpnt + *p;
*p2 += (fac * *(++p));
*p2 %= prime;
}
}
int collect(short * spc, short * spf, int sgn) /* The basic collection routine. Taken basically from Canberra NQA. There are several complications. 1) The basic word is collected into an exponent vector expnt[1-exp], but collection also generates terms in the new generators, 1-nng. These are all central, and these terms come from the tails in the PCP. They are collected in the vector nexpnt. The procedure setnr is always used for this. 2) Negative powers can occur in the string to be collected. 3) Generators i with i>exp are generators of d(M). These do not need to be collected themselves; they are only there to generatoe terms in nng. They are not accumulated in expnt, but dealt with in blocks, as they occur. 4) Generators i of P with i>facexp form an elementary abelian group. It saves time (particularly for larger primes) to use this fact when collecting
*/
{ short gen, ex, pgen, pex, pugen, stkp, exsgn, *e, *p1, *p2, *p3, *p4, **dp,
i, j, fpg, fpex, *p0, *pe, *q; char done;
stkp = 0;
pgen = 0;
pex = 0;
pugen = 0;
exsgn = 1;
powdone:
pgen = spgen[stkp];
spc = sspc[stkp];
spf = sspf[stkp];
pex = spex[stkp];
pugen = abs(spugen[stkp]);
ex--; if (ex == 0) { if (spc == spf) {
stkp--; if (stkp == 0) return (0);
gen = sgen[stkp];
ex = sex[stkp]; if (pex == -1) goto powdone;
spc = sspc[stkp];
spf = sspf[stkp];
pugen = spugen[stkp]; goto loop;
} else { if (spc < spf) {
spc += 2;
gen = *spc;
ex = -*(spc + 1);
} else {
spc -= 2;
gen = *spc;
ex = *(spc + 1);
}
sgen[stkp] = gen;
sspc[stkp] = spc;
sex[stkp] = ex;
pugen = pgen; goto loop;
}
} else { if (pugen > pgen) {
pgen = pugen;
pex = expnt[pgen];
}
sex[stkp] = ex; goto loop;
}
}
void setpinv(void)
{ short i, j; for (i = 0; i < prime; i++)
pinv[i] = 0; for (i = 1; i < prime; i++) if (pinv[i] == 0) for (j = 1; j < prime; j++) if (i * j % prime == 1) {
pinv[i] = j;
pinv[j] = i; break;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.