Skip to content

Commit f0859bf

Browse files
committed
fix crash for .norm() call on sparse matrices
1 parent 32d441a commit f0859bf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/sage/matrix/matrix2.pyx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16494,7 +16494,12 @@ cdef class Matrix(Matrix1):
1649416494
if p == 2:
1649516495
from sage.rings.complex_double import CDF
1649616496

16497-
A = self.change_ring(CDF)
16497+
# Sparse matrices don't expose the ``SVD`` method.
16498+
if self.is_sparse():
16499+
A = self.dense_matrix().change_ring(CDF)
16500+
else:
16501+
A = self.change_ring(CDF)
16502+
1649816503
A = A.conjugate().transpose() * A
1649916504
S = A.SVD()[1]
1650016505
return max(S.list()).real().sqrt()

0 commit comments

Comments
 (0)