]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
mjo/clan/clan_element.py: add norm methods
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 27 Mar 2026 00:56:17 +0000 (20:56 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 27 Mar 2026 00:56:17 +0000 (20:56 -0400)
For convenience, define norm() and norm_vinberg() in terms of the
corresponding inner product methods. This will usually involve a
sqrt(), and I have not thought very hard about how to handle that
intelligently.

mjo/clan/clan_element.py

index 8c402ea09a508805a2f7d26e1504f5bb7cb0bce8..7c0314252d61df460336ec1c9d98f99263038057 100644 (file)
@@ -28,8 +28,9 @@ class ClanElement(IndexedFreeModuleElement):
 
         EXAMPLES:
 
-        In the clan of real symmetric matrices under the Ishi norm,
-        it is easy to check that the idempotents all have norm 1/2::
+        In the clan of real symmetric matrices under the Ishi norm, it
+        is easy to check that the idempotents all have norm-squared
+        ``1/2``::
 
             sage: C = RealSymmetricClan(3)
             sage: b = C.basis()
@@ -42,9 +43,40 @@ class ClanElement(IndexedFreeModuleElement):
         return sum(
             xi*yj*self.parent().inner_product_on_basis(bi, bj)
             for (bi, xi) in self.items()
-            for (bj, yj)  in other.items()
+            for (bj, yj) in other.items()
         )
 
+    def norm(self):
+        r"""
+        The norm of this element.
+
+        This norm is with respect to the inner product used to
+        construct the clan.
+
+        .. SEEALSO::
+
+        * :meth:`norm_vinberg`
+
+        SETUP::
+
+            sage: from mjo.clan.t_algebra_clan import RealSymmetricClan
+
+        EXAMPLES:
+
+        In the clan of real symmetric matrices under the Ishi norm, it
+        is easy to check that the idempotents all have norm-squared
+        ``1/2``::
+
+            sage: C = RealSymmetricClan(3)
+            sage: b = C.basis()
+            sage: all( b[i,j,k].norm() == (~QQ(2)).sqrt()
+            ....:      for (i,j,k) in b.keys()
+            ....:      if j == i )
+            True
+
+        """
+        return self.inner_product(self).sqrt()
+
     def inner_product_vinberg(self, other):
         r"""
         The Vinberg inner product of ``self`` and ``other``.
@@ -60,7 +92,7 @@ class ClanElement(IndexedFreeModuleElement):
 
         From the definition of "Sp(z)" and Lemma 2 (pp. 380--382),
         it follows that for a symmetric matrix this is twice the
-        usual trace::
+        usual trace inner product::
 
             sage: C = RealSymmetricClan(3)
             sage: X = matrix(QQ, [[2,6,10],[6,10,14],[10,14,18]])
@@ -75,6 +107,31 @@ class ClanElement(IndexedFreeModuleElement):
         """
         return (self*other).leftreg().trace()
 
+    def norm_vinberg(self):
+        r"""
+        The norm of ``self`` under :meth:`inner_product_vinberg`.
+
+        SETUP::
+
+            sage: from mjo.clan.t_algebra_clan import RealSymmetricClan
+
+        EXAMPLES:
+
+        From the definition of "Sp(z)" and Lemma 2 (pp. 380--382), it
+        follows that for a symmetric matrix this is ``sqrt(2)`` times
+        the usual trace norm::
+
+            sage: C = RealSymmetricClan(3)
+            sage: X = matrix(QQ, [[2,6,10],[6,10,14],[10,14,18]])
+            sage: (X*X).trace().sqrt()
+            2*sqrt(273)
+            sage: X = C.from_matrix(X)
+            sage: X.norm_vinberg()
+            2*sqrt(546)
+
+        """
+        return self.inner_product_vinberg(self).sqrt()
+
     def leftreg(self):
         r"""
         Return the left-regular representation of this element.