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: 418346/****************************************************************************1**2*A eliminate.c ANUPQ source Eamonn O'Brien3**4*Y Copyright 1995-2001, Lehrstuhl D fuer Mathematik, RWTH Aachen, Germany5*Y Copyright 1995-2001, School of Mathematical Sciences, ANU, Australia6**7*/89#include "pq_defs.h"10#include "pcp_vars.h"11#include "pq_functions.h"1213/* eliminate all redundant generators to construct the consistent14power commutator presentation for the group to class current_class;1516if middle_of_tails is TRUE, do not delete space set aside in17setup; in this case, only deallocate redundant generators */1819void eliminate(Logical middle_of_tails, struct pcp_vars *pcp)20{21register int *y = y_address;2223register int i;24register int j;25register int k;26register int l;27register int p1;28register int ba;29register int lg;30register int length;31register int bound;3233register int structure = pcp->structure;34register int current_class = pcp->cc;35register int lused = pcp->lused;36register int prime = pcp->p;37register int dgen = pcp->dgen;38register int ndgen = pcp->ndgen;39register int pointer;40register int value;4142#include "access.h"4344/* calculate new values for irredundant generators and set them up45in a renumbering table of length pcp->lastg - pcp->ccbeg + 146which looks to compact like a normal exponent-generator string47pointed to by y[dgen] */4849if (current_class != 1) {5051if (is_space_exhausted(pcp->lastg - pcp->ccbeg + 3, pcp))52return;5354structure = pcp->structure;55lused = pcp->lused;56y[lused + 1] = dgen;57y[dgen] = -(lused + 1);58y[lused + 2] = pcp->lastg - pcp->ccbeg + 1;59ba = lused + 3 - pcp->ccbeg;60pcp->lused += pcp->lastg - pcp->ccbeg + 3;61lused = pcp->lused;62lg = pcp->ccbeg - 1;63for (i = pcp->ccbeg, bound = pcp->lastg; i <= bound; i++) {64y[ba + i] = 0;65if (y[structure + i] > 0)66y[ba + i] = ++lg;67}6869/* update pcp->first_pseudo */70bound = pcp->lastg;71for (i = pcp->first_pseudo; i <= bound && y[structure + i] <= 0; i++)72;73pcp->first_pseudo = (i > pcp->lastg) ? lg + 1 : y[ba + i];7475/* update the commutator tables */76p1 = y[pcp->ppcomm + 2];77for (i = 1, bound = pcp->ncomm; i <= bound; i++) {78update(p1 + i, pcp);79if (pcp->overflow)80return;81}8283/* update the power tables */84for (i = 2, bound = pcp->ccbeg; i <= bound; i++) {85/* fix (i - 1)^p */86update(pcp->ppower + i - 1, pcp);87if (pcp->overflow)88return;89}9091/* update the redundant defining generators and inverses */92for (i = 1; i <= ndgen; i++) {93update(dgen + i, pcp);94if (pcp->overflow)95return;96update(dgen - i, pcp);97if (pcp->overflow)98return;99}100101/* finally update and move structure information */102103if (middle_of_tails) {104pointer = pcp->structure + pcp->ccbeg - 1;105for (i = pcp->ccbeg; i <= pcp->lastg; ++i) {106if ((value = y[pcp->structure + i]) > 0)107y[++pointer] = value;108else if (value < 0)109y[-value] = 0;110}111} else {112k = pcp->ppower;113structure = pcp->structure;114for (i = pcp->lastg; i >= pcp->ccbeg; i--) {115if ((j = y[structure + i]) > 0) {116y[k] = j;117k--;118} else if (j < 0) {119/* deallocate equation for redundant generator i */120p1 = -j;121y[p1] = 0;122}123}124125for (; i > 0; i--)126y[k--] = y[structure + i];127if (pcp->subgrp != structure)128delete_tables(0, pcp);129pcp->structure = k;130structure = pcp->structure;131pcp->words = k;132pcp->subgrp = k;133pcp->submlg = pcp->subgrp - lg;134}135136pcp->lastg = lg;137y[pcp->clend + current_class] = pcp->lastg;138139/* deallocate the renumbering table */140p1 = -y[dgen];141y[p1] = 0;142return;143}144145/* class 1 */146147pcp->lastg = 0;148for (i = 1; i <= ndgen; i++) {149if ((j = y[structure + i]) == 0) {150/* defining generator i is trivially redundant */151y[dgen + i] = 0;152if (y[dgen - i] < 0) {153/* deallocate old inverse */154p1 = -y[dgen - i];155y[p1] = 0;156/* set new inverse trivial */157y[dgen - i] = 0;158}159} else if (j < 0) {160/* defining generator i is redundant with value pointed161to by -y[structure + i] */162y[dgen + i] = y[structure + i];163p1 = -y[dgen + i];164length = y[p1 + 1];165y[p1] = dgen + i;166167/* renumber value of defining generator i */168for (k = 1; k <= length; k++) {169l = FIELD2(y[p1 + k + 1]);170y[p1 + k + 1] += y[dgen + l] - l;171}172173if (y[dgen - i] < 0) {174/* i inverse occurs in a defining relation, so recompute175the inverse and set up header block for inverse */176y[lused + 1] = dgen - i;177y[lused + 2] = length;178179/* set up inverse */180for (j = 1; j <= length; j++) {181k = y[p1 + j + 1];182y[lused + 2 + j] = PACK2(prime - FIELD1(k), FIELD2(k));183}184185/* deallocate old inverse */186p1 = -y[dgen - i];187y[p1] = 0;188y[dgen - i] = -(lused + 1);189pcp->lused += length + 2;190lused = pcp->lused;191}192} else {193/* i is an irredundant generator */194pcp->lastg++;195y[dgen + i] = pcp->lastg;196/* note that its weight is set to be 1 */197y[structure + pcp->lastg] = PACK3(1, 0, i);198199/* check if inverse of i is required */200if (y[dgen - i] < 0) {201/* yes, so renumber previously set up inverse */202p1 = -y[dgen - i];203y[p1 + 2] += pcp->lastg - i;204}205}206}207208if (pcp->lastg < 1) {209text(7, prime, 0, 0, 0);210pcp->complete = 1;211pcp->cc = 0;212} else {213y[pcp->clend + 1] = pcp->lastg;214pcp->submlg = pcp->subgrp - pcp->lastg;215}216}217218219