From 2d1c5371e13afc439cf56f5ad1d3fd73d0202533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Tue, 20 Aug 2024 16:31:28 +0200 Subject: [PATCH] Cache `cartan_symmetrizer` --- experimental/LieAlgebras/src/RootSystem.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/experimental/LieAlgebras/src/RootSystem.jl b/experimental/LieAlgebras/src/RootSystem.jl index 816e91de741c..8f1d55f9dba9 100644 --- a/experimental/LieAlgebras/src/RootSystem.jl +++ b/experimental/LieAlgebras/src/RootSystem.jl @@ -127,6 +127,10 @@ function cartan_matrix(R::RootSystem) return R.cartan_matrix end +@attr Vector{ZZRingElem} function cartan_symmetrizer(R::RootSystem) + return cartan_symmetrizer(cartan_matrix(R); check=false) +end + @doc raw""" coroot(R::RootSystem, i::Int) -> RootSpaceElem @@ -912,8 +916,9 @@ end function dot(r::RootSpaceElem, w::WeightLatticeElem) @req root_system(r) === root_system(w) "parent root system mismatch" + symmetrizer = cartan_symmetrizer(root_system(r)) return sum( - r[i] * cartan_symmetrizer(cartan_matrix(root_system(r)); check=false)[i] * w[i] for + r[i] * symmetrizer[i] * w[i] for i in 1:rank(root_system(r)); init=zero(QQ), )