Skip to content

Commit cff971d

Browse files
AntoinemarteauViralBShahdkarrasch
authored
Make cond(::SparseMatrix, 1 / Inf) discoverable from 2-norm error (#629)
Changed error message when trying to compute condition number of sparse matrix in 2-norm, suggesting 1 or Inf norm. Newbies like me or https://discourse.julialang.org/t/condition-number-of-sparse-matrix/77131/5 got diverted into trying densifying the array, which is very limited in many applications... --------- Co-authored-by: Viral B. Shah <[email protected]> Co-authored-by: Daniel Karrasch <[email protected]>
1 parent 30201ab commit cff971d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/linalg.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,7 @@ function cond(A::AbstractSparseMatrixCSC, p::Real=2)
15771577
normA = opnorm(A, Inf)
15781578
return normA * normAinv
15791579
elseif p == 2
1580-
throw(ArgumentError("2-norm condition number is not implemented for sparse matrices, try cond(Array(A), 2) instead"))
1580+
throw(ArgumentError("only 1- and Inf-norm condition numbers are implemented for sparse matrices, for 2-norm try cond(Array(A), 2) instead"))
15811581
else
15821582
throw(ArgumentError("second argument must be either 1 or Inf, got $p"))
15831583
end

0 commit comments

Comments
 (0)