Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
vneiger committed Jan 31, 2024
1 parent 9f15f69 commit f503b52
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/sage/matrix/matrix_polynomial_dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3980,6 +3980,13 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense):
sage: Matrix(pR, 3, 2, [[x,0],[1,0],[x+1,0]]).minimal_kernel_basis()
[6 x 0]
[6 6 1]
TESTS:
We check that PR #37208 is fixed::
sage: Matrix(pR, 2, 0).minimal_kernel_basis().is_sparse()
False
"""
from sage.matrix.constructor import matrix

Expand All @@ -4001,11 +4008,11 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense):
return matrix(self.base_ring(), 0, m)

if n == 0: # early exit: kernel is identity
return matrix.identity(self.base_ring(), m, m)
return matrix.identity(self.base_ring(), m)

d = self.degree() # well defined since m > 0 and n > 0
if d == -1: # matrix is zero: kernel is identity
return matrix.identity(self.base_ring(), m, m)
return matrix.identity(self.base_ring(), m)

# degree bounds on the kernel basis
degree_bound = min(m,n)*d+max(shifts)
Expand Down Expand Up @@ -4040,11 +4047,11 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense):
return matrix(self.base_ring(), n, 0)

if m == 0: # early exit: kernel is identity
return matrix.identity(self.base_ring(), n, n)
return matrix.identity(self.base_ring(), n)

d = self.degree() # well defined since m > 0 and n > 0
if d == -1: # matrix is zero
return matrix.identity(self.base_ring(), n, n)
return matrix.identity(self.base_ring(), n)

# degree bounds on the kernel basis
degree_bound = min(m,n)*d+max(shifts)
Expand Down

0 comments on commit f503b52

Please sign in to comment.