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 collect_word.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"12#include "constants.h"13#include "word_types.h"1415/* collect word in pcp generators of group; word has base address ptr;16set up the result as exponent vector with base address cp */1718void collect_word(int ptr, int cp, struct pcp_vars *pcp)19{20register int *y = y_address;2122int temp;23int gen, exp;24register int i;25register int lastg = pcp->lastg;26register int length = y[ptr];2728/* zero out lastg entries in array in order to store result */29for (i = 1; i <= lastg; ++i)30y[cp + i] = 0;3132/* collect the word */33for (i = 2; i <= length; ++i) {34if ((gen = y[ptr + i]) > 0)35collect(gen, cp, pcp);36else37invert_generator(-gen, 1, cp, pcp);38}3940/* now calculate the appropriate power of the collected part */41if ((exp = y[ptr + 1]) != 1) {42temp = ptr + y[ptr] + 1;43calculate_power(exp, temp, cp, pcp);44}45}4647/* calculate the exp power of word stored as exponent-vector at cp;48ptr is index of free position for temporary storage in y */49void calculate_power(int exp, int ptr, int cp, struct pcp_vars *pcp)50{51register int *y = y_address;5253register int i;54register int lastg = pcp->lastg;5556power(abs(exp), cp, pcp);5758/* if necessary, calculate the inverse */59if (exp < 0) {60++ptr;61vector_to_word(cp, ptr, pcp);62for (i = 1; i <= lastg; ++i)63y[cp + i] = 0;64invert_word(ptr, cp, pcp);65}66}6768/* collect a word in pcp generators which may be already stored69or is read in as string with base address ptr; store the result70as an exponent vector at cp; convert exponent vector71to string with base address ptr; and print out result */7273void setup_word_to_collect(74FILE *file, int format, int type, int cp, struct pcp_vars *pcp)75{76int disp = pcp->lastg + 2;77register int ptr;7879ptr = pcp->lused + 1 + disp;8081if (type != FIRST_ENTRY && type != NEXT_ENTRY) {82if (format == BASIC)83read_word(file, disp, type, pcp);84else85pretty_read_word(file, disp, type, pcp);86}8788collect_word(ptr, cp, pcp);8990if (type == VALUE_A || type == VALUE_B || file != stdin)91return;9293setup_word_to_print("result of collection", cp, ptr, pcp);94}959697