]> 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 7255533072acda6e0a92664b2d2439004a0beb95..c6de22399133794ae2485df41114dcbe90e55094 100644 (file)
@@ -1972,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()))
 
 
 
@@ -2050,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():
@@ -2139,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
@@ -2280,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):