From 19d6ce3ba6c61785ac35f21695a1ce696c786494 Mon Sep 17 00:00:00 2001 From: Travis Scrimshaw Date: Thu, 11 Apr 2024 12:39:49 +0900 Subject: [PATCH] Speed up symmetric group simple_module_rank(). --- src/sage/combinat/specht_module.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/combinat/specht_module.py b/src/sage/combinat/specht_module.py index 127903829f7..260a3fbde43 100644 --- a/src/sage/combinat/specht_module.py +++ b/src/sage/combinat/specht_module.py @@ -1351,12 +1351,12 @@ def tabloid_gram_matrix(la, base_ring): [4 1 1 2 4] """ from sage.combinat.tableau import StandardTableaux - ST = StandardTableaux(la) + ST = list(StandardTableaux(la)) def bilinear_form(p1, p2): if len(p2) < len(p1): p1, p2 = p2, p1 - return sum(c1 * p2.get(T1, 0) for T1, c1 in p1.items() if c1) + return sum(c1 * p2[T1] for T1, c1 in p1.items() if c1 and T1 in p2) PT = {T: polytabloid(T) for T in ST} gram_matrix = [[bilinear_form(PT[T1], PT[T2]) for T1 in ST] for T2 in ST]