Skip to content

Commit

Permalink
Add hash(::QmodnZ)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Nov 29, 2024
1 parent dbb016f commit 65b40d3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/GrpAb/Dual.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ function Base.:(==)(a::QmodnZ, b::QmodnZ)
return a.n == b.n && a.d == b.d
end

function Base.hash(a::QmodnZ, h::UInt)
h = hash(a.n, h)
h = hash(a.d, h)
return h
end

function Base.:(==)(a::QmodnZElem, b::QmodnZElem)
if parent(a).trivialmodulus
return is_integral(a.elt - b.elt)
Expand All @@ -158,7 +164,7 @@ function Base.hash(a::QmodnZElem, h::UInt)
if parent(a).trivialmodulus
return hash(a.elt, h)
end
error("not implemented")
return h
end

for T in [ZZRingElem, Integer, QQFieldElem, Rational]
Expand Down

0 comments on commit 65b40d3

Please sign in to comment.