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

fix: group algebras of additive groups with sparse rep #1685

Merged
merged 9 commits into from
Nov 19, 2024

Conversation

lgoettgens
Copy link
Contributor

@lgoettgens lgoettgens commented Nov 18, 2024

These were the necessary changes to make (sparse) group algebras with an (infinite) additive group that is not FinGenAbGroup.

To find these things, I defined a thin wrapper around FinGenAbGroup and tried to make that work with the existing things.

struct FooGroup <: AbstractAlgebra.AdditiveGroup
  G::FinGenAbGroup
end

struct FooGroupElem <: AbstractAlgebra.AdditiveGroupElem
  x::FinGenAbGroupElem
end

elem_type(::Type{FooGroup}) = FooGroupElem

parent_type(::Type{FooGroupElem}) = FooGroup

parent(x::FooGroupElem) = FooGroup(parent(x.x))

is_abelian(G::FooGroup) = is_abelian(G.G)

is_finite(G::FooGroup) = is_finite(G.G)

order(T, G::FooGroup) = order(T, G.G)

order(G::FooGroup) = order(G.G)

length(G::FooGroup) = length(G.G)

function Base.iterate(G::FooGroup)
  it = iterate(G.G)
  isnothing(it) && return nothing
  x, state = it
  return FooGroupElem(x), state
end

function Base.iterate(G::FooGroup, state)
  it = iterate(G.G, state)
  isnothing(it) && return nothing
  x, state = it
  return FooGroupElem(x), state
end

zero(G::FooGroup) = FooGroupElem(zero(G.G))

iszero(x::FooGroupElem) = iszero(x.x)

+(x::FooGroupElem, y::FooGroupElem) = FooGroupElem(x.x + y.x)

Base.hash(x::FooGroupElem, h::UInt) = hash(x.x, h)

Base.:(==)(x::FooGroupElem, y::FooGroupElem) = x.x == y.x

Base.rand(G::FooGroup) = FooGroupElem(rand(G.G))

export FooGroup, FooGroupElem

Copy link

codecov bot commented Nov 18, 2024

Codecov Report

Attention: Patch coverage is 81.57895% with 7 lines in your changes missing coverage. Please review.

Project coverage is 75.92%. Comparing base (0d6625a) to head (4b6c2e6).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
src/AlgAss/AlgGrp.jl 78.12% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1685      +/-   ##
==========================================
- Coverage   76.01%   75.92%   -0.09%     
==========================================
  Files         362      362              
  Lines      114299   114324      +25     
==========================================
- Hits        86882    86803      -79     
- Misses      27417    27521     +104     
Files with missing lines Coverage Δ
src/AlgAss/Elem.jl 88.35% <100.00%> (+0.18%) ⬆️
src/AlgAss/Types.jl 85.22% <100.00%> (-0.17%) ⬇️
src/AlgAss/AlgGrp.jl 74.87% <78.12%> (+0.46%) ⬆️

... and 30 files with indirect coverage changes

---- 🚨 Try these New Features:

@thofma
Copy link
Owner

thofma commented Nov 18, 2024

can you add a dummy print test? sprint("text/plain", QG) isa String or something like that?

@thofma
Copy link
Owner

thofma commented Nov 19, 2024

Thanks, looks good. I wish those functions were part of the "Group interface".

@lgoettgens
Copy link
Contributor Author

Yeah, something I might tackle in the future, depending on if my experiment with additive group algebras works out.

I have the feeling that I might find more things in here once I really start using group algebras in Oscar, but I would suggest that I then open another PR.

@thofma
Copy link
Owner

thofma commented Nov 19, 2024

I will merge once it is green modulo julia nightly. The "sparse" group algebras are not really battle tested, but I hope that at least the "ring interface" might be happy now.

@thofma thofma merged commit 1b69e3d into thofma:master Nov 19, 2024
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants