]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/eja/eja_algebra.py
eja: fix representation of "zero" in MatrixAlgebra.
[sage.d.git] / mjo / eja / eja_algebra.py
index 106a0cddec06355a952e71d75699677b25dd7da9..c6de22399133794ae2485df41114dcbe90e55094 100644 (file)
@@ -1021,7 +1021,8 @@ class FiniteDimensionalEJA(CombinatorialFreeModule):
 
             sage: J = ComplexHermitianEJA(2,field=QQ,orthonormalize=False)
             sage: J.matrix_space()
-            Full MatrixSpace of 4 by 4 dense matrices over Rational Field
+            Module of 2 by 2 matrices with entries in Algebraic Field over
+            the scalar ring Rational Field
             sage: J = QuaternionHermitianEJA(1,field=QQ,orthonormalize=False)
             sage: J.matrix_space()
             Module of 1 by 1 matrices with entries in Quaternion
@@ -1971,7 +1972,10 @@ class RealSymmetricEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA):
         # because the MatrixEJA is not presently a subclass of the
         # FDEJA class that defines rank() and one().
         self.rank.set_cache(n)
-        self.one.set_cache(self(A.one()))
+        if n == 0:
+            self.one.set_cache( self.zero() )
+        else:
+            self.one.set_cache(self(A.one()))
 
 
 
@@ -2049,7 +2053,10 @@ class ComplexHermitianEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA):
         # because the MatrixEJA is not presently a subclass of the
         # FDEJA class that defines rank() and one().
         self.rank.set_cache(n)
-        self.one.set_cache(self(A.one()))
+        if n == 0:
+            self.one.set_cache( self.zero() )
+        else:
+            self.one.set_cache(self(A.one()))
 
     @staticmethod
     def _max_random_instance_size():
@@ -2138,7 +2145,10 @@ class QuaternionHermitianEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA):
         # because the MatrixEJA is not presently a subclass of the
         # FDEJA class that defines rank() and one().
         self.rank.set_cache(n)
-        self.one.set_cache(self(A.one()))
+        if n == 0:
+            self.one.set_cache( self.zero() )
+        else:
+            self.one.set_cache(self(A.one()))
 
 
     @staticmethod
@@ -2162,6 +2172,7 @@ class OctonionHermitianEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA):
 
         sage: from mjo.eja.eja_algebra import (FiniteDimensionalEJA,
         ....:                                  OctonionHermitianEJA)
+        sage: from mjo.hurwitz import Octonions, OctonionMatrixAlgebra
 
     EXAMPLES:
 
@@ -2176,7 +2187,8 @@ class OctonionHermitianEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA):
     After a change-of-basis, the 2-by-2 algebra has the same
     multiplication table as the ten-dimensional Jordan spin algebra::
 
-        sage: b = OctonionHermitianEJA._denormalized_basis(2,QQ)
+        sage: A = OctonionMatrixAlgebra(2,Octonions(QQ),QQ)
+        sage: b = OctonionHermitianEJA._denormalized_basis(A)
         sage: basis = (b[0] + b[9],) + b[1:9] + (b[0] - b[9],)
         sage: jp = OctonionHermitianEJA.jordan_product
         sage: ip = OctonionHermitianEJA.trace_inner_product
@@ -2277,7 +2289,10 @@ class OctonionHermitianEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA):
         # because the MatrixEJA is not presently a subclass of the
         # FDEJA class that defines rank() and one().
         self.rank.set_cache(n)
-        self.one.set_cache(self(A.one()))
+        if n == 0:
+            self.one.set_cache( self.zero() )
+        else:
+            self.one.set_cache(self(A.one()))
 
 
 class AlbertEJA(OctonionHermitianEJA):
@@ -2955,11 +2970,13 @@ class CartesianProductEJA(FiniteDimensionalEJA):
             sage: J2 = ComplexHermitianEJA(1)
             sage: J = cartesian_product([J1,J2])
             sage: J.one().to_matrix()[0]
-            [1 0]
-            [0 1]
+            +---+
+            | 1 |
+            +---+
             sage: J.one().to_matrix()[1]
-            [1 0]
-            [0 1]
+            +---+
+            | 1 |
+            +---+
 
         ::