Skip to content

Added K[G]-Algebras package #3685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: development
Choose a base branch
from

Conversation

danielk011
Copy link

No description provided.

Copy link
Member

@mahrud mahrud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! I left a few comments and feedback below.

There is also more information here: https://github.com/Macaulay2/M2/wiki/Package-Writing-Style-Guide

for j in 0 .. n do(
productInv = position(matrixElts,M -> M==matrixElts#i * matrixElts#j);
H= (FA_i)*(FA_j)-(FA_productInv);
multTableIdealGens=append(multTableIdealGens,H);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appending to a list in Macaulay2 allocates memory for and creates a new list, which can be slow depending on the size of n. You might want to consider using a MutableList instead, and adding to it using the (admittedly funny looking) syntax:

multTableIdealGens##multTableIdealGens = H

Copy link
Member

@d-torrance d-torrance Mar 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if the mutable list starts out empty, then we'll still end up allocating a bunch of new lists along the way as it grows, right? So it would probably be good to do something like this first since we know how long it will be:

mutlTableIdealsGens = new MutableList from (n+1)^2:null

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the suggestion. I'm getting errors from trying to create an ideal from a mutable list. Is there a nice way to generate an ideal from a mutable list that is officially supported?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can call toList on it first, e.g.:

i1 : R = QQ[x];

i2 : ideal toList new MutableList from {x}

o2 = ideal x

o2 : Ideal of R

NP = kernel MPP;
yp = (gens NP)_0;
M2 = matrix apply(H,z -> z*yp);
print(rank M2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this print intentional? If it's for debugging purposes could make it conditional on value of debugLevel.

)
export {"KGAlg","meataxe", "SnGroup"}

KGAlgebra = new Type of FreeAlgebraQuotient;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably also need to export the symbol KGAlgebra.

Comment on lines 50 to 65
local p;
local L;
local M;
local MP;
local y;
local m;
local q;
local Mp;
local M1;
local MPP;
local H;
local N;
local n;
local M2;
local NP;
local yp;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above about local symbols and :=.

return false;
);--Checks that the module generated by M1 is not a strict submodule of KG

H = apply(group G, z -> transpose(z)); --Generate list of group elements' matrices but transposed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine as is, but I wanted to point out this shorthand syntax:

Suggested change
H = apply(group G, z -> transpose(z)); --Generate list of group elements' matrices but transposed
H = apply(group G, transpose); --Generate list of group elements' matrices but transposed

Comment on lines 47 to 49
--True implies irreducible, false implies reducible
meataxe = method()
meataxe(FiniteGroupAction, FreeAlgebraQuotient,Ring) := (G,S,K) -> (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused, the standard Meataxe algorithm returns the indecomposable summands, no?
If your implementation only solves the decision problem, it could be called something like isIndecomposable or isIrreducible.

{Name => "Toshi Mowery", Email => "[email protected]"}
},
Headline => "A package for KG-algebras",
Keywords => {"KG-algebra"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keywords should be one (or more) of the categories on this page. I would recommend "Group Theory" instead.

@d-torrance d-torrance changed the base branch from master to development March 9, 2025 01:49
@mahrud
Copy link
Member

mahrud commented Mar 9, 2025

One more thought: I would consider naming your main type GroupAlgebra (or GroupRing) and the main constructor groupAlgebra (or groupRing). This is more closely aligned with the naming conventions.

@danielk011 danielk011 requested a review from d-torrance March 11, 2025 20:25
groupElts := g_0 .. g_n; -- group elements
FA := freeAlgebra(K,groupElts);
use FA; -- make FA our working ring
multTableIdealGens := new MutableList;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the suggestion above. Starting with an empty mutable list isn't much better than the old append implementation since we'll end up having to reallocate everything every time we grow it by one more element. But we know the final length, so we can start out with a mutable list of the correct length and not have to worry about it ever growing:

multTableIdealGens := new MutableList from (n + 1)^2:null

Another option would be to avoid mutable lists entirely and use apply:

multTableIdealGens = apply((n + 1)^2, k -> (
	(i, j) := quotientRemainder(k, n + 1);
	...
	H)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the suggested edits I've noticed that multTableIdealGens##multTableIdealGens = H adds new elements to the mutable list, growing its size instead of editing the empty entries. Am I missing something?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, yeah I missed that! multTableIdealGens##multTableIdealGens = H will always grow the list, even if we've allocated a bunch of elements at the beginning since #multTableIdealGens will always point one past the last index!

Instead, something like multTableIdealGens#((n + 1)*i + j) = H should work.

Reload=>true,
Headline => "A package for group algebras",
Keywords => {"Group Theory"},
DebuggingMode => true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DebuggingMode should either be false or (even better) removed, since false is the default.

multTableIdealGens##multTableIdealGens = H;
);
);
print multTableIdealGens;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to print this? I'd either remove it or swap it with something like if debugLevel > something then print ....

for x in (flatten entries L#0) do(
n := index(x);
M = M + (group G)#n * sub((flatten entries L#1)#m,K);
m = m+1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is totally optional, but if you're interested, you can use augmented assignment here:

M += (group G)#n * ...
m += 1

It also works for other binary operators like *, so line 74 could become:

Mp *= (apply(...

Key
meataxe
Headline
Boolean function implementing the meataxe algorithm determining the irreducibility of a finite group representation of a finite dimensional vector space. If the module is irreducible, returns true. Otherwise, the method returns a nontrivial submodule.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The builds are failing with the following error:

../../../../../Macaulay2/m2/document.m2:598:32:(1):[72]: error: document: documentation headlines must be less than 100 characters long:
  "Boolean function implementing the meataxe algorithm determining the irreducibility of a finite group representation of a finite dimensional vector space. If the module is irreducible, returns true. Otherwise, the method returns a nontrivial submodule."

In general, headlines should just be a few words. Most of this stuff can get moved elsewhere in the documentation node.

{Name => "Moses Samuelson-Lynn", Email => "[email protected]"},
{Name => "Toshi Mowery", Email => "[email protected]"}
},
Headline => "A package for group algebras",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests are failing because of the redundant "package for" in the headline:

/Users/runner/work/M2/M2/M2/Macaulay2/tests/normal/release-checklist.m2:1:1 error:
 --      --	    "^[A-Z]", -- headlines should not be capitalized, but hard to check
 --      	    "\\.$",   -- headlines should not end with a period
 --      	    "\\n",    -- headlines should not contain line breaks
 --      	    -- redundant clauses for package headlines:
 --      	    "(T|t)his (P|p)ackage",
 --      	    "(P|p)ackage (for|on|to)"}, opts.Headline));
 -- 
 -- i10 : if #pkgs > 0 then error("packages whose headlines doesn't follow guidelines:", newline,
 --           toString netList(toList \ pairs applyValues(pkgs, opts -> opts.Headline)))
 -- stdio:23:23:(3): error: packages whose headlines doesn't follow guidelines:
 -- +----------+----------------------------+
 -- |KGAlgebras|A package for group algebras|
 -- +----------+----------------------------+
 -- 
stdio:1:5:(3): error: test(s) #252 of package Core failed.

print(rank M2);
);
if rank M2 != rank (H#0) then (
return image M2;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes this function returns a boolean and sometimes it returns a module. That seems confusing for the caller -- how do they know what type to expect?

Would it make sense to return both as a sequence? So the caller could do something like:

(isIrreducible, M) = meataxe(G,S,K)
if isIrreducible then ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have another implementation of the meataxe for modules and we return a list of the indecomposable pieces. So if the input M is indecomposable, the ouput is just {M}. You could try this instead.

The underlying field of the other parameters.
Outputs
T:Boolean
Returns true if the Meataxe algorithm states that the K[G]-module is irreducible. Returns a nontrivial submodule if the module is reducible.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation should be updated since this doesn't return a boolean any more.

Also, now that a module is return in both cases, how do we know if it's irreducible?

@seangrate
Copy link
Contributor

One more thought: I would consider naming your main type GroupAlgebra (or GroupRing) and the main constructor groupAlgebra (or groupRing). This is more closely aligned with the naming conventions.

I'd also consider renaming the package "GroupAlgebras" or something along those lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants