From 77c788c62d66d031caa07a0f448a8a5be5a886ec Mon Sep 17 00:00:00 2001 From: Janika Peters Date: Thu, 19 Dec 2024 14:35:16 +0100 Subject: [PATCH] Fix reflection for negative roots --- experimental/LieAlgebras/src/LieAlgebras.jl | 1 + experimental/LieAlgebras/src/RootSystem.jl | 3 ++- experimental/LieAlgebras/test/RootSystem-test.jl | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/experimental/LieAlgebras/src/LieAlgebras.jl b/experimental/LieAlgebras/src/LieAlgebras.jl index 020861f40d7..68550375088 100644 --- a/experimental/LieAlgebras/src/LieAlgebras.jl +++ b/experimental/LieAlgebras/src/LieAlgebras.jl @@ -80,6 +80,7 @@ import ..Oscar: parent_type, permutation_group, rank, + reflection, root, roots, sub, diff --git a/experimental/LieAlgebras/src/RootSystem.jl b/experimental/LieAlgebras/src/RootSystem.jl index 784dddbd9b2..908413a5fc2 100644 --- a/experimental/LieAlgebras/src/RootSystem.jl +++ b/experimental/LieAlgebras/src/RootSystem.jl @@ -1113,8 +1113,9 @@ function reflection(beta::RootSpaceElem) b, index_of_beta = is_positive_root_with_index(beta) if !b - index_of_beta = is_root_with_index(beta) - rk + b, index_of_beta = is_negative_root_with_index(beta) end + @req b "Not a root" found_simple_root = index_of_beta <= rk current_index = index_of_beta diff --git a/experimental/LieAlgebras/test/RootSystem-test.jl b/experimental/LieAlgebras/test/RootSystem-test.jl index 48c98252f99..e469a6d1c4e 100644 --- a/experimental/LieAlgebras/test/RootSystem-test.jl +++ b/experimental/LieAlgebras/test/RootSystem-test.jl @@ -380,11 +380,11 @@ @test r * reflection(r) == -r end - R = root_system([(:A, 1), (:A, 1)]) + R = root_system([(:B, 2), (:A, 2)]) for r in roots(R) @test r * reflection(r) == -r for r2 in roots(R) - if r != r2 && r != -r2 + if is_zero(dot(r, r2)) #roots are orthogonal @test r2 * reflection(r) == r2 end end