We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3815074 commit f949fe1Copy full SHA for f949fe1
src/sage/matrix/matrix2.pyx
@@ -16499,13 +16499,11 @@ cdef class Matrix(Matrix1):
16499
if p == 2:
16500
from sage.rings.complex_double import CDF
16501
16502
- # Sparse matrices don't expose the ``SVD`` method.
16503
- if self.is_sparse():
16504
- A = self.dense_matrix().change_ring(CDF)
16505
- else:
16506
- A = self.change_ring(CDF)
16507
-
16508
- A = A.conjugate().transpose() * A
+ # Always try to convert to ``dense_matrix`` since sparse matrices
+ # don't expose the ``SVD`` method. If the matrix is already dense,
+ # the cost is negligible.
+ A = self.dense_matrix().change_ring(CDF)
+ A = A.conjugate_transpose() * A
16509
S = A.SVD()[1]
16510
return max(S.list()).real().sqrt()
16511
0 commit comments