From 03a817ac724a10ee1c4cc041280ab8e0365778f1 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 23 Jan 2026 21:14:38 -0500 Subject: [PATCH] mjo/clan: add idempotent() method for normal decompositions Just a helper to get the idempotent (diagonal) elements without having to care what the basis indices are. --- mjo/clan/unital_clan.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/mjo/clan/unital_clan.py b/mjo/clan/unital_clan.py index ab601be..a38ea80 100644 --- a/mjo/clan/unital_clan.py +++ b/mjo/clan/unital_clan.py @@ -110,9 +110,7 @@ class NormalDecomposition(UnitalClan): prefix=None, bracket=False): # The normal decomposition assumes that we already have a - # lower-triangular (Ishi) basis of the form (i,j) or (i,j,k) - # -- the latter when the off-diagonals are greater-than-one - # dimensional. + # lower-triangular (Ishi) basis of the form (i,j,k). self._rank = 1 + max( k[0] for k in vector_space.indices() if k[0] == k[1] ) @@ -132,6 +130,27 @@ class NormalDecomposition(UnitalClan): """ return self._rank + def idempotent(self, i): + r""" + Return the i'th idempotent in this clan. + + EXAMPLES:: + + sage: C = SnClan(3) + sage: C.idempotent(0) + B(0, 0, 1) + sage: C.idempotent(1) + B(1, 1, 1) + sage: C.idempotent(2) + B(2, 2, 1) + + """ + return self.sum_of_monomials( + (j,k,l) + for (j,k,l) in self.indices() + if j == i and k == i + ) + class SnClan(NormalDecomposition): r""" -- 2.51.0