]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
mjo/clan: add idempotent() method for normal decompositions
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 24 Jan 2026 02:14:38 +0000 (21:14 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 24 Jan 2026 02:14:38 +0000 (21:14 -0500)
Just a helper to get the idempotent (diagonal) elements without
having to care what the basis indices are.

mjo/clan/unital_clan.py

index ab601be1c220942e676829ab4cdac356964da3f4..a38ea801751a2ac436fc68dbbb46b5a70cc14ff7 100644 (file)
@@ -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"""