-
Notifications
You must be signed in to change notification settings - Fork 253
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
base: development
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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
M2/Macaulay2/packages/KGAlgebras.m2
Outdated
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
M2/Macaulay2/packages/KGAlgebras.m2
Outdated
NP = kernel MPP; | ||
yp = (gens NP)_0; | ||
M2 = matrix apply(H,z -> z*yp); | ||
print(rank M2); |
There was a problem hiding this comment.
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
.
M2/Macaulay2/packages/KGAlgebras.m2
Outdated
) | ||
export {"KGAlg","meataxe", "SnGroup"} | ||
|
||
KGAlgebra = new Type of FreeAlgebraQuotient; |
There was a problem hiding this comment.
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
.
M2/Macaulay2/packages/KGAlgebras.m2
Outdated
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; |
There was a problem hiding this comment.
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 :=
.
M2/Macaulay2/packages/KGAlgebras.m2
Outdated
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 |
There was a problem hiding this comment.
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:
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 |
M2/Macaulay2/packages/KGAlgebras.m2
Outdated
--True implies irreducible, false implies reducible | ||
meataxe = method() | ||
meataxe(FiniteGroupAction, FreeAlgebraQuotient,Ring) := (G,S,K) -> ( |
There was a problem hiding this comment.
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
.
M2/Macaulay2/packages/KGAlgebras.m2
Outdated
{Name => "Toshi Mowery", Email => "[email protected]"} | ||
}, | ||
Headline => "A package for KG-algebras", | ||
Keywords => {"KG-algebra"}, |
There was a problem hiding this comment.
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.
One more thought: I would consider naming your main type |
M2/Macaulay2/packages/KGAlgebras.m2
Outdated
groupElts := g_0 .. g_n; -- group elements | ||
FA := freeAlgebra(K,groupElts); | ||
use FA; -- make FA our working ring | ||
multTableIdealGens := new MutableList; |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
M2/Macaulay2/packages/KGAlgebras.m2
Outdated
Reload=>true, | ||
Headline => "A package for group algebras", | ||
Keywords => {"Group Theory"}, | ||
DebuggingMode => true, |
There was a problem hiding this comment.
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.
M2/Macaulay2/packages/KGAlgebras.m2
Outdated
multTableIdealGens##multTableIdealGens = H; | ||
); | ||
); | ||
print multTableIdealGens; |
There was a problem hiding this comment.
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 ...
.
M2/Macaulay2/packages/KGAlgebras.m2
Outdated
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 |
There was a problem hiding this comment.
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(...
M2/Macaulay2/packages/KGAlgebras.m2
Outdated
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. |
There was a problem hiding this comment.
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.
M2/Macaulay2/packages/KGAlgebras.m2
Outdated
{Name => "Moses Samuelson-Lynn", Email => "[email protected]"}, | ||
{Name => "Toshi Mowery", Email => "[email protected]"} | ||
}, | ||
Headline => "A package for group algebras", |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 ...
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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?
I'd also consider renaming the package "GroupAlgebras" or something along those lines. |
No description provided.