From 8daa86df3113f33bf774294f3daf7013a98559cd Mon Sep 17 00:00:00 2001 From: kalmar Date: Sun, 16 Jul 2017 21:44:42 +0200 Subject: [PATCH 1/2] try...catch are slow --- src/GroupRings.jl | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/GroupRings.jl b/src/GroupRings.jl index 5610f3c..4985965 100644 --- a/src/GroupRings.jl +++ b/src/GroupRings.jl @@ -128,11 +128,7 @@ function (RG::GroupRing)(T::Type=Int) end function (RG::GroupRing)(g::GroupElem, T::Type=Int) - g = try - RG.group(g) - catch - throw("Can't coerce $g to the underlying group of $RG") - end + g = RG.group(g) result = RG(T) result[g] = one(T) return result From c1e2d4209adb1319d286bc01eb945056af1745b7 Mon Sep 17 00:00:00 2001 From: kalmar Date: Sun, 16 Jul 2017 21:45:24 +0200 Subject: [PATCH 2/2] to match e.g. sparse and dense zeros... ugly --- src/GroupRings.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GroupRings.jl b/src/GroupRings.jl index 4985965..fdaf728 100644 --- a/src/GroupRings.jl +++ b/src/GroupRings.jl @@ -167,7 +167,7 @@ function deepcopy_internal(X::GroupRingElem, dict::ObjectIdDict) end function hash(X::GroupRingElem, h::UInt) - return hash(X.coeffs, hash(parent(X), h)) + return hash(full(X.coeffs), hash(parent(X), hash(GroupRingElem, h))) end function getindex(X::GroupRingElem, n::Int)