Skip to content

Commit a54d377

Browse files
author
Release Manager
committed
gh-36634: permutation_normal_form : case of empty matrices fixes #36629 ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. URL: #36634 Reported by: Frédéric Chapoton Reviewer(s): Matthias Köppe
2 parents 505b6a4 + 15dd435 commit a54d377

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/sage/matrix/matrix2.pyx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8575,15 +8575,27 @@ cdef class Matrix(Matrix1):
85758575

85768576
TESTS::
85778577

8578+
sage: # needs sage.graphs
85788579
sage: M = matrix(ZZ, [[3, 4, 5], [3, 4, 5], [3, 5, 4], [2, 0,1]])
8579-
sage: M.permutation_normal_form() # needs sage.graphs
8580+
sage: M.permutation_normal_form()
85808581
[5 4 3]
85818582
[5 4 3]
85828583
[4 5 3]
85838584
[1 0 2]
8585+
sage: M = matrix(ZZ, 0, 0, [])
8586+
sage: M.permutation_normal_form()
8587+
[]
8588+
sage: M.permutation_normal_form(check=True)
8589+
([], ((), ()))
85848590
"""
85858591
nrows = self.nrows()
85868592
ncols = self.ncols()
8593+
if not nrows or not ncols:
8594+
if not check:
8595+
return self
8596+
from sage.groups.perm_gps.permgroup_named import SymmetricGroup
8597+
return (self, (SymmetricGroup(nrows).one(),
8598+
SymmetricGroup(ncols).one()))
85878599

85888600
# A helper
85898601
def new_sorted_matrix(m):

0 commit comments

Comments
 (0)