]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: add is_invertible() for operators.
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 10 Oct 2019 13:04:51 +0000 (09:04 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 10 Oct 2019 13:04:51 +0000 (09:04 -0400)
mjo/eja/eja_operator.py

index cc1c5e0c4fc401c63628bafa85193fbcd8be470b..781d987518af32043ef11ccbb1533f9ad4f3b6ef 100644 (file)
@@ -383,6 +383,47 @@ class FiniteDimensionalEuclideanJordanAlgebraOperator(Map):
         return (self + (-other))
 
 
+    def is_invertible(self):
+        """
+        Return whether or not this operator is invertible.
+
+        SETUP::
+
+            sage: from mjo.eja.eja_algebra import RealSymmetricEJA, random_eja
+
+        EXAMPLES::
+
+            sage: J = RealSymmetricEJA(2)
+            sage: x = sum(J.gens())
+            sage: x.operator().matrix()
+            [  1 1/2   0]
+            [1/2   1 1/2]
+            [  0 1/2   1]
+            sage: x.operator().matrix().is_invertible()
+            True
+            sage: x.operator().is_invertible()
+            True
+
+        TESTS:
+
+        The identity operator is always invertible::
+
+            sage: set_random_seed()
+            sage: J = random_eja()
+            sage: J.one().operator().is_invertible()
+            True
+
+        The zero operator is never invertible::
+
+            sage: set_random_seed()
+            sage: J = random_eja()
+            sage: J.zero().operator().is_invertible()
+            False
+
+        """
+        return self.matrix().is_invertible()
+
+
     def matrix(self):
         """
         Return the matrix representation of this operator with respect