From 3fc32219b905e4fb4008dacdedf71af1601375ce Mon Sep 17 00:00:00 2001 From: JosephDayngerRuiz <114962122+JosephDayngerRuiz@users.noreply.github.com> Date: Wed, 21 Jan 2026 10:38:07 -0700 Subject: [PATCH 1/6] Organizing Moved declare attribute close to the category it was related to. --- gap/attributes/cartan.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gap/attributes/cartan.gd b/gap/attributes/cartan.gd index 7bce38369..40296a333 100644 --- a/gap/attributes/cartan.gd +++ b/gap/attributes/cartan.gd @@ -18,6 +18,7 @@ DeclareAttribute("GeneralizedConjugacyClassesRepresentatives", IsSemigroup); DeclareAttribute("GeneralizedConjugacyClasses", IsSemigroup); DeclareCategory("IsMonoidCharacterTable", IsObject); DeclareAttribute("ParentAttr", IsMonoidCharacterTable); +DeclareAttribute("Irr", IsMonoidCharacterTable); DeclareAttribute("MonoidCharacterTable", IsSemigroup); DeclareCategory("IsMonoidCharacter", IsObject); @@ -34,7 +35,6 @@ DeclareAttribute("RClassBicharacterOfGroupHClass", IsGroupHClass); DeclareAttribute("RClassRadicalOfGroupHClass", IsGroupHClass); DeclareAttribute("RClassRadicalBicharacterOfGroupHClass", IsGroupHClass); DeclareAttribute("BlockDiagonalMatrixOfCharacterTables", IsSemigroup); -DeclareAttribute("Irr", IsMonoidCharacterTable); DeclareCategory("IsMonoidCartanMatrix", IsObject); DeclareAttribute("ParentAttr", IsMonoidCartanMatrix); From 0606b53f910ce3a297be85a0545214f27df9ece0 Mon Sep 17 00:00:00 2001 From: JosephDayngerRuiz <114962122+JosephDayngerRuiz@users.noreply.github.com> Date: Wed, 21 Jan 2026 10:57:16 -0700 Subject: [PATCH 2/6] Preparing display string to be agnostic of characteristic --- gap/attributes/cartan.gi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gap/attributes/cartan.gi b/gap/attributes/cartan.gi index ed932176c..71815b959 100644 --- a/gap/attributes/cartan.gi +++ b/gap/attributes/cartan.gi @@ -120,8 +120,7 @@ function(ct) strarray := List([1 .. sizetable], x -> List([1 .. sizetable], y -> ".")); ctmatrix := List(Irr(ct), ValuesOfMonoidClassFunction); - rosetastone := Filtered(Unique(Concatenation(List(Irr(ct), - ValuesOfMonoidClassFunction))), + rosetastone := Filtered(Unique(Concatenation(ctmatrix)), x -> not IsInt(x)); columnlabels := List([1 .. 2], x -> List([1 .. sizetable], y -> " ")); From 5bd5b4f30cc1a8ee0bc79e7a709ba524b2d394d4 Mon Sep 17 00:00:00 2001 From: JosephDayngerRuiz <114962122+JosephDayngerRuiz@users.noreply.github.com> Date: Wed, 21 Jan 2026 11:12:22 -0700 Subject: [PATCH 3/6] Removing code duplication Start Removing code duplication for table making. --- gap/attributes/cartan.gd | 4 +- gap/attributes/cartan.gi | 186 +++++++++++++++++++++------------------ 2 files changed, 101 insertions(+), 89 deletions(-) diff --git a/gap/attributes/cartan.gd b/gap/attributes/cartan.gd index 40296a333..6cae4f688 100644 --- a/gap/attributes/cartan.gd +++ b/gap/attributes/cartan.gd @@ -40,4 +40,6 @@ DeclareCategory("IsMonoidCartanMatrix", IsObject); DeclareAttribute("ParentAttr", IsMonoidCartanMatrix); DeclareAttribute("MonoidCartanMatrix", IsSemigroup); -DeclareAttribute("Pims", IsMonoidCartanMatrix); \ No newline at end of file +DeclareAttribute("Pims", IsMonoidCartanMatrix); + +DeclareOperation("PrepareTableDisplay", [IsList, IsString, IsString]); \ No newline at end of file diff --git a/gap/attributes/cartan.gi b/gap/attributes/cartan.gi index 71815b959..9bdf9b9de 100644 --- a/gap/attributes/cartan.gi +++ b/gap/attributes/cartan.gi @@ -108,100 +108,15 @@ end); InstallMethod(DisplayString, "for a monoid character table", [IsMonoidCharacterTable], function(ct) - local str, columnlabels, rowlabels, strarray, sizetable, i, j, ctmatrix, - rosetastone, coltable, columnwidth, rowlabelwidth, currentwidth, currentpage, - screensizeassume, quotientcolumnwidthsums, temp, temp2, temp3, temp4; + local str; str := StringFormatted("MonoidCharacterTable( {} )", ParentAttr(ct)); if HasIrr(ct) then - sizetable := Length(Irr(ct)); - - strarray := List([1 .. sizetable], x -> List([1 .. sizetable], y -> ".")); - ctmatrix := List(Irr(ct), ValuesOfMonoidClassFunction); - rosetastone := Filtered(Unique(Concatenation(ctmatrix)), - x -> not IsInt(x)); - - columnlabels := List([1 .. 2], x -> List([1 .. sizetable], y -> " ")); - rowlabels := List([1 .. (sizetable + 2)], x -> " "); - - for i in [1 .. sizetable] do - rowlabels[i + 2] := Concatenation("X.", String(i)); - od; - - for j in [1 .. sizetable] do - columnlabels[1, j] := Concatenation("c.", String(j)); - od; - - for j in [1 .. sizetable] do - columnlabels[2, j] := " "; - od; - - for i in [1 .. sizetable] do - for j in [1 .. sizetable] do - if IsInt(ctmatrix[i, j]) then - if not IsZero(ctmatrix[i, j]) then - strarray[i, j] := String(ctmatrix[i, j]); - fi; - else - strarray[i, j] := WordAlp("ABCDEFGHIJKLMNOPQRSTUVWXYZ", - Position(rosetastone, ctmatrix[i, j])); - fi; - od; - od; - - coltable := Concatenation(columnlabels, strarray); - - columnwidth := List(List(TransposedMat(coltable), - x -> List(x, Length)), Maximum) + 1; - - rowlabelwidth := Maximum(List(rowlabels, Length)); - - for i in [1 .. Length(rowlabels)] do - - rowlabels[i] := Concatenation(rowlabels[i], - WordAlp(" ", rowlabelwidth - Length(rowlabels[i]))); - od; - - for i in [1 .. Length(coltable)] do - for j in [1 .. sizetable] do - coltable[i, j] := Concatenation(WordAlp(" ", - columnwidth[j] - Length(coltable[i, j])), - coltable[i, j]); - od; - od; - - screensizeassume := Maximum(SizeScreen()[1], 20) - rowlabelwidth; - currentwidth := 0; - currentpage := 0; - quotientcolumnwidthsums := List(columnwidth, x -> 0); - for i in [1 .. sizetable] do - currentwidth := currentwidth + columnwidth[i]; - if currentwidth + 1 < screensizeassume then - quotientcolumnwidthsums[i] := currentpage; - else - currentwidth := columnwidth[i]; - currentpage := currentpage + 1; - quotientcolumnwidthsums[i] := currentpage; - fi; - od; - temp := Concatenation(List([0 .. Last(quotientcolumnwidthsums)], - k -> List(coltable, - x -> Concatenation(x{Positions(quotientcolumnwidthsums, k)})))); - - temp2 := List(temp, x -> Concatenation(x, "\n")); - - temp3 := Concatenation(List([1 .. Length(temp2)], - x -> Concatenation(rowlabels[((x - 1) mod Length(rowlabels)) + 1], - temp2[x]))); - - temp4 := List([1 .. Length(rosetastone)], - x -> Concatenation(WordAlp("ABCDEFGHIJKLMNOPQRSTUVWXYZ", x), - " := ", String(rosetastone[x]), "\n")); - - str := Concatenation(temp3, "\n", Concatenation(temp4)); + str := PrepareTableDisplay(List(Irr(ct), ValuesOfMonoidClassFunction), + "X", "c"); fi; @@ -320,6 +235,101 @@ function(cm) return str; end); +InstallMethod(PrepareTableDisplay, "for a square list of lists with values", +[IsList, IsString, IsString], +function(datamatrix, labela, labelb) + local columnlabels, rowlabels, strarray, sizetable, i, j, + rosetastone, coltable, columnwidth, rowlabelwidth, currentwidth, currentpage, + screensizeassume, quotientcolumnwidthsums, temp, temp2, temp3, temp4; + + sizetable := Length(datamatrix); + + strarray := List([1 .. sizetable], x -> List([1 .. sizetable], y -> ".")); + rosetastone := Filtered(Unique(Concatenation(datamatrix)), + x -> not IsInt(x)); + + columnlabels := List([1 .. 2], x -> List([1 .. sizetable], y -> " ")); + rowlabels := List([1 .. (sizetable + 2)], x -> " "); + + for i in [1 .. sizetable] do + rowlabels[i + 2] := Concatenation(labela, ".", String(i)); + od; + + for j in [1 .. sizetable] do + columnlabels[1, j] := Concatenation(labelb, ".", String(j)); + od; + + for j in [1 .. sizetable] do + columnlabels[2, j] := " "; + od; + + for i in [1 .. sizetable] do + for j in [1 .. sizetable] do + if IsInt(datamatrix[i, j]) then + if not IsZero(datamatrix[i, j]) then + strarray[i, j] := String(datamatrix[i, j]); + fi; + else + strarray[i, j] := WordAlp("ABCDEFGHIJKLMNOPQRSTUVWXYZ", + Position(rosetastone, datamatrix[i, j])); + fi; + od; + od; + + coltable := Concatenation(columnlabels, strarray); + + columnwidth := List(List(TransposedMat(coltable), + x -> List(x, Length)), Maximum) + 1; + + rowlabelwidth := Maximum(List(rowlabels, Length)); + + for i in [1 .. Length(rowlabels)] do + + rowlabels[i] := Concatenation(rowlabels[i], + WordAlp(" ", rowlabelwidth - Length(rowlabels[i]))); + od; + + for i in [1 .. Length(coltable)] do + for j in [1 .. sizetable] do + coltable[i, j] := Concatenation(WordAlp(" ", + columnwidth[j] - Length(coltable[i, j])), + coltable[i, j]); + od; + od; + + screensizeassume := Maximum(SizeScreen()[1], 20) - rowlabelwidth; + currentwidth := 0; + currentpage := 0; + quotientcolumnwidthsums := List(columnwidth, x -> 0); + for i in [1 .. sizetable] do + currentwidth := currentwidth + columnwidth[i]; + if currentwidth + 1 < screensizeassume then + quotientcolumnwidthsums[i] := currentpage; + else + currentwidth := columnwidth[i]; + currentpage := currentpage + 1; + quotientcolumnwidthsums[i] := currentpage; + fi; + od; + + temp := Concatenation(List([0 .. Last(quotientcolumnwidthsums)], + k -> List(coltable, + x -> Concatenation(x{Positions(quotientcolumnwidthsums, k)})))); + + temp2 := List(temp, x -> Concatenation(x, "\n")); + + temp3 := Concatenation(List([1 .. Length(temp2)], + x -> Concatenation(rowlabels[((x - 1) mod Length(rowlabels)) + 1], + temp2[x]))); + + temp4 := List([1 .. Length(rosetastone)], + x -> Concatenation(WordAlp("ABCDEFGHIJKLMNOPQRSTUVWXYZ", x), + " := ", String(rosetastone[x]), "\n")); + + return Concatenation(temp3, "\n", Concatenation(temp4)); +end +) + BindGlobal("MonoidCharacterType", NewType(NewFamily("MonoidCharacterFamily"), IsMonoidCharacter and From 760fd9296efbf378d9ccedc72ad435d9ca32cf05 Mon Sep 17 00:00:00 2001 From: JosephDayngerRuiz <114962122+JosephDayngerRuiz@users.noreply.github.com> Date: Wed, 21 Jan 2026 11:14:59 -0700 Subject: [PATCH 4/6] Missed semicolon --- gap/attributes/cartan.gi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gap/attributes/cartan.gi b/gap/attributes/cartan.gi index 9bdf9b9de..d5c307179 100644 --- a/gap/attributes/cartan.gi +++ b/gap/attributes/cartan.gi @@ -327,8 +327,7 @@ function(datamatrix, labela, labelb) " := ", String(rosetastone[x]), "\n")); return Concatenation(temp3, "\n", Concatenation(temp4)); -end -) +end); BindGlobal("MonoidCharacterType", NewType(NewFamily("MonoidCharacterFamily"), From 06c20fd3660bc229d80e2be618b79f5d007453c1 Mon Sep 17 00:00:00 2001 From: JosephDayngerRuiz <114962122+JosephDayngerRuiz@users.noreply.github.com> Date: Wed, 21 Jan 2026 11:31:59 -0700 Subject: [PATCH 5/6] Uniform application of table making --- gap/attributes/cartan.gi | 110 ++++++++------------------------------- 1 file changed, 23 insertions(+), 87 deletions(-) diff --git a/gap/attributes/cartan.gi b/gap/attributes/cartan.gi index d5c307179..713135504 100644 --- a/gap/attributes/cartan.gi +++ b/gap/attributes/cartan.gi @@ -94,17 +94,6 @@ function(ct) ParentAttr(ct)); end); -# Notes to consider when changing the code for the display string -# for IsMonoidCharacterTable. -# -# The following conventions were observed in the character tables of -# groups. -# Integer entries are never truncated and make their column bigger -# -/A prefix makes a column bigger -# Checking for redunacnies under *M is not implemented. However -# character tables of groups do check for *M redundancies. -# Column headers do not get padded to match wider columns. - InstallMethod(DisplayString, "for a monoid character table", [IsMonoidCharacterTable], function(ct) @@ -149,92 +138,35 @@ end); InstallMethod(DisplayString, "for a monoid cartan matrix", [IsMonoidCartanMatrix], function(cm) - local str, columnlabels, rowlabels, strarray, sizetable, i, j, cmmatrix, - coltable, columnwidth, rowlabelwidth, currentwidth, currentpage, - screensizeassume, quotientcolumnwidthsums, temp, temp2; + local str; str := StringFormatted("MonoidCartanMatrix( {} )", ParentAttr(cm)); if HasPims(cm) then - sizetable := Length(Pims(cm)); - - strarray := List([1 .. sizetable], x -> List([1 .. sizetable], y -> ".")); - cmmatrix := List(Pims(cm), ValuesOfCompositionFactorsFunction); - - columnlabels := List([1 .. 2], x -> List([1 .. sizetable], y -> " ")); - rowlabels := List([1 .. (sizetable + 2)], x -> " "); - - for i in [1 .. sizetable] do - rowlabels[i + 2] := Concatenation("P.", String(i)); - od; - - for j in [1 .. sizetable] do - columnlabels[1, j] := Concatenation("X.", String(j)); - od; - - for j in [1 .. sizetable] do - columnlabels[2, j] := " "; - od; - - for i in [1 .. sizetable] do - for j in [1 .. sizetable] do - if not IsZero(cmmatrix[i, j]) then - strarray[i, j] := String(cmmatrix[i, j]); - fi; - od; - od; - - coltable := Concatenation(columnlabels, strarray); - columnwidth := List(List(TransposedMat(coltable), - x -> List(x, Length)), Maximum) + 1; - - rowlabelwidth := Maximum(List(rowlabels, Length)); - - for i in [1 .. Length(rowlabels)] do - rowlabels[i] := Concatenation(rowlabels[i], - WordAlp(" ", rowlabelwidth - Length(rowlabels[i]))); - od; - - for i in [1 .. Length(coltable)] do - for j in [1 .. sizetable] do - coltable[i, j] := Concatenation(WordAlp(" ", - columnwidth[j] - Length(coltable[i, j])), - coltable[i, j]); - od; - od; - - screensizeassume := Maximum(SizeScreen()[1], 20) - rowlabelwidth; - currentwidth := 0; - currentpage := 0; - quotientcolumnwidthsums := List(columnwidth, x -> 0); - for i in [1 .. sizetable] do - currentwidth := currentwidth + columnwidth[i]; - if currentwidth + 1 < screensizeassume then - quotientcolumnwidthsums[i] := currentpage; - else - currentwidth := columnwidth[i]; - currentpage := currentpage + 1; - quotientcolumnwidthsums[i] := currentpage; - fi; - od; - - temp := Concatenation(List([0 .. Last(quotientcolumnwidthsums)], - k -> List(coltable, - x -> Concatenation(x{Positions(quotientcolumnwidthsums, k)})))); - - temp2 := List(temp, x -> Concatenation(x, "\n")); - - str := Concatenation(List([1 .. Length(temp2)], - x -> Concatenation(rowlabels[((x - 1) mod Length(rowlabels)) + 1], - temp2[x]))); + str := PrepareTableDisplay(List(Pims(cm), + ValuesOfCompositionFactorsFunction), + "P", "X"); fi; return str; end); +# Notes to consider when changing the code for the PrepareTableDisplay +# +# This affects both the MonoidCharacterTable and MonoidCartanMatrix +# display functionality +# +# The following conventions were observed in the character tables of +# groups. +# Integer entries are never truncated and make their column bigger +# -/A prefix makes a column bigger +# Checking for redunacnies under *M is not implemented. However +# character tables of groups do check for *M redundancies. +# Column headers do not get padded to match wider columns. + InstallMethod(PrepareTableDisplay, "for a square list of lists with values", [IsList, IsString, IsString], function(datamatrix, labela, labelb) @@ -322,11 +254,15 @@ function(datamatrix, labela, labelb) x -> Concatenation(rowlabels[((x - 1) mod Length(rowlabels)) + 1], temp2[x]))); - temp4 := List([1 .. Length(rosetastone)], + if Length(rosetastone) > 0 then + temp4 := List([1 .. Length(rosetastone)], x -> Concatenation(WordAlp("ABCDEFGHIJKLMNOPQRSTUVWXYZ", x), " := ", String(rosetastone[x]), "\n")); - return Concatenation(temp3, "\n", Concatenation(temp4)); + return Concatenation(temp3, "\n", Concatenation(temp4)); + fi; + + return temp3; end); BindGlobal("MonoidCharacterType", From 1ed8d4b2974c2ffff7d77e235ab5f1546984ac67 Mon Sep 17 00:00:00 2001 From: JosephDayngerRuiz <114962122+JosephDayngerRuiz@users.noreply.github.com> Date: Wed, 21 Jan 2026 11:43:31 -0700 Subject: [PATCH 6/6] Update cartan.tst Updated test to reflect the uniform way displayed tables are generated. --- tst/standard/attributes/cartan.tst | 1 - 1 file changed, 1 deletion(-) diff --git a/tst/standard/attributes/cartan.tst b/tst/standard/attributes/cartan.tst index b577a6712..623371716 100644 --- a/tst/standard/attributes/cartan.tst +++ b/tst/standard/attributes/cartan.tst @@ -70,7 +70,6 @@ X.4 2 . -1 1 -1 . X.5 3 1 . 1 1 . X.6 1 1 1 1 1 1 - # Creation of a lazy monoid cartan matrix - 1 gap> S := FullTransformationMonoid(3);; gap> MonoidCartanMatrix(S);