]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: add inner_product() for DirectSumEJA.
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 13 Nov 2020 15:34:30 +0000 (10:34 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 13 Nov 2020 15:34:30 +0000 (10:34 -0500)
mjo/eja/eja_algebra.py

index 183e4cb978c233dbac31e321e855978309b27687..def2028a6a29a0d64733c8ed5c8a38e226c37f81 100644 (file)
@@ -2440,3 +2440,42 @@ class DirectSumEJA(FiniteDimensionalEuclideanJordanAlgebra):
         iota_left = lambda x: self.from_vector(I1*x.to_vector())
         iota_right = lambda x: self.from_vector(I2*+x.to_vector())
         return (iota_left, iota_right)
+
+    def inner_product(self, x, y):
+        r"""
+        The standard Cartesian inner-product.
+
+        We project ``x`` and ``y`` onto our factors, and add up the
+        inner-products from the subalgebras.
+
+        SETUP::
+
+
+            sage: from mjo.eja.eja_algebra import (HadamardEJA,
+            ....:                                  QuaternionHermitianEJA,
+            ....:                                  DirectSumEJA)
+
+        EXAMPLE::
+
+            sage: J1 = HadamardEJA(3)
+            sage: J2 = QuaternionHermitianEJA(2,QQ,normalize_basis=False)
+            sage: J = DirectSumEJA(J1,J2)
+            sage: x1 = J1.one()
+            sage: x2 = x1
+            sage: y1 = J2.one()
+            sage: y2 = y1
+            sage: x1.inner_product(x2)
+            3
+            sage: y1.inner_product(y2)
+            2
+            sage: J.one().inner_product(J.one())
+            5
+
+        """
+        (pi_left, pi_right) = self.projections()
+        x1 = pi_left(x)
+        x2 = pi_right(x)
+        y1 = pi_left(y)
+        y2 = pi_right(y)
+
+        return (x1.inner_product(y1) + x2.inner_product(y2))