]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/matrix_algebra.py
matrix_algebra: use "[]" for trivial matrices and fix a test.
[sage.d.git] / mjo / matrix_algebra.py
index bd173eaba835b8b82632587e62fcf6a8e7ec4e44..69d9aebcabfd566bf95b797ec20444629c62c14f 100644 (file)
@@ -57,7 +57,18 @@ class MatrixAlgebraElement(IndexedFreeModuleElement):
             | 0 | 0 |
             +---+---+
 
+        TESTS::
+
+            sage: MatrixAlgebra(0,ZZ,ZZ).zero()
+            []
+
         """
+        if self.nrows() == 0 or self.ncols() == 0:
+            # Otherwise we get a crash or a blank space, depending on
+            # how hard we work for it. This is what MatrixSpace(...,
+            # 0) returns.
+            return "[]"
+
         return table(self.rows(), frame=True)._repr_()