Skip to content
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

Streamline powers of Lie algebra modules #3081

Merged
merged 18 commits into from
Jan 17, 2024

Conversation

lgoettgens
Copy link
Member

@lgoettgens lgoettgens commented Dec 7, 2023

Make the code very similar to the exterior powers of ModuleFP by @HechtiDerLachs.

  • exterior powers
  • symmetric powers
  • tensor powers
  • cleanup of generic "power code"

Furthermore, fix some type instabilities in the exterior power code of ModuleFP.

@lgoettgens lgoettgens added WIP NOT ready for merging topic: LieAlgebras labels Dec 7, 2023
@lgoettgens lgoettgens marked this pull request as draft December 7, 2023 16:36
HechtiDerLachs
HechtiDerLachs previously approved these changes Dec 8, 2023
Copy link
Collaborator

@HechtiDerLachs HechtiDerLachs left a comment

Choose a reason for hiding this comment

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

Looks good. As already said: At some point we need to streamline the multiplication map.

experimental/LieAlgebras/src/LieAlgebraModule.jl Outdated Show resolved Hide resolved
experimental/LieAlgebras/src/LieAlgebraModule.jl Outdated Show resolved Hide resolved
src/Modules/ExteriorPowers/Generic.jl Outdated Show resolved Hide resolved
@lgoettgens lgoettgens force-pushed the lg/lie-powers branch 8 times, most recently from da83aab to 6099be7 Compare December 21, 2023 16:14
@lgoettgens lgoettgens removed the WIP NOT ready for merging label Dec 21, 2023
@lgoettgens
Copy link
Member Author

This PR is now ready to be reviewed and merged from my POV. There is still some stuff do do around direct sums and tensor products, but I would like to postpone that to a future PR that tackles #3059 for Lie algebra modules.

@HechtiDerLachs could you please in particular have a look at the changes in src/? It should only be the addition of type assertions where they are needed for inference to be more successful. You can see the result when calling @code_warntype exterior_power(F, 2) where F is a free module and comparing that to the latest master.

@lgoettgens lgoettgens marked this pull request as ready for review December 21, 2023 18:06
Copy link

codecov bot commented Dec 22, 2023

Codecov Report

Merging #3081 (8afcbeb) into master (c26a436) will increase coverage by 0.12%.
Report is 7 commits behind head on master.
The diff coverage is 90.84%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3081      +/-   ##
==========================================
+ Coverage   81.14%   81.27%   +0.12%     
==========================================
  Files         556      556              
  Lines       73894    74005     +111     
==========================================
+ Hits        59963    60144     +181     
+ Misses      13931    13861      -70     
Files Coverage Δ
...eAndHyperComplexes/src/Morphisms/linear_strands.jl 95.23% <100.00%> (ø)
...perComplexes/src/Morphisms/simplified_complexes.jl 95.49% <100.00%> (ø)
experimental/LieAlgebras/src/LieAlgebras.jl 100.00% <ø> (ø)
...rimental/LieAlgebras/test/LieAlgebraModule-test.jl 100.00% <100.00%> (ø)
src/Modules/ExteriorPowers/Generic.jl 93.22% <100.00%> (ø)
src/Modules/ModulesGraded.jl 81.78% <100.00%> (ø)
src/Modules/UngradedModules/FreeModElem.jl 96.84% <100.00%> (ø)
src/Modules/UngradedModules/SubquoModule.jl 74.37% <100.00%> (ø)
src/Modules/UngradedModules/SubquoModuleElem.jl 84.92% <100.00%> (ø)
src/Modules/ExteriorPowers/FreeModules.jl 98.38% <86.66%> (-1.62%) ⬇️
... and 4 more

... and 13 files with indirect coverage changes

@lgoettgens lgoettgens force-pushed the lg/lie-powers branch 2 times, most recently from d02b98f to a47ce6b Compare January 4, 2024 12:44
@lgoettgens
Copy link
Member Author

bump @HechtiDerLachs

@lgoettgens lgoettgens closed this Jan 9, 2024
@lgoettgens lgoettgens reopened this Jan 9, 2024
src/Modules/ExteriorPowers/FreeModules.jl Outdated Show resolved Hide resolved
src/Modules/ExteriorPowers/FreeModules.jl Show resolved Hide resolved
src/Modules/ExteriorPowers/FreeModules.jl Outdated Show resolved Hide resolved
Comment on lines +2 to +3
@attr Dict{Int, Tuple{typeof(F), MapFromFunc}} function _exterior_powers(F::ModuleFP)
return Dict{Int, Tuple{typeof(F), MapFromFunc}}()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
@attr Dict{Int, Tuple{typeof(F), MapFromFunc}} function _exterior_powers(F::ModuleFP)
return Dict{Int, Tuple{typeof(F), MapFromFunc}}()
@attr Dict{Int, Tuple{typeof(F), <:MapFromFunc}} function _exterior_powers(F::ModuleFP)
return Dict{Int, Tuple{typeof(F), MapFromFunc}}()

This might be a bit too restrictive. Maybe, one day we change the return type. And they are both abstract, so no harm is done staying with just Map right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Tuples are invariant in julia, thus the <: shouldn't be there.
As all of this is purely internal, we can change that to Map back anytime we want. But making it as concrete as possible helps type inference massively. In this particular case, it can use some of the annotations in the MapFromFunc code in Hecke

src/Modules/ExteriorPowers/SubQuo.jl Outdated Show resolved Hide resolved
@HechtiDerLachs
Copy link
Collaborator

Tests still fail. Other than that, I can approve for my part. Let me know when you're ready.

@@ -513,7 +513,7 @@ function degree(f::FreeModElem)
iszero(f) && return A[0]
f.d = isa(f.d, GrpAbFinGenElem) ? f.d : determine_degree_from_SR(coordinates(f), degrees(parent(f)))
isa(f.d, GrpAbFinGenElem) || error("The specified element is not homogeneous.")
return f.d
return f.d::GrpAbFinGenElem
Copy link
Member Author

Choose a reason for hiding this comment

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

btw this was the culprit

@lgoettgens
Copy link
Member Author

I found a small fix for the failure, that made it possible to revert some other changes to enhance readability.
Let's hope that I broke nothing else.

@lgoettgens
Copy link
Member Author

Tests still fail. Other than that, I can approve for my part. Let me know when you're ready.

CI now looks good

Copy link
Collaborator

@HechtiDerLachs HechtiDerLachs left a comment

Choose a reason for hiding this comment

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

I think the style adjustment is not worth running the tests again. So if there's nothing else, go ahead with the merge from my side.

R = base_ring(M)
((p >= 0) && (p <= n)) || error("exponent out of range")
R = base_ring(M)::base_ring_type(M)
@req 0 <= p <= n "Exponent out of bounds"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
@req 0 <= p <= n "Exponent out of bounds"
@req 0 <= p <= n "exponent out of bounds"

@fingolfin fingolfin merged commit bc93413 into oscar-system:master Jan 17, 2024
25 checks passed
@lgoettgens lgoettgens deleted the lg/lie-powers branch January 17, 2024 14:53
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.

3 participants