From: Michael Orlitzky Date: Tue, 9 Mar 2021 21:21:40 +0000 (-0500) Subject: matrix_algebra: use "[]" for trivial matrices and fix a test. X-Git-Url: http://gitweb.michael.orlitzky.com/?p=sage.d.git;a=commitdiff_plain;h=d2136d7696349ee48790818ed3927cbd9464e342 matrix_algebra: use "[]" for trivial matrices and fix a test. --- diff --git a/mjo/hurwitz.py b/mjo/hurwitz.py index 57f6578..10b308d 100644 --- a/mjo/hurwitz.py +++ b/mjo/hurwitz.py @@ -715,11 +715,11 @@ class ComplexMatrixAlgebra(HurwitzMatrixAlgebra): sage: (I,) = A.entry_algebra().gens() sage: A([ [1+I, 1], ....: [-1, -I] ]) - +-------+----+ - | I + 1 | 1 | - +-------+----+ - | -1 | -I | - +-------+----+ + +---------+------+ + | 1 + 1*I | 1 | + +---------+------+ + | -1 | -1*I | + +---------+------+ :: diff --git a/mjo/matrix_algebra.py b/mjo/matrix_algebra.py index 29a37d1..69d9aeb 100644 --- a/mjo/matrix_algebra.py +++ b/mjo/matrix_algebra.py @@ -60,15 +60,16 @@ class MatrixAlgebraElement(IndexedFreeModuleElement): TESTS:: sage: MatrixAlgebra(0,ZZ,ZZ).zero() - 0 + [] """ 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. - return self.parent().entry_algebra().zero().__repr__() + # 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(rs, frame=True)._repr_() + return table(self.rows(), frame=True)._repr_() def list(self):