|
|
|
|
Quellcode-Bibliothek straight.gi
Sprache: Shell
|
|
#############################################################################
##
## This file is part of GAP, a system for computational discrete algebra.
## This file's authors include Thomas Breuer, Alexander Hulpke, Max Neunhöffer.
##
## Copyright of GAP belongs to its developers, whose names are too numerous
## to list here. Please refer to the COPYRIGHT file for details.
##
## SPDX-License-Identifier: GPL-2.0-or-later
##
## This file contains the implementations of methods and functions
## for straight line programs.
##
## 1. Functions for straight line programs
## 2. Functions for elements represented by straight line programs
##
#############################################################################
##
## 1. Functions for straight line programs
##
#############################################################################
##
#V StraightLineProgramsFamily
#V StraightLineProgramsDefaultType
##
return
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
"
NewType(java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 31
0 #
##
#############################################################################
##
#F StraightLineProgram( <lines>[, <nrgens>] )
#F StraightLineProgram( <string>, <gens> )
#F StraightLineProgramNC( <lines>[, <nrgens>] )
#F StraightLineProgramNC( <string>, <gens> )
##
InstallGlobalFunction( java.lang.StringIndexOutOfBoundsException: Range [0, 38) out of bounds for length 31
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ifnot IsStraightLineProgram( result j:= i+2;
or not IsInternallyConsistent( result ) then
;
fi;
return result;
end=1;
InstallGlobalFunction( StraightLineProgramNC, function( arg )
local lines, nrgens, prog;
# Get the arguments.-;
if Length( arg ) = 1 and =1java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
sexp 10* 0123456789" java.lang.StringIndexOutOfBoundsException: Range [64, 63) out of bounds for length 73
elif Lengthod;
if notStringToStraightLineProgram(
:[;
if not StringToStraightLineProgramjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 29
return fail;
fi # ,
nrgens:= Length##In( java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 30
arg
lines := arg[1];
string[j.len] script
else
Error( "usage: java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 31
fi java.lang.StringIndexOutOfBoundsException: Range [7, 1) out of bounds for length 54
prog:= rec();
ributes prog, java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 60
lines ;
if fijava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
(prog java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
fi;
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 16
end
#############################################################################
##
j:= Length( script ) + Length( gens );
##
lines := arg[1
( , +. }
([2] java.lang.StringIndexOutOfBoundsException: Range [52, 53) out of bounds for length 52
len,
ppos <
nrgens java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 32
slen,
open,
i,;
# If the string contains `*' signs then remove them.
*string
string:= Filtered( string, java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 0
fi;else
# Split the string according to brackets `(' and `)'
java.lang.StringIndexOutOfBoundsException: Range [6, 1) out of bounds for length 9
java.lang.StringIndexOutOfBoundsException: Range [57, 55) out of bounds for length 65
# Simply create a word.
fi
returnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#M NrInputsOfStraightLineProgram( <prog> )
if pos = ## If no lines of type 1. java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 2
## program the entry is accessed but the position has not been assigned
##
if <and pos ^
exp for
=1
ope,
if pos <
: ;
pos:= pos + 1;
# list of currently assigned positions
while ,#
exp: len,#java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
= 1java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 26
;
exp:= sign * exp;
exp:= # Simply create a word.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
fi;
Append( extrep, [ ppos, exp ()
{[ . java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
od
if)
Add( script (line , .( 1] ,
fi;
return true;
elif 1 < pos then
# Split before the bracket.
if not:= 0java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
;
if () ;
fi;
j: MaximumList java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 39
: java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
exp=expjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
return (extrep,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
fi;
slen
i
Add( script, [ (odjava.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 9
fijava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
return true;
else
# Find the corresponding closing bracket.fijava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
open:= 0;
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
len
in string{[1 .-]} ens )
=open1java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
adjust( j;
if 0 < open java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 0
open:= java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
else
# The bracket may be powered or be multiplied.
if i+M :=Length(script )##
exp:= 0;
(,r)
sign
-then
j:= : [1]]java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
fi;
while;
exp:= 10 * exp in , . ) java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
;
od;
not java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 37
string{ [ 2 .. i-1 ] }else
falsejava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
;
:= java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
Add( script, [ [ slen - 1, sign * java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 26
if < len then
if not "for a straight line program
string{ [ j .. len [,IsHomogeneousListjava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
return :+;
fi;
j=Length(script Length( ;
Add sign=-;
fi;
else
if not while j <= len and IsDigitChar]
[ ..-:java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 19
fi;
j:= Length { . 1 ,
not java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 17
string{ [ i+1 =(java.lang.StringIndexOutOfBoundsException: Range [14, 1) out of bounds for length 64
return false
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
slen=( + Length( ;
if j < slen then
( ,[[j 1,,1] + 1 ;
j:=Length script )+ ( gens)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
;
return true;
fi;
fi;
;
return false;
fi;
end );
#############################################################################
##
#M NrInputsOfStraightLineProgram( <prog> )
##
## If no lines of type 1. occur then the number of generators can be
## read off from the lines;
## it is equal to the maximum of positions such that in a step of the
## program the entry is accessed but the position has not been assigned
## before.
##
InstallMethod#
"forInstallMethod( Display,
,
function( prog )
,# list of currently assigned positions
maxinput, # current maximum of input needed
lines return;
len, # length of `lines'
adjust, # local function to increase the number
line, # one line of the program
i, j; # loop over the lines
defined: java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
=0;
lines:= ## If no lines of java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 19
len: i,
adjust:= function( line #len,
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
needed:= "java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
)
( )then
#
if java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 33
maxinput:= needed;
fi;
fi;
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
# Inspect the lines.
for i , java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
line:= lines[i];
ForAll java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
ifPrint(r" java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 40
: )
else
Error < aof1")
fi;
elif Length( linePrint("";
adjust( line[1] ); j: Length line )
AddSet( defined, line[2] );
elif i = len and ForAll( line, IsList ) then
for jif[]< 1 if not IsEmpty( needed
adjust( j );
;
fi;
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
return maxinput;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
#############################################################################
##
#M ResultOfStraightLineProgram( <prog>, <gens> )
##
BindGlobal",
function( line java.lang.StringIndexOutOfBoundsException: Range [0, 7) out of bounds for length 0
local new, i;
: [1 ]java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
if line[2] <> 1 then
new:= new^line[2];
fi;
for [,6 .java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 42
if line[i] = 1 then
new:= new * r[
else
r[ - od;
fi;
od;
return new;
end od;
,
"for a java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
[ end java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
function( prog, PrintLine( line[;
local r, ( "java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 48
,#java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
line; # loop over the lines
# Initialize the list of intermediate results.
: line2;
respos:= falsejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
:r 1 java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 56
# The line describes a word to be appended.;
, line,len java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 29
j do
2<=Length(line )and IsInt(line , ;
#java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
r ] java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 35
respos:= Print( " ]\n
java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 0
# The line describes a list of words to be returned.
return \[ ,] java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
fi;
od##
# Return the result.
# Initialize
end );
#############################################################################
##
#M Display( <prog> )
#M Display( <prog>, <record> )
##
InstallMethod( java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
"java.lang.StringIndexOutOfBoundsException: Range [10, 8) out of bounds for length 14
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
( )java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
fi;java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
InstallOtherMethod
<java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 56
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 32
function( prog, record java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 19
testline= java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 31
listname
i,
lines,
len,
line,
j;
# Get and check the arguments.
fijava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
gensnames: .gensnames;
else
gensnamesifnot(,
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 21
fi
if IsBound( # If the number of generators is stored then check
listname:= recordd return not IsBound( java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 0
listname:= := )
fi
PrintLine :=[java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
for jin[2 4. (line)- ]do
Print( "r[", java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 0
if line
Print( " not()f a java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 48
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
function,java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
od;
j:= Length( line );
if < then
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
,
;
fi;
fi;
end;
# Print the initialisation.
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 8
Print( listname, ":= [ " );
if fi;
Print(gensnames])java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
fi;
for i in [ 2 ;
[])java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
od;
Print ]\listname: ""
# Loop over the lines.
lines:= LinesOfStraightLineProgram(PrintLine := function( line )
len:= Length( return(line testline);
Print( "# program:\n" );
fjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
line:= lines[i];
if Length( line ) if [j < 1then
and IsPosInt( line[2 fi;
Print( "r[", line[2], " ;
PrintLine( line[1] j: Length(#
Print( ";\n if 0 <jthen
# Print( "r[", line[ j-1 ], "]" );
len:= line if [j] for straightline ,
fi;
elif not IsEmpty( line ) and function(prog java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
: +;
Print( r" len, ]:")
PrintLine( line );
Print(Print, ("input\ );
elif ForAll( Print( listname, " ");
Print( java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
len
for j in [M ViewObj( <prog> )Print " " gensnames[##
;n" )java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
# Loop over .
od;
if lines: (prog)
PrintLine [)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
fi;
"]n")java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
return;
fi;
od;
Print( "# return value:\nr[", len, "]\n" );
end##
#############################################################################
##
#M IsInternallyConsistent( <prog> )
##
]
function( prog )
ilen2or=( java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
defined,
testline,
,
i
line;
lines:= LinesOfStraightLineProgram( prog ) if Print(r, ":";
ifPrintLine )
Print ;n java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
;
if Print( "# return:n[ )
nrgens=NrInputsOfStraightLineProgramprog ;
defined:= [ 1 . for jin 1.len-1]do
else
defined:= ( new,' ;
fi;
testline:=PrintLine(ine[];
local len, gens;
# The external representation of an associative word has even length,
if then
lenmod <0 then
return false;
fi;
Add( new, '}' );
gens:= line{ [ 1, 3 . ;
if not ForAll ;
return Print( "# return:nr" ]n")java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
fi#############################################################################
# If the number of generators is stored then check
# that only defined positions are accessed.
return not IsBound( linejava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
endnrgensjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
len:= Length( java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 14
for i in [ 1 .. len ] do
line:= lines[i];
if not IsList)orjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 0
return;
elif not elif not IsEmpty
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
returnfalse;
fi;
AddSet( defined, Length( and IsListIsListdefined=[ . ]
Length )=
not(IsList line[1] )andForAll line[1] IsInt )
return false;
fi;
if
fi ( java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
elif i =java.lang.StringIndexOutOfBoundsException: Range [0, 11) out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 39
return(line )
else
# The syntax of the line is not correct.
return false;
fi;
return true;
endlen: ;
#############################################################################
##
#M PrintObj( <prog> )
##
InstallMethod( PrintObj,
"ora false;
[ IsStraightLineProgram ],
not IsEmpty( )and ForAll lineIsInt
Print( "java.lang.StringIndexOutOfBoundsException: Range [0, 31) out of bounds for length 0
LinesOfStraightLineProgram ;
if HasNrInputsOfStraightLineProgram( prog ) then
Print( ", ", NrInputsOfStraightLineProgramfijava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
fi;
Print( " )" );
end)
#############################################################################
##
#M ViewObj( <prog> )
##
InstallMethod( ViewObj,
"for a straight line program", The line describes a word that shall replace.
[IsStraightLineProgram ]java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
elif =lenand , )java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
Print( "<straight line program>" );
end );
#############################################################################
##
#F StringOfResultOfStraightLineProgram( <prog>, <gensnames>[, \"LaTeX\"] )
##
BindGlobal( ;
function( line, r, isatomic, LaTeX )
local new, i;
new:= "";
for i java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 0
if line[i] = 1 then
Append (result,"]" )
ifjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
Add
od
Append( new, r[ line[ i-1java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
notjava.lang.StringIndexOutOfBoundsException: Range [29, 23) out of bounds for length 43
Add( new, ')' );
fi;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if LaTeX then
Add(new,'')
fi;
Append( new,
if LaTeX then
Add( new, '}' );
fi;
fi;
od;
InstallMethod ViewObj,
InstallGlobalFunction(java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 20
local prog,
gensnames,
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
r,
a,
respos,
resultifForAll( lastline,IsList# StringOfResultOfStraightLineProgram<> gensnames> \LaTeX"
l;
# Get and check the arguments.
if Length( arg ) = 2 and IsStraightLineProgram( arg[1] )
andIsList arg[2] )then
prog:= arg[1];
:= arg2;
LaTeX: ;
elif Length( arg ) = 3 and IsStraightLineProgram(if java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 9
and IsList( arg[else
and IsString( arg[3] )
and ;
prog:=arg[1];
gensnames:= arg[2];
LaTeX:= true;
ror("sageelse
"< max:= max=max')java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
fi;
# Initialize the list of intermediate results.;
;
a:= ListWithIdenticalEntries max:= max + 1;
respos:= false;
# Loop over the program.;
inLinesOfStraightLineProgram prog )do
if not IsEmpty( line new
# The line describes a word to be appended.
Add( r, StringOfResultOfLineOfStraightLineProgram( line,
r ,LaTeX ;
respos:= Length( r );
[ respos :
elif 2 <= Length( line ) and else
# The line describes a word that shall replace.
respos:= line[2];
r[ respos : java.lang.StringIndexOutOfBoundsException: Range [65, 63) out of bounds for length 73
,a,LaTeX )
a respos ] ifLength(lastline )= and IsList([])then
else
result:= "[ ";
for l the to position 1if .
Append( result,
StringOfResultOfLineOfStraightLineProgram( l,
r, a, LaTeX ) );
Append( result, ", " );
if not IsEmpty( linejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Remove( Store it at position 1.
Remove( result );
fi;
Append( result, " ]" );
return result;
fi;
od and LowercaseString#java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
prog= arg[1;
end );
#############################################################################
##
#F CompositionOfStraightLinePrograms( <prog2>, <prog1> )
##
nstallGlobalFunction, "ensnames[ \LaTeX"])");
function( prog2, prog1 )
local lines, len, lastline, inp2, max, i, pos, line;
lines:= ShallowCopy( LinesOfStraightLineProgram( prog1 ) );
es )java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
lastline (lines,line )
inp2 ( prog2 ;
if ForAll( lastline, IsList respos:= false;
# Check that the programs fit together.
if inp2 < NrInputsOfStraightLineProgramprog1 )
Error( "outputs of <prog1> incompatible with inputsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
fi;
# The last line is a list of external representations of assoc. words.##
# Copy them first to safe positions, then to the first positions.
max:= NrInputsOfStraightLineProgram## The idea is to concatenate the lists of lines of the programs in the list
for i in [ 1 .. len-1 ] do
if IsList( lines[i][1] ) then
:=#
else
max:=max + 1java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
fi;
od;
Unbind( lines[ respos: line[2];
pos:= [ respos ]= StringOfResultOfLineOfStraightLineProgram local'
for i in lastline do
max:= max + 1;
Add( lines nextoffset # maximal position used up to now
od;
for i in [ 1 .. Length( lastline ) ] do
Add( lines [[ pos+ i offset # maximal position used before the current program
od;
else
# Check that the programs fit together.
if inp2 <> 1 then
Error "utputs of prog1> incompatible with inputs of p> )java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
fi;
if (lastline)=2 or ( listofprogs )
# The line Append( result, ;
# word and a positive integer.Error("<istofprogs bea java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 54
# Copy the word to position 1 if necessary.
lastline2]<>1 then
Add(lines (java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 27
;
else
# The last line is the external representation of an assoc. word.
# Store it at position 1.
lines
fi;
fi;
function( prog2, prog1 )
max:= inp2;
:=(prog)
if java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
Add( lines, line );
elif ForAll( line, IsInt ) : nextoffset;
maxinp2: ( prog2;
Add( lines, [line, ax ] );
else
max:= Maximum( max, line[java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if ForAny proglines, line -> Length line of<rog2");
fi;
odjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
# Construct and return the new program.
return StraightLineProgramNC ( . [java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 75
=true
else
#############################################################################
##
#F IntegratedStraightLineProgram( <listofprogs> )
##
## The idea is to concatenate the lists of lines of the programs in the list
## <listofprogs> after shifting the positions they refer to.
## If a program overwrites some of the original generators then we first
## copy the generators.
##
(, java.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
function(
Check that the programs fit together.
if inp2 <
,# results line of the result program
nextoffsetfi
prog # loop over `listofprogs'
proglines, # list of lines of `prog'
offset, # maximal position used before the current program
shiftgens, # use a copy of the original generators
i, line, # loop over `proglines'
, # line with shifted source positions
j # loop over the odd positions in `newline'
# Check the input.
if not IsDenseList(
or IsEmpty( listofprogs )
#Thelast is theexternal representationof an . wordjava.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
ogsm alist"
"of straight line programs" );
fi;
n=NrInputsOfStraightLineProgram( listofprogs1 ;
java.lang.StringIndexOutOfBoundsException: Range [0, 6) out of bounds for length 0
prog in:
Error( "all in <listofprogs shiftgens or <[]
fi (lines ;
istof results theoffset.
lines:= [];
results:= [];
=n
#java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
for prog in listofprogs do
proglines:= LinesOfStraightLineProgram Add(lines,newline);
# Set the positions used up to here.
=;
# If necessary protect the original generators from being replaced,
# and work with a shifted copy.
shiftgens:= false;
if ForAny( # The line describes
IsList(line1 )
and ## If a program overwrites some of the original generators then we first
Append( , List([1. h( newline)-]do
nextoffset:= offset + n;
shiftgens:= true;
else
java.lang.StringIndexOutOfBoundsException: Range [25, 23) out of bounds for length 28
fi;
# Loop over the program.
line:= proglines[i];
i ,
# The line describes a word to be appended.
# (Increase the positions by `offset'.)
: (line ;
for j in [ 1, 3 .. Length( newline )-1 ] do
if shiftgens or n < newline[j] then
newline[j]:= newline[j] + offset;
fi;
;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Add( results, java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 2
else
Add(lines,newline )java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
nextoffset:= nextoffset + );
end;
elif =Length line )and java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
;
# (Increase the positions and the destination by `offset'.)
newline:= ShallowCopy( line[1] );
for j in [ 1,if (eeds)then
if shiftgens or n < newline[j] then
newline[j]:= newlinenextoffset:= n;
fi;
od;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
Add( results, newline );
else
newline: [ newline, line[2] #############################################################################
Add( lines, newline );
n
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
fi;
fi;
elseif(proglines,line-> (line )=2
# The line describes a list of words to be returned.
line:= List( line, ShallowCopy );
for newline =[1;
j , .(-]do
ifshiftgensor <newline[j]then
newline[j]:= newline[j] + offset;
fi;
od;
od;
Append results,line )java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
fi;
od;# Loop over the program.
],
# Add the results line.
Add ,results);
# Construct and return the new program.
return java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 0
);
#############################################################################
##
## 2. Functions for elements represented by straight line programs
##
#############################################################################
##
#M StraightLineProgElmType(<fam>)
##
InstallMethod(StraightLineProgElmType," One()java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
java.lang.StringIndexOutOfBoundsException: Range [14, 15) out of bounds for length 14
return NewType(fam,IsStraightLineProgElm);
end);
BindGlobal( "InverseSLPElm", function(slp)
##
#F StraightLineProgElm(<seed>,<prog>)
##
InstallGlobalFunction(StraightLineProgElm,unctionseeds,prog)
sr;
ifIsRecord(seeds)then
sr:=seeds;
seeds:sr.;
else
sr=ecs:=java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
;
return ((java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 0
#############################################################################
##
#F EvalStraightLineProgElm(<slpel>)
##
InstallGlobalFunction(EvalStraightLineProgElm,function(slpInstallMethod(nverseOp" ;
return ResultOfStraightLineProgram(slp![2
end);
#############################################################################
##
#F StraightLineProgGens(<gens>)
##
InstallGlobalFunction(StraightLineProgGens,function(arg)
local gens,sgens,seed;
gens:=arg[1];
sgens:=SetInstallMethod(,"java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 15
seed:=rec(seeds:=sgens);
if Length(arg)>1 and IsList(arg[2]) then
seed.base:=arg[java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 5
fi;
return List([1..Length(gens)], ( java.lang.StringIndexOutOfBoundsException: Range [0, 23) out of bounds for length 5
StraightLineProgramNC([[Position(sgens,gens[i]), return( ;
end);
#############################################################################
##
#M ViewObj(<slpel>)
##
#
[IsStraightLineProgElm]0,
functionjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
("";
ViewObj(LinesOfStraightLineProgram
)<50 thenInstallMethod(java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 66
Print("|");
ViewObj(EvalStraightLineProgElm(slp x*java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 5
fi;
Print(">");
end);
#############################################################################
##
#M OneOp(<slpel>)
##
InstallMethod(OneOp,"straight line program elements",true,
seeds=seeds;
function(slp)
return One(FamilyObj;
end(*" program elements",
#############################################################################
##
#M InverseOp(<slpel>)
##
local a,b
local a,,#
l:=ta,tb
l:Sl)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
n:=Length(##
# invert last
l[n]:=ERepAssWorInv(l[n]);
return StraightLineProgElmslp![],
StraightLineProgramNC(l,Length(slp![1seed=rec(eeds=);
end)
# words in fp elements have separate methods for `Inverse' and `InverseOp'
# -- so we must duplicate the installation here as well
InstallMethod(Inverse,"straight line
InstallMethod(java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 0
[IsStraightLineProgElm],0,java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 25
#############################################################################
##
#M Order(<slpel>)
##
InstallMethod(Order,"straight line program elements",true,
[IsStraightLineProgElm],
# we have to be better than specialized methods
10,
function(slpjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
return Order(aep:=Length(seed;
)
#############################################################################
##
#M \*
##
InstallMethod\*java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 2
[IsStraightLineProgElm,
tb:=[1..bejava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
()then return slp;fi;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
end);
InstallMethod(\* :=List.seeds,i# InverseOp(slpel>java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
sStraightLineProgElm],0,
function(x,slp)
if IsOne(x) then return slp;fi;
return x*EvalStraightLineProgElm(slp);
end);
#T this would be better recoded as variant of the substring algorithm in
#T steps of 2
"java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 37
local p;
p:=PositionSublist(a,b);
while IsInt(p) and IsInt(p/2) do
p:=PositionSublist(a,b,p);
od;
return p;
InstallMethod( .:Union
[,,
function([java.lang.StringIndexOutOfBoundsException: Range [26, 24) out of bounds for length 43
# this multiplication routine tries to find duplicate patterns. It
# implicitly assumes, however that the input is in some way ``reduced'' as
# an SLP.
local a,b,##
aep,bepInstallMethod(rder,straight program elements",true,
ta,tb, # new indices for old
tal,tbl, # up to this index, old and new indices are the same
la,lb, # lengths
laa,lba, # last entries absolute
ap,bp, # processing indices old
anpbnp, # ditto new
asn,, # lengths of original seeds
sbs # subset
l, # result list
else
i,j,k, # index
seed java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
seen, # nr of seeds in toto
e,s,java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
ei,slp)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
ble
found, # substring found?
laro, # flag when dealing with the last elements.
p; # position
seed:=aob![1];
#T thbe variantof the in
aep:=Length(seed.seeds);
b:=bob![1];
bep:=Length(b.seeds);
bsn:=Length(b.seeds);
ifseed,) then
# identical seeds -- easiest case
ta:=[1 p=(,b,;
tb:l[i:ejava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
elif IsSubset(seed.seeds,b.seeds) then
# b is a subset of a
ta:[1.aep;# translationof the numbers
tb:=List IsStraightLineProgElm]0
elif (.seeds,.seeds)then
# a is a subset of b
ta:=istseedseeds,i># implicitly assumes, however that the input is in some way ``reduced'' as
# an SLP.
seedb;
else
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
a:=seed;
seed: ,lb lengths
if IsBound(a.lmp) and IsBound(b.lmp) then
seed.lmp:=Maximum(a.lmp,b.lmp);
fi;
if IsBound(a.base) and IsBound(b.base) then
seed.base:=Union(a.base,b.base);
fi;
ta:=List(a.seeds,i->Position(seed.seeds,i));
tb:=List(b.seeds,i->Position(seed.seeds,i));
fi;
seen:=Length(seed.seeds seen, # nr of seeds in toto
e, # entry
if tal=fail then
tal:=Length(ta) bpre # bs-entries that have been taken earlier
else
tal:=tal-1;
fi found,# substring found?
tbllaro,# flag when dealing with the last elements.
if tbl p;
tbl:=Length(tb);
else
tbl=tbl-1;
fi;
a:=LinesOfStraightLineProgram(aobbep:Lengthb;
b:=LinesOfStraightLineProgram(bob![2]
l[;
la:=Length(a)-1; # the last entries are treated specially
lb:= elif IsSubset.b.seeds
# special case: Multiplication with generator powers
e[]:=ta[e[ e[j]:=ta[e[j>(seed.seeds,i));
a:=a[1];
l:od;
l istseeds,->.seeds,i));
Append(tb,seen+[1..Length( =1.]
for in[1..ength
e:=ShallowCopy(l if e[ength(e)-1]a=eed;
for j ine:eLength()+[2java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
[j: .:=.mpbl)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
;
l[i]: (base)and (.)then
od seed.ase=(.ase,.ase)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
e taListaseeds,>(.seedsijava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
if e[1]=ta[a[1]] then
e[2]:=e[2]+a[2];seen:Length(.)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
if e[2]=0 then
e:=e{[3..Length
;
e:=Concatenation([ta[a[1]],a[2]],e);
fi;
l[Length(l)
elif =aob[2)
b:=b[1];
l:=#Print("<\n");
# translate
Append(ta,seen+[1..Length(a)]);
fori [.Length(]do
e:=ShallowCopy(l[i]);
for j in [1,3..Length(e)-1] special case: Multiplication with generator powerswhile<= and1]i>< la0and a12java.lang.StringIndexOutOfBoundsException: Range [33, 34) out of bounds for length 33
ej=ejava.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 15
od;
l[i]:=e;
od;
e:=l[Length(l)];
ife[(e)1]tb[]
[():e]b2;
if e[Length(e)]=0 then
:{1.ength()2];
fi;
else
e: e[=[
fijava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
l[Length(l)]:=e;
else
ap:=1;
bp:=1;
ale:=[]; # a-indices in l
ble:=[]; # b-indices in l
aro:false
while la<=Length(a) do
#Print("<\n");
while ap<=la or bp<=lb do
#Print(">",ap,",",bp,"\n");
# how many ap's do use up to generator aep;
anp:=ap;
while anp<=la and ForAll(a[anp]{[1,3..Length(a[anp])-1]},i-> iin[1..ength) do
:1
od;
:={ap.anp-}
the java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 41
:l[Length);
for i in [1..Length(as)] do
e:=ShallowCopy(as[i [ength():e[Lengthe]b2;
jLength()=
f:e[.ength(-]java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
if e[j]<0 then
# inverse
e[j]:=-e[j];
e[j+1]:=-e[j+1];
fi;
od;
as[i]:=e;
## pc groups.
fi## </Description>## <#/GAPDoc>##
# how many bp's do use up to generator bep;
### If a normal subgroup <A>N</A> of <A>G</A> which is invariant under
while ## <A>fine</A> is given as <K>true</K>.=] ## gap> g:=Group((1,24,1#Group[
##
while la<=Length(a) do
bs:=b{[## <A>epi</A> is fixed under <A## Let <M>U</M> be the image of <A>epi</A>.
# translate the generator numbers
## Group([ (1,2)(3,4), (1,3)(2,4) ])
for i in [1..Length(## gap> aut:=InnerAutomorphism(g,(1,2,3));
e: anp<=aand (a[anp][1,3.Length(a[np)1],-><=) do
for #F InvariantSubgroupsElementaryAbelianGroup(<G>,<homs>[,<dims>]) submodules
#
if e[j]<0 then## Then this function computes all subspaces of
# inverse
[]=e]java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
## [ (1,2,3), (4,5,6), (7,8,9) ] -> [ (7,8,9), (1,2,3), (4,5,6) ]
fi## Group([ (1,2,3)(4,5,6)(7,8,9) ]), Group(()) ]
od;
")
od;
fi;
bpre:=[];
bleu## subspaces and <A>action</A> a homomorphism from <A>P</A> in a permutation group,
# add the as
i fi;
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
## <ManSection>
# search substring in recorded b-parts
found## It returns a list of representatives up to <A>G</A>-conjugacy.
j:=1;
# we stored it already
p
found:=p<>fail;
j:=j+1;## The function guarantees that representatives of all subgroups that
od;
if ## which are invariant under all these automorphisms are computed. The
j=ble[-1]+1;# the other case will always add 1.
else
# search substring in bs
j:=## normal).
while
p:=e,bs[j]);
if<>failthen
for j in1,# relation <M>F \geq C > A > N > B > M</M>.1,]java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
# search substring in recorded b-parts (inverse)
# record this bs in l
(ljava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
## still return (invariant) subgroups which don't fulfill this condition!</E>)
AddSet(bpre,j); # this one is taken already
tb[bsn+bp+j-1] :p<fail;
j:=Lengthjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 23
else
# we stored it already
java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
fi j=1java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 11
=(,
j:# </Item>
od;
java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 15
if found<>false then
# the subentry starts at index p
# j is the l-index of the entry which is sub+1
e:=Concatenation(e{[1..p-1]},[j+seen- AddSet(bpre##
##
else## <ManSection>
# search substring in recorded b-parts (inverse)
ei:=ERepAssWorInv(e);
j:=1;
while found=false found## > consider:=SizeConsiderFunction(6)));;
# java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
found:=p<>fail;
j:=## <#/GAPDoc>
od;
iftb
j:=ble[j-1]+1; # the other case will always add 1.
else
;
while found=## > consider:=ExactSizeConsiderFunction(6)));;
## ]]></Example>
if p<> od.is java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 72
found:true
if not j in bpre then
AddSet(bpre,j); # this one is taken now
# record this bs in l.(}java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
j]in l
# happens to be coincidence.
n(l,j];
tb[bsn+bp+j-1]:=k+seen subentry index in
:k;
else
(,bs];
AddSet(bleu,Length(l));
tb {Length(e)p2))
j:=Length(l); # position of the l-entry that is sub
fi;
else
# we stored it already :=osSublOddei,l[ble[])
j:=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
fi;
fi;
j:=j+1;
;
fi;
# the subentry starts at index p in the inversejava.lang.StringIndexOutOfBoundsException: Range [16, 17) out of bounds for length 16
:=Concatenation({.Le1-Length([-1)}
[j+een1-],
e{[Length(e)-p+2..Length(e)]});
:=RepAssWorInv(e)
fi;
fi;
until ;
# finally store, unless trivial and not the last one
if Length(e)>2 or AbsInt(e[2])>1 or laro then
in java.lang.StringIndexOutOfBoundsException: Range [26, 27) out of bounds for length 26
#
ta+i]=le+;
else
Addlejava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
ifnot laro
# do not add in the last step -- this might confuse b# search substring in recorded a-parts
AddSet(ale,Length(l));
fi;
ta[asn+appP(e,[le[])java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
fi;
else
# complete replacement
ta[asn+ap+i-1]:=SignInt(e[2])*e[1];
fi;
od;
ble:=Union(ble,bleu); # the b-indices that were added
the bs
for i in [1..Length [Length[].L(e] ;
if not else
e:=bs[i];
repeat
# search substring in recorded a-parts
found:=false;
j:1;
whileif <>alse
p:=PosSublOdd(e,l[ale[j]]);
found:=p<>fail;
j:=j+1;
od
if found<>false then
# the subentry starts at index p
#:Eejava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
j:=ale[j-1];
# the subentry starts at index p in the inverse
e{[p+Length(l[j])..Length(e)]});
else
found:=false;
j:=1;
the replacement could rarely produce duplicates
oundfalse and j<=Length(ale) do
p:=PosSublOdd(e,l[ale[j]]);
found:=p<>fail;
j:=j+1;
od;
if found<>false then
# the subentry starts at index p in the inverse
# j is the l-index of the entry which is sub+1
:=[-11;
e:=Concatenation(e{[1.. # the replacement could rarely duplicates
[j+seen-1,-1],
e{[Length(e)-p+2..Length(e)]});
ei=ERepAssWorInv(;
fi;
fi;
until java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 17
# finally store
if Length(e)>2 or java.lang.StringIndexOutOfBoundsException: Range [12, 36) out of bounds for length 21
if e in l then
# the replacement could rarely produce duplicates
bsn+i-:Position(,e)seen;
else
(l,);
AddSet(ble,Length(l));
tb[bsn+bp+i-1]:=Length(l)+seen;
fi;
else
# complete replacement
tb[bsn+ :true;
fi;
fi;
od;
ap:=anp;
bp:=bnp;
aep:=aep+1java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
bep:=bep+1;
od;
#this the two entries processed last
la:=la whilefound=alse j<=Length()
lb:=lb+1;
laro:=true;
od;
# finally multiply the last entries.
# get the indices in l of the corresponding last entries
# the -1 in the argument only undoes the +1 at the end of the `while' loop:l[Length();
la:=ta[la+asn-1];
# does b refer to a?
laa:=AbsInt(la);
lba:=AbsInt(lb)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
laLength(l)seen1then
# last a is in the but last position
if lb=Length(l)+seen then
# Print("case1\n");
# last b is in the last position: combine last two
e:=l[Length(l)-1];
j:=l[Length(l)iflbl+then
# does b refer to a?
if ForAny([1,3.. tb[bsn+bp+i:Positionle+else
Add(l,[la,1,lb,1]);
else
l[Length(l)-1]:=ERepAssWorProd(e,j);
Removefijava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
fi;
else
Error("spurious last entry");
fi;
else
# last a is not in the but last position
if lb=Length(l)+ apjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
# Print("case2\n");
# last b is in the last position: Change it+1
l[Length(l)]:=ERepAssWorProd([la,1],
# last b is not in the last position:
if a+;
# Print("case3\n");
# but a is: change a in last position
l[Length(l)]:=ERepAssWorProd(l[Length(l)],[lb,1]);
else
# Print("case4\n");
# last b is not in the last position or inverses used: Add another
Add(l,[laa,SignInt(la),lba,SignInt( :=ala+-1;
fi;
fi;
fi;
fi;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#if ForAny(l,i->Length(i)=2) then
# Error("hui");
#fi;#fi;
if Length( # last b is in the last position: combine last two
InstallMethod\^"power line program elements",true,
else
#if ForAny([2..Length(l)],i->Length(l[i])=2 and AbsInt(l[i][2])=1) then
# Error();
#fi;
# Assert(1,not
# ForAny([1..Length(l)],i->ForAny([1..i-1],j->PositionSublist(l[i],l[j])<>fail)));
Assert(3,Length(Set(l))=Length l[engthl-]= l[Length(l)-1]:=ERepAssWorProd;
l=traightLineProgElmStraightLineProgramNC,);
Assert(2,EvalStraightLineProgElm(java.lang.StringIndexOutOfBoundsException: Range [0, 40) out of bounds for length 11
(l;
l
fi;
end);
hod\"java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 61
[IsStraightLineProgElm,l[Length(l)]:=ERepAssWorPr[,1lLl];
function(a,e)
local l,n;
if e=0 then
return One(a);
elif e=1 then
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 13
elif e=-1# Print("case4\n");
return return EvalStraightLineProgElm(slp)=x;
fi;
l:=LinesOfStraightLineProgram(a![2]);
java.lang.StringIndexOutOfBoundsException: Range [6, 1) out of bounds for length 9
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
# special case: generators
l:=[[l[1]
else
l:=ShallowCopy(l) returnOne)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
Add(l,[Length(l)+n,e]);
fi;
return StraightLineProgElm(a![1 x<EvalStraightLineProgElm#fi;
end);
InstallMethod(\=,"straight line program element with x"
[sStraightLineProgElmIsMultiplicativeElement],0,
function(slp,x)
:StraightLineProgElm(seedjava.lang.StringIndexOutOfBoundsException: Range [55, 53) out of bounds for length 63
)
InstallMethodInstallMethod;
[IsStraightLineProgElm,IsMultiplicativeElement],0,
(slp,)
return)
nd;
InstallMethod(,)
[IsMultiplicativeElement,IsStraightLineProgElm],0,
function(x,slp)
nction()
end);
#############################################################################
##
#O StretchImportantSLPElement(<elm>)
##
,arbitrary nothing,java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
[IsMultiplicativeElementWithInverse],0,
Ignoreif([]l)then
InstallMethod(StretchImportantSLPElement,"straight
[IsStraightLineProgElm],0,
function(a)
local e,s,r;
#transfer for permsjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
if Product
e allMethod\,traight withx,sIdenticalObj,
s:=Union(a [sStraightLineProgElmIsMultiplicativeElement],0,
e:=Position(s,e);
r:=rec(seeds:=s);
if (!1.) then
# transfer largest moved point information for perms.;
r.lmp:=a![1].lmp;
fi;
ifIsBound(!1.) then
# transfer base information for perms.
r.base:=a![1].base;
fi;
a![1]##
![]# special methods for straight line permutations
fi;
end
##
## special methods for straight line permutations
##
InstallMethod(\=,"x with straight line program element",IsIdenticalObjreturn =#
[java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 5
unction(slp
return=EvalStraightLineProgElm(slp);
end);
BindGlobal("ImgElmSLP",function(x,slp,preIStretchImportantSLPElementstraight line elements,java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
locals(java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
# trace through
trace:=function(y,n)
local e,i,j;
if n<0 then
n:=- :java.lang.StringIndexOutOfBoundsException: Range [32, 30) out of bounds for length 34
if n<=m then
return y/s[n];
else
for i in [Length(e)-1,Length rlmp=a!1.lmp;
if e[i+1]<0 then
for j in [e[i+1]..-1] do
y:=trace(y,e[i]);
od;
else![]=;
j in [..[i1] do
y:=trace(y,-e[i]);
od;
fi;
od;
fi;
elif n<=m then
return y^s[n];
else
e:=l[n-m];
for i in [1,3..Length(e)-1] do
if e[i+1]<0 then
for jin [[+1.-1] do
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
od;
else
for j in [1..e[i+1]] do
locale,ijava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
od;
fi;
od;
fi;
return else
end;
s:slp[1]seeds;
m:=Length(s);
l:=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
# preimage!
return java.lang.StringIndexOutOfBoundsException: Range [14, 15) out of bounds for length 14
else
trace,((+);
fi;
nd;
# The following function ought to perform better, being nonrecursive.
# In practice the recursion, being executed in the kernel, works out
# better. However this function ought to give the better performance if
# compiled.
BindGlobal("ImgElmSLPNonrecursive",function(x,slp,npre)
local s,m,le=[-;
s for in[,3.
m:# The following function ought to perform better, being nonrecursive.
l:=LinesOfStraightLineProgram(slp![2]);
stack:=[];
sp:=0;
pos:=Length# compiled.
row:=[os]java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
if npre then
ind:=1;
step:=2;
else
ind:=Length(row)-1;
step:=-2;
fi;
cnt:=0;
repeat
v:=row[ind];
e:=row[ind+1];
ae:AbsInte)java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
=
e:=-e;
fi;
if v<=m then
# do the most simple cases themselves
if e=-1 then
x:=x/sv];
elif e=1 then
:x^v;
elif e>0 then
for i in [1..e] do
x:=x^s[v];
od;
else
fori in [..-e]do
x:=x/s[v];
od;
fi;
cnt:=ae; # did all
=x/s[v];
#push
sp:=sp+1;
stack[sp]:=[pos,ind,step,cnt];
pos:=v-m;
row:=l[pos];
npre:=e>0;
if npre then
ind:=1;
:2java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
else
ind:=e didall
step:=-2;
fi;
cnt:=/v]
;
while cnt>=ae do
ind:=indrow=[pos]
cnt:=0;
if ind>Length(row) or ind<1 then
# pop
=0
:/;
x;
fi:java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
row:=stack
sp:=sp-1;
pos:=row[1];
ind:=row[2];
step:=row[3];
npre:=step>0;
cnt:=row[4]+1; # +1 since we did one
row:=l[pos];
ae:=AbsInt(ow[ind+]);
fi;
;
java.lang.StringIndexOutOfBoundsException: Range [8, 4) out of bounds for length 11
end);
r[1;
[IsInt,IsStraightLineProgElm and IsPerm],0,
function(x,slp)
# do not use for straight line elements!
if IsStraightLineProgElm(x) then
TryNextMethod();
fi;
return ImgElmSLP(x,slp,true);
end);
InstallOtherMethod(\/,"x with straight line perm",true,
[IsPosInt,IsStraightLineProgElm and IsPerm],0,
function(x,slp)
return ImgElmSLP(xend pos:ow[]java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
end);
# takes a seed record and fetches/adds a largest moved point entry
npres>;
if not IsBound(r.lmp) then
r.lmp:=LargestMovedPointfunction(x,)
fi;
return r.lmp;
end);aeAr[nd+)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
InstallMethod(LargestMovedPoint,"straight line program permutation
[IsStraightLineProgElm and IsPerm],0,
function(slp)
local p,q;
[sPosInt,sStraightLineProgElm and IsPerm],,
InstallOtherMeth(,int with line perm"true
q:=p-100;
else
q:=0;
fi# takes a seed record and fetches/adds a largest moved point entry
whileBindGlobal(LMPSLPSeed"function()
p:=p-1;
od;
if p>q then
java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 0
elif q=0 then
return q;
else
# catch the () case quickly if base given.
if IsBound(slp![1].base) and IsOne(slp) then
local p,q;
fi;
# the element seems to be the identity. Expand!
q:=EvalStraightLineProgElm(slp);
return LargestMovedPoint(q);
fi;
java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 5
InstallMethodjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
IsStraightLineProgElm IsPermIsPerm,,
function(slp,perm)
local r;
r:=LargestMovedPoint(perm);
if r=0 then
IsOneslp)
else
if r^perm<>ImgElmSLP(r,slp,true) then
return false;
fi;
fi
if IsBound(slp![1].base) then
return ForAll(slp![1].base,i->ImgElmSLP(i,slp,true)=i q=EvalStraightLineProgElm;
and r<=LMPSLPSeed(slp![1]);
fi;
turnEvalStraightLineProgElm(slp)=perm;
end);
InstallMethod(\=,"perm with straight
[IsPerm,IsStraightLineProgElm and IsPerm],0,
function(perm,slp)
local r;
# the element seems to be the identity. Expand!
if InstallMethod\,line java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 74
return IsOne(slp);
else
if rperm<ImgElmSLP(,slp,java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 13
return false;
fi;
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
if IsBound(slp![1]. if IsBound(slp![1].base(1.
return ForAll(slp![1].base,i->ImgElmSLP(i,slp,true)=i^perm)
rs!1)
fireturn java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 74
return perm=EvalStraightLineProgElm(slp);
end);
InstallMethod(\=,"straight line java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 13
[IsStraightLineProgElm and IsPerm,IsStraightLineProgElm java.lang.StringIndexOutOfBoundsException: Range [6, 7) out of bounds for length 6
function(a,b)
local l;
if not IsIdenticalObj(a![1],b![1]) then
l: return (!1.,-iiperm
else
l:=LMPSLPSeed(a![1]);
fi;
ifIsBound(a!]base IsBoundb[] java.lang.StringIndexOutOfBoundsException: Range [53, 54) out of bounds for length 53
return
ForAll(Union(a![1].base,b![1].base [java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 72
i->ImgElmSLP(i,a,truem
fi;
l<
=0java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
else
m:=l-100;
;
while l>m
function(,)
return false;
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
l:=l-1;
od;
if l=0 then
return true;
fi
# the elements look very similar, but there are a lot of points.
()java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 63
end);
InstallMethod(\<,"straight line program perms",java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 9
IIjava.lang.StringIndexOutOfBoundsException: Range [61, 57) out of bounds for length 72
function(a,b)
local l,m,x,y;
=;
if not IsIdenticalObj(a![1],b![1]) then
ml=;
else
m:=LMPSLPSeed(a![1]);
fi;
if m>1000 then
m:=1000;
fi;
while l<m do
x:(,a)
(l,b,true;
if x<y then return true;
elif y<x then return false;
fi;
l:l+;
od;
# the elements look very similar, but there are a lot of points.
return EvalStraightLineProgElm(a)<EvalStraightLineProgElm(b);
end);
InstallMethod(IsOne,"straight line program perms",java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 7
eProgElm IsPerm]0,
function(slp)
local l,m;
if IsBound(slp![1].base) then
return ForAll(slp![1].base,i->ImgElmSLP(()
fi;
l:=LMPSLPSeed(slp![1]);
if l<1000 then
:;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
m:=l java.lang.StringIndexOutOfBoundsException: Range [6, 7) out of bounds for length 6
fi ijava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
while l>m do
if ImgElmSLP(l f= java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 19
return false;
fi;;
l:=l-1;
od;
if l=0 then
return true;
fi;
return IsOne( EvalStraightLineProgElm(slp) );
end);
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 7
[IsPermand, IsInt ]1java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
function(p,e)
i;
i:=0;
f:=e;
repeat
f:=f^p;
i:=i+1;
until f=e;
return i;
end
InstallOtherMethod( CycleOp, "straight line program perms", true,
[ f:=f^p
(,e
c;
i:=0;
f:=e;
c:=SignPerm();
repeat
functionp
CycleStructurePerm()
i:=i+1;
until f return RestrictedPermNC((p),l);
return c;
end);
return SignPermp)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
[ IsPerm and IsStraightLineProgElm ],1,
function(p)
return CycleStructurePerm(EvalStraightLineProgElm(p));
end);
InstallOtherMethod( SignPerm, "straight line program perms", true,
[ IsPerm and IsStraightLineProgElm ],1,
function(p)
return SignPerm(EvalStraightLineProgElm(p));
end);
InstallOtherMethod(
[ IsPerm and IsStraightLineProgElm,IsList ],1,
#############################################################################
return ##
end);
##
## special methods for straight line assoc words
##
#############################################################################
##
#M ExtRepOfObj
##
#M ##
[IsAssocWord and IsStraightLineProgElm],0,
function(I,java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 73
return ExtRepOfObj(EvalStraightLineProgElm(slp));
end);
#############################################################################
##
#M LetterRepAssocWord
##
InstallMethod(LetterRepAssocWord,"for a straight line program word",true,
[IsAssocWord and IsStraightLineProgElm],0,
function(slp)
return LetterRepAssocWord(EvalStraightLineProgElm(slp));
java.lang.StringIndexOutOfBoundsException: Range [60, 61) out of bounds for length 5
#############################################################################
##
#M NumberSyllables
##
InstallMethod(NumberSyllables,"for a straight line program word",true,
[IsAssocWord and ##
function(slp)
InstallMethod("or ajava.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 71
end);
#############################################################################
##
#M GeneratorSyllable
##
InstallMethod(GeneratorSyllable,"for a straight line program word",true,
[IsAssocWord and IsStraightLineProgElm,IsPosInt],0,
function(slp,pos)
return GeneratorSyllable(EvalStraightLineProgElmreturn Length##
end);
#############################################################################
##
#M ExponentSyllable
##
InstallMethod(ExponentSyllable,"for a straight line program word",true,
[IsAssocWord and IsStraightLineProgElm,IsPosInt],0,
function(slp,pos)
return ExponentSyllable(EvalStraightLineProgElm(slp),pos);
end);
#############################################################################
##
#M Length
##
(,ens,mgs)
[IsAssocWord and java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 33
function(slp i->appedWord(,gens,mgs) # images of the roots
((java.lang.StringIndexOutOfBoundsException: Range [46, 43) out of bounds for length 46
end);
#############################################################################
##
#M Subword
##
InstallOtherMethod(Subword,"for a straight line program word",true,
[IsAssocWord and IsStraightLineProgElm,IsInt,IsInt#############################################################################
function(slp,a,b)
return Subword(EvalStraightLineProgElm()
end);
#############################################################################
##
#M MappedWord
##
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 75
IsElmsCollsX,
[ IsAssocWord and IsStraightLineProgElm, java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 14
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
# evaluate in mapped generators
return ResultOfStraightLineProgram)
i->MappedWord(i,gens,imgs)) # images of the roots
);
end);
#############################################################################
##
#M ExponentSumWord
##
InstallMethod(ExponentSumWord,"for a straight line program word",
,andjava.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 72
:function)
xjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
EvalStraightLineProgElm(e));
end);
# words represented as tree elements (those are useful for decoding subgroup
# presentations)
#############################################################################
##
#F TreeRepresentedWord( <roots>,<tree>,<nr> )
##
## these elements are represented as straight line program elements
InstallGlobalFunction(TreeRepresentedWord,function(r ;
local z,d,l,count,b;
z:=Length(t[1]);
b=)
if n<=b then
returnInstallGlobalFunction(,function(r,j)
fi;
# which elements are referred to ? set count negative ;
d:=ListWithIdenticalEntries(z,0);
count:=function(i)
if i>b then
i0
untAbsInt[[);
count(AbsInt(t[2][i]));
;
i:[i-;
fi;
end;
count(n);
# now we will collect in d slp entries (or indices in l by positive numbers)
l=[];
d[n]:=-2; # this will force element n to be stored as word (and it will be java.lang.StringIndexOutOfBoundsException: Range [16, 17) out of bounds for length 16
# at the end of l)
count:=function(i)
local ;
if i<=b then
return i;
elif not (IsInt(d[i]) and d[i]<0) then
ife
fi;
e:=count(AbsInt(t[1][i]));
f:=count(AbsInt(t[2][i]));
x:=SignInt(
y:=SignInt(t[2][i]);
# put together
if IsInt(
if e=f then
if x+j;
Error("strange tree element");
else
e:=[e,x+y];
if IsList() and y< then
else
e:=[e,x,f,y];
fi;
else
# take care of inverses:y;
if IsList ,,line
x:=[]; #revert
for
Add(x,j);
Add(x,j+1);
od;
:ex}java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
f:=hallowCopy(f;
e{:-{ Add,ne2;
;
f[2]:=f[2]+e[+(;
y:=[]; #revert
for :f[.}
Add(y,j);
Add(y,j+1);
Addc0)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
f:=;
y: od;
f{y}:=-f{y};
fi;
if IsInt(e) then
#F SLPOnlyNeededLinesBackward( <l
elif IsInt(f) then
e:## l is a list of lines of an slp, nrinps the number of inputs.
else
# multiply
f:=## needed in the end of the slp. slotsused java.lang.StringIndexOutOfBoundsException: Range [0, 46) out of bounds for length 5
while Length(e)>1 and Length(## ll is any list.
f[2]:=f[2]+e[Length(e)];
if f[2]=0 then
f:=f{[3..Length(f)]};
fi;
e:=e{[1..Length(e)-2]};
od;
e:=Concatenation## This function returns a list with the same length than l, containing
fi;
fi;
if d[i]<-1 then
# this becomes a new definition
Add(l,e);
e:=Length(l)+b; biggestijava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
fi;
d[i]:=e; # store
return e;
end;
count(n);
if :+1
;
fi;
return StraightLineProgElm(r,StraightLineProgramNC end)java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
end);
#############################################################################
##
## 3. Functions for straight line programs, mostly needed for memory objects:
##
##
#F SLPChangesSlots( <l>, <nrinputs> )
##
## l must be the lines of an slp, nrinps the number of inputs.
## This function returns a list with the same length than l, containing
## at each position the number of the slot that is changed in the
## corresponding line of the slp. In addition one more number is
## appended to the list, namely the number of the biggest slot used.
## For the moment, this function is intentionally left undocumented.
##
## needed is a list, in13.([i1)
function(l,nrinps)
local biggest,changes,i,line;
changes := []; # a list of integers for each line of the slp, which
# says, which element is changedAddkli[[[]];
biggest (l,nneeded,,java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
for i in [1..Length java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 19
line := l[i];
if() # the first case
biggest := biggest + 1;
Unbind([changesi]]);
# the previous result obviously was no longer needed
# the second case, provided that we have not been in the first
Add(changes,line[2]);
if line[2] > biggest then
biggest :## slp must be a straight line program returning a tuple
fi;
elif i < Length(l) then
Error( "Bad line in slp: ",i );
else
Add(changes,0);
# the last line does not change anything in this case
fi;
od;
Add(changes,## does only what is necessary. java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 7
return changes## slp is either an slp or a pair where the first entry are the lines
end)#
##
#F SLPOnlyNeededLinesBackward( <l>,<i>,<nrinps>,<changes>,<needed>,
## <slotsused>,<ll> )
##
## l is a list of lines of an slp, nrinps the number of inputs.
## i is the number of the last line, that is not a line of type 3 (results).
## changes is the result of SLPChangesSlots for that slp.
## needed is a list, where those entries are bound to true that are
## needed in the end of the slp. slotsused is a list that should be
## initialized with [1..nrinps] and which contains in the end the set
## of slots used.
## ll is any list.
## This functions goes backwards through the slp and adds exactly those
## lines of the slp to ll that have to be executed to produce the
## result (in backward order). All lines are transformed into type 2
## lines ([assocword,slot]). Note that needed is changed underways.
## For the moment, this function is intentionally left undocumented.
##
InstallGlobalFunction( SLPOnlyNeededLinesBackward,
(,njava.lang.StringIndexOutOfBoundsException: Range [71, 26) out of bounds for length 71
local j,line;
>
if IsBound(needed[changes[i]]) then
(c) # this slot will be used
Unbind(needed[changes[i]]); # as this line overwrites it,
# the previous result obviously was no longer needed
:[;
ifresultslot
Add( =
else
Add(ll,[ShallowCopy(line[1]),line[2]]); java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
line := line[1];
fi;
for j in [1,3..Length(line)-1] do
needed[line[j]] : needed[ordj]: ;
;
fi;
i := i - 1;
od;
end);
##
#F SLPReversedRenumbered( <ll>,<slotsused>,<nrinps>,<invtab> )
##
## Internally used function.
##
InstallGlobalFunctionSLPReversedRenumbered
function(ll,slotsused,nrinps,invtab)
# invtab must be an empty list and is modified!
biggest,,kk,llllresultslot## results with indices k in the original output tuple.
for i in [1..Length(slotsused)] java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 28
invtab[slotsused[i]] : [ordj]=;
od;
lll := []; # here we collect the final program
biggest := nrinps;
for i in [Length(ll),Length(ll);
resultslot := invtab[ll[i][2]];
if resultslot = biggest+1 then # we can use a type 1 line
kl : [];
kk [.java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 39
Add(kl,invtab[ll[i][1][kk]]);
Add(kl,ll[i][1 :[;
od;
Add(lll,kl forj java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 28
biggestfor kk [ java.lang.StringIndexOutOfBoundsException: Range [38, 39) out of bounds for length 38
else
kl := [];
for kk in [1,3..Length(ll[i][1])-1] do
Add(java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 11
Add(kl,ll[i][1][kk+1]);
od;
Add(lll,[kl,resultslot]);
if resultslot > biggest then
;Sjava.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 65
fi;
fi;
od;
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 15
end);
##
#F RestrictOutputsOfSLP( <slp>, <k> )
##
## slp must be a straight line program returning a tuple
## of values. This function
## returns a new slp that calculates only those outputs specified by
## k. The argument
## k may be an integer or a list of integers. If k is an integer,
## the resulting slp calculates only the result with that number
## in the original output tuple.
## If k is a list of integers, the resulting slp calculates those
## results with indices k in the original output tuple.
## In both cases the resulting slp
## does only what is necessary. Obviously, the slp must have a line with
## enough expressions (lists) for the supplied k as its last line.
## slp is either an slp or a pair where the first entry are the lines
## of the slp and the second is the number of inputs.
##
InstallGlobalFunction( RestrictOutputsOfSLP,
function(slp,k)
local biggest,changes,i,invtab,j,kk,kkl,kl,klist,java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 7
needed,nrinps,slotsused;
if ;
klist := [k];
else
klist := k;
fi;
if IsStraightLineProgram(slp) then
l := LinesOfStraightLineProgram( slp );
=java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 55
else
l=slp1;
nrinps := slp[2 if lastline > java.lang.StringIndexOutOfBoundsException: Range [28, 29) out of bounds for length 28
fi;
# The following has to be done, because the SLP might overwrite its
=ln;
biggest := changes[Length(changes)];
for [3.(#java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
slotsused := [1..nrinps]; # set of slots used at all =[;
needed := []; # here we mark the needed entries for the rest of the prog.
i := Length(l);
if IsInt ;
if Length(l[i]) < k or not(IsList(l[i][k])) then
" #
;
word := ##
for j in [1,3..Length(word)-1 ##
needed[word[j]] := true;
od;
if Length(word) > 2 then
ll[1] := [ShallowCopy(word),biggest # Only used internally.
fi;## Returns a new slp that calculates only the value of slot <k>
lastline := fail;
# if Length(word)=2 and word[2]=1 then the last result is the result
# if the SLP has actually no lines, then we fix this further down!
else
lastline lll:= SLPReversedRenumbered(ll,slotsused,nrinps,invtab);
for n in klist do
word := l[i][n];
for j in [java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
needed[word[j]] := true;
od##
##
fi
SLPOnlyNeededLinesBackward(l,i-1, local i,invtab,j,kk,kl,l,line,ll,lllm,,nrinps,nrslotsused,lotsused;
# Now we have the program in reversed order in ll. The slots used
# during that calculation are in slotsused. We want to renumber
# them from [1..Length(slotsused)]:
invtab := [];
lll := l := slp1]java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
if lastline <> fail then
# Add the results line:
kkl := [];
for j in lastline do
kl := [];
for in13.Length()1]do
Add(kl,invtab[j[kk]]);
Add(kl,j[kk+1]);
od;
Add(kkl,kl);
od;
Add(lll,kkl);
fi;
if Length(lll) = 0 then # One of the original generators!
# k must be an integer here, otherwise lastline was added to lll!
# also, word must be of length 2 and second component equal to 1
return StraightLineProgramNC([ShallowCopy(word)],nrinps);
else
return StraightLineProgramNC(lll, nrinps);
fi;
end);
##
#F IntermediateResultOfSLP( <slp>, <k> )
##
## Returns a new slp that calculates only the value of slot <k>
## at the end of <slp> doing only what is necessary.
## slp is either an slp or a pair where the first entry are the lines
## of the slp and the second is the number of inputs.
## Note that this assumes a general SLP with possible overwriting.
## If you know that your SLP does not overwrite slots, please use
## "IntermediateResultOfSLPWithoutOverwrite", which is much faster in this
## case.
##
InstallGlobalFunction( IntermediateResultOfSLP in1. java.lang.StringIndexOutOfBoundsException: Range [27, 28) out of bounds for length 27
function(slp,k)
local changes,i,invtab, for i in [Length(llengthl)-. ]
(lp) fijava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
l=(java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 47
nrinps := NrInputsOfStraightLineProgram( slp );
else
l := slp[1];
java.lang.StringIndexOutOfBoundsException: Range [52, 25) out of bounds for length 25
fi;
# The following has to be done, because the SLP might overwrite its
# intermediate results:
changes si]: +FIntermediateResultsOfSLPWithoutOverwrite slp>,<k>)
slotsused := [1..nrinps]; # set of slots used at all
needed ## Note that <slp> must not overwrite slots but only append!!!
needed[k]#od;
# we are interested only in the value of slot k in the end
ll := [];## of the slp and the second is the number of inputs.
i : (l;
i # we are not interested in a result line
i ,l,rjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
fi;
SLPOnlyNeededLinesBackward(l,i,nrinps,changes,java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 19
if ()= 0 =3java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
# the slot was never assigned!
Error("Slot not used in SLP!");
fi;
# Now we have the program in reversed order in ll. The slots used
# during that calculation are in slotsused. We want to renumber
# them from [1..Length(slotsused)]:
invtab := [];
lll := SLPReversedRenumbered(ll,slotsused,nrinps,invtab);
return (lll##
# TO BE DEBUGGED HERE
end);
##
#F IntermediateResultsOfSLPWithoutOverwriteInner( ... )
##
## Internal function.
##
InstallGlobalFunction( IntermediateResultsOfSLPWithoutOverwriteInner,
function(slp,k)
# Only used internally.
ij,,,l,ine,,,mnrinps,java.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 79
if #java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
l := LinesOfStraightLineProgram( slp );
nrinps := java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 19
else
l := slp[1];
nrinps := slp[2];
fi;
m := Maximum(k);
needed := Set(k);
# here we note the needed entries for the rest of the prog.
ll := []; # Here we collect the lines of the result, but reversed
slotsused := []; # here we collect a (reversed) list of slots used
while Length(needed) > 0 do
i := Remove(needed);
if i > nrinps then
Add(slotsused,i); # this slot is used
line := l[i-nrinps];
# We know that all lines are plain lists of integers!
Add(ll,java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 2
for j in [1,3..Length(line)-1] do
## Note that <slp> must not overwrite slots but only append!!!
# Use IntermediateResultOfSLP in the other case!
ifk= 0then
fi;
od;
# Now we have the program in reversed order in ll. The slots used
# during that calculation are in slotsused. We want to renumber
# them from [1..Length(slotsused)]:
if Length(slotsused) > 0 then
=([110);
else
: ] );
fi;
#F ProductOfStraightLinePrograms( <s1>, < return ([,1] r])java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
for i in [1..nrslotsused] do
invtab[slotsused[i]] := nrinps+nrslotsused+1-i;
od;
for i in [1..nrinps] do
#F ProductOfStraightLinePrograms( <s1>, <s2> )
od;
lll := []; # here we collect the final program
for i in [ :Ljava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 2 | | |