Skip to content

Commit 091e65a

Browse files
ThomasBreuerfingolfin
authored andcommitted
PrintString and ViewString for character tables
These methods are apparently needed if one wants to use the `JupyterKernel` package.
1 parent 19f7074 commit 091e65a

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

lib/ctbl.gi

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4477,6 +4477,74 @@ InstallMethod( PrintObj,
44774477
end );
44784478

44794479

4480+
#############################################################################
4481+
##
4482+
#M ViewString( <tbl> ) . . . . . . . . . . . . . . . . for a character table
4483+
##
4484+
InstallMethod( ViewString,
4485+
"for an ordinary table",
4486+
[ IsOrdinaryTable ],
4487+
function( tbl )
4488+
if HasUnderlyingGroup( tbl ) then
4489+
return Concatenation( "CharacterTable( ",
4490+
ViewString( UnderlyingGroup( tbl ) ), " )" );
4491+
else
4492+
return Concatenation( "CharacterTable( \"", Identifier( tbl ),
4493+
"\" )" );
4494+
fi;
4495+
end );
4496+
4497+
InstallMethod( ViewString,
4498+
"for a Brauer table",
4499+
[ IsBrauerTable ],
4500+
function( tbl )
4501+
local ordtbl;
4502+
ordtbl:= OrdinaryCharacterTable( tbl );
4503+
if HasUnderlyingGroup( ordtbl ) then
4504+
return Concatenation( "BrauerTable( ",
4505+
ViewString( UnderlyingGroup( ordtbl ) ), ", ",
4506+
String( UnderlyingCharacteristic( tbl ) ), " )" );
4507+
else
4508+
return Concatenation( "BrauerTable( \"", Identifier( ordtbl ),
4509+
"\", ", String( UnderlyingCharacteristic( tbl ) ), " )" );
4510+
fi;
4511+
end );
4512+
4513+
4514+
#############################################################################
4515+
##
4516+
#M PrintString( <tbl> ) . . . . . . . . . . . . . . . for a character table
4517+
##
4518+
InstallMethod( PrintString,
4519+
"for an ordinary table",
4520+
[ IsOrdinaryTable ],
4521+
function( tbl )
4522+
if HasUnderlyingGroup( tbl ) then
4523+
return Concatenation( "CharacterTable( \"",
4524+
PrintString( UnderlyingGroup( tbl ) ), " )" );
4525+
else
4526+
return Concatenation( "CharacterTable( \"", Identifier( tbl ),
4527+
"\" )" );
4528+
fi;
4529+
end );
4530+
4531+
InstallMethod( PrintString,
4532+
"for a Brauer table",
4533+
[ IsBrauerTable ],
4534+
function( tbl )
4535+
local ordtbl;
4536+
ordtbl:= OrdinaryCharacterTable( tbl );
4537+
if HasUnderlyingGroup( ordtbl ) then
4538+
return Concatenation( "BrauerTable( ",
4539+
PrintString( UnderlyingGroup( ordtbl ) ), ", ",
4540+
String( UnderlyingCharacteristic( tbl ) ), " )" );
4541+
else
4542+
return Concatenation( "BrauerTable( \"", Identifier( ordtbl ),
4543+
"\", ", String( UnderlyingCharacteristic( tbl ) ), " )" );
4544+
fi;
4545+
end );
4546+
4547+
44804548
#############################################################################
44814549
##
44824550
#F CharacterTableDisplayStringEntryDefault( <entry>, <data> )

tst/testinstall/ctbl.tst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,28 @@ gap> ClassPositionsOfCentre( TrivialCharacter( t ) );
4040
[ 1 ]
4141
gap> ClassPositionsOfKernel( TrivialCharacter( t ) );
4242
[ 1 ]
43+
44+
# viewing and printing of character tables with stored groups
45+
gap> t:= CharacterTable( DihedralGroup( 8 ) );;
46+
gap> View( t ); Print( "\n" );
47+
CharacterTable( <pc group of size 8 with 3 generators> )
48+
gap> Print( t, "\n" );
49+
CharacterTable( Group( [ f1, f2, f3 ] ) )
50+
gap> ViewString( t );
51+
"CharacterTable( <group of size 8 with 3 generators> )"
52+
gap> PrintString( t );
53+
"CharacterTable( \"Group( \>[ f1, f2, f3 ]\<\> )\< )"
54+
gap> t:= CharacterTable( SymmetricGroup( 5 ) );;
55+
gap> View( t ); Print( "\n" );
56+
CharacterTable( Sym( [ 1 .. 5 ] ) )
57+
gap> Print( t, "\n" );
58+
CharacterTable( SymmetricGroup( [ 1 .. 5 ] ) )
59+
gap> ViewString( t );
60+
"CharacterTable( Sym( [ 1 .. 5 ] ) )"
61+
gap> PrintString( t );
62+
"CharacterTable( \"Group( \>[ (1,2,3,4,5), (1,2) ]\<\> )\< )"
63+
64+
##
4365
gap> STOP_TEST( "ctbl.tst", 1);
4466

4567
#############################################################################

0 commit comments

Comments
 (0)