From 3640a14bc3089bacbf0c70fb084e0d81c0753681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Fri, 30 Aug 2024 15:41:34 +0200 Subject: [PATCH] Try to make doctests deterministic --- experimental/LieAlgebras/src/LieAlgebraModule.jl | 6 +++--- experimental/LieAlgebras/src/RootSystem.jl | 12 ++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/experimental/LieAlgebras/src/LieAlgebraModule.jl b/experimental/LieAlgebras/src/LieAlgebraModule.jl index d5ec121cc84b..8d8a916d8317 100644 --- a/experimental/LieAlgebras/src/LieAlgebraModule.jl +++ b/experimental/LieAlgebras/src/LieAlgebraModule.jl @@ -1530,14 +1530,14 @@ julia> L = lie_algebra(QQ, :A, 3); julia> character(L, [2, 0, 0]) Dict{Vector{Int64}, Int64} with 10 entries: - [0, -2, 2] => 1 [0, 1, 0] => 1 + [0, -2, 2] => 1 [0, 0, -2] => 1 - [-2, 2, 0] => 1 [-1, 1, -1] => 1 + [-2, 2, 0] => 1 [1, -1, 1] => 1 - [1, 0, -1] => 1 [-1, 0, 1] => 1 + [1, 0, -1] => 1 [2, 0, 0] => 1 [0, -1, 0] => 1 ``` diff --git a/experimental/LieAlgebras/src/RootSystem.jl b/experimental/LieAlgebras/src/RootSystem.jl index 117b14e1fa27..2b059665e3cf 100644 --- a/experimental/LieAlgebras/src/RootSystem.jl +++ b/experimental/LieAlgebras/src/RootSystem.jl @@ -150,6 +150,14 @@ function fundamental_weights(R::RootSystem) return [fundamental_weight(R, i) for i in 1:rank(R)] end +function Base.hash(R::RootSystem, h::UInt) + # even though we don't have a == method for RootSystem, we add a hash method + # to make hashing of RootSpaceElem and WeightLatticeElem more deterministic + b = 0xeb5362118dea2a0e % UInt + h = hash(cartan_matrix(R), h) + return xor(b, h) +end + function is_simple(R::RootSystem) if is_finite(weyl_group(R)) return length(root_system_type(R)) == 1 @@ -1040,8 +1048,8 @@ julia> dominant_weights(Vector{Int}, R, [3, 0, 1]) 7-element Vector{Vector{Int64}}: [3, 0, 1] [1, 1, 1] - [0, 0, 3] [2, 0, 1] + [0, 0, 3] [0, 1, 1] [1, 0, 1] [0, 0, 1] @@ -1263,8 +1271,8 @@ julia> tensor_product_decomposition(R, [1, 1], [1, 1]) MSet{Vector{Int64}} with 10 elements: [0, 0] [0, 4] - [2, 0] [0, 2] : 2 + [2, 0] [1, 0] [2, 2] [3, 0]