From d2136d7696349ee48790818ed3927cbd9464e342 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 9 Mar 2021 16:21:40 -0500 Subject: [PATCH] matrix_algebra: use "[]" for trivial matrices and fix a test. --- mjo/hurwitz.py | 10 +++++----- mjo/matrix_algebra.py | 11 ++++++----- 2 files changed, 11 insertions(+), 10 deletions(-) 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): -- 2.44.2