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 commute_dgen.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 "constants.h"12#include "pq_functions.h"13#include "pretty_filterfns.h"14#include "word_types.h"1516static void17collect_defining_generator_word(int ptr, int cp, struct pcp_vars *pcp);1819/* calculate a power of a left-normed commutator of supplied depth20by repeated calls to find_commutator; set up the result as an21exponent vector with base address pcp->lused in order to permit22the result to be handed to echelon easily; each component23is a defining generator */2425void commute_defining_generators(int format, struct pcp_vars *pcp)26{27register int *y = y_address;2829register int ptr, cp1, cp2, cp3, cp4, result;30register int lastg = pcp->lastg;31register int total;32int disp = 0;33int type;34int depth;35int exp;3637total = 6 * lastg + 6;38if (is_space_exhausted(total, pcp))39return;4041cp1 = pcp->submlg - lastg - 2;42cp2 = cp1 - lastg;43cp3 = cp2 - lastg;44cp4 = cp3 - lastg;45result = cp4 - lastg;46ptr = pcp->lused + 1;4748/* fudge the value of submlg because of possible call to power */49pcp->submlg -= total;5051read_value(TRUE, "Input number of components of commutator: ", &depth, 2);5253/* read in a and set it up at cp2 and cp3 */54type = FIRST_ENTRY;5556if (format == BASIC)57read_word(stdin, disp, type, pcp);58else59pretty_read_word(stdin, disp, type, pcp);6061collect_defining_generator_word(ptr, cp2, pcp);62copy(cp2, lastg, cp3, pcp);6364type = NEXT_ENTRY;65disp = y[ptr] + 1;6667while (--depth > 0) {6869/* read in next component, b, and set it up at cp1 and cp4 */70if (format == BASIC)71read_word(stdin, disp, type, pcp);72else73pretty_read_word(stdin, disp, type, pcp);7475collect_defining_generator_word(ptr + disp, cp1, pcp);76copy(cp1, lastg, cp4, pcp);7778/* solve the equation (ba) * x = ab to obtain [a, b] */79find_commutator(cp1, cp2, cp3, cp4, result, pcp);8081copy(result, lastg, cp2, pcp);82copy(result, lastg, cp3, pcp);83}8485read_value(TRUE, "Input required power of this commutator: ", &exp, 1);86power(exp, result, pcp);8788/* print the commutator */89setup_word_to_print("commutator", result, ptr, pcp);9091/* copy result to pcp->lused */92copy(result, lastg, pcp->lused, pcp);9394/* reset the value of submlg */95pcp->submlg += total;96}9798/* collect word in defining generators stored as string at99y[ptr] and place the result as exponent vector at cp */100101static void102collect_defining_generator_word(int ptr, int cp, struct pcp_vars *pcp)103{104register int *y = y_address;105106int i, generator, genval;107#if defined(DEBUG)108int j, word_len;109#endif110int length, exp;111register int lastg = pcp->lastg;112113/* zero out lastg entries in array in order to store result */114for (i = 1; i <= lastg; ++i)115y[cp + i] = 0;116117length = y[ptr];118for (i = 1; i < length; ++i) {119generator = y[ptr + 1 + i];120genval = y[pcp->dgen + generator];121122#if defined(DEBUG)123if (genval > 0)124printf("%d %d\n", generator, genval);125else if (genval < 0) {126printf("%d %d ", generator, y[-genval]);127word_len = y[-genval + 1];128for (j = 1; j <= word_len; ++j)129printf(" %d", y[-genval + 1 + j]);130};131if (genval == 0)132printf("No defining generator %d -- taken to be the identity\n",133generator);134#endif135136collect(genval, cp, pcp);137}138139/* calculate power of this word */140exp = y[ptr + 1];141power(exp, cp, pcp);142143#if defined(DEBUG)144print_array(y, cp, cp + pcp->lastg + 1);145#endif146}147148/* prepare to collect word in defining generators */149150void setup_defgen_word_to_collect(151FILE *file, int format, int type, int cp, struct pcp_vars *pcp)152{153int disp = pcp->lastg + 2;154register int ptr;155156ptr = pcp->lused + 1 + disp;157158if (format == BASIC)159read_word(file, disp, type, pcp);160else161pretty_read_word(file, disp, type, pcp);162163collect_defining_generator_word(ptr, cp, pcp);164165if (type == ACTION || file != stdin)166return;167168setup_word_to_print("result of collection", cp, ptr, pcp);169}170171172