Skip to content

Commit 6a56950

Browse files
author
Matthias Koeppe
committed
Matrix_mod2_dense.str: Accept and pass on parameters left_border, ...
1 parent 4138aa6 commit 6a56950

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/sage/matrix/matrix_mod2_dense.pyx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,9 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse
346346

347347

348348
def str(self, rep_mapping=None, zero=None, plus_one=None, minus_one=None,
349-
*, unicode=False, shape=None, character_art=False):
349+
*, unicode=False, shape=None, character_art=False,
350+
left_border=None, right_border=None,
351+
top_border=None, bottom_border=None):
350352
r"""
351353
Return a nice string representation of the matrix.
352354
@@ -384,6 +386,16 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse
384386
:class:`~sage.typeset.unicode_art.UnicodeArt` which support line
385387
breaking of wide matrices that exceed the window width
386388
389+
- ``left_border``, ``right_border`` -- sequence (default: ``None``);
390+
if not ``None``, call :func:`str` on the elements and use the
391+
results as labels for the rows of the matrix. The labels appear
392+
outside of the parentheses.
393+
394+
- ``top_border``, ``bottom_border`` -- sequence (default: ``None``);
395+
if not ``None``, call :func:`str` on the elements and use the
396+
results as labels for the columns of the matrix. The labels appear
397+
outside of the parentheses.
398+
387399
EXAMPLES::
388400
389401
sage: B = matrix(GF(2), 3, 3, [0, 1, 0, 0, 1, 1, 0, 0, 0])
@@ -416,13 +428,19 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse
416428
# Set the mapping based on keyword arguments
417429
# We ignore minus_one (it's only there for compatibility with Matrix)
418430
if (rep_mapping is not None or zero is not None or plus_one is not None
419-
or unicode or shape is not None or character_art):
431+
or unicode or shape is not None or character_art
432+
or left_border is not None or right_border is not None
433+
or top_border is not None or bottom_border is not None):
420434
# Shunt mappings off to the generic code since they might not be
421435
# single characters
422436
return matrix_dense.Matrix_dense.str(self, rep_mapping=rep_mapping,
423437
zero=zero, plus_one=plus_one,
424438
unicode=unicode, shape=shape,
425-
character_art=character_art)
439+
character_art=character_art,
440+
left_border=left_border,
441+
right_border=right_border,
442+
top_border=top_border,
443+
bottom_border=bottom_border)
426444

427445
if self._nrows == 0 or self._ncols == 0:
428446
return "[]"

0 commit comments

Comments
 (0)