From 65b40d31f7fae15f525d07c0efeb0b4c950cfcd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Fri, 29 Nov 2024 16:30:39 +0100 Subject: [PATCH] Add `hash(::QmodnZ)` --- src/GrpAb/Dual.jl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/GrpAb/Dual.jl b/src/GrpAb/Dual.jl index 7196e6f356..60e70e8090 100644 --- a/src/GrpAb/Dual.jl +++ b/src/GrpAb/Dual.jl @@ -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) @@ -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]