From 0f636d2511cab1e55b066ec0abe07611b3470d82 Mon Sep 17 00:00:00 2001 From: Antoine Marteau <43928194+Antoinemarteau@users.noreply.github.com> Date: Tue, 27 May 2025 17:03:25 +1000 Subject: [PATCH 1/2] Make cond(::SparseMatrix, 1/Inf) discoverable from 2-norm error --- src/linalg.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linalg.jl b/src/linalg.jl index f2c74101..73be2eb5 100644 --- a/src/linalg.jl +++ b/src/linalg.jl @@ -1577,7 +1577,7 @@ function cond(A::AbstractSparseMatrixCSC, p::Real=2) normA = opnorm(A, Inf) return normA * normAinv elseif p == 2 - throw(ArgumentError("2-norm condition number is not implemented for sparse matrices, try cond(Array(A), 2) instead")) + throw(ArgumentError("only 1- and Inf-norm condition number are implemented for sparse matrices, for 2-norm try cond(Array(A), 2) instead")) else throw(ArgumentError("second argument must be either 1 or Inf, got $p")) end From 8001c0f9d95837744823ee4a501706829e6b0c89 Mon Sep 17 00:00:00 2001 From: "Viral B. Shah" Date: Fri, 8 Aug 2025 09:55:48 -0400 Subject: [PATCH 2/2] Update src/linalg.jl Co-authored-by: Daniel Karrasch --- src/linalg.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linalg.jl b/src/linalg.jl index 73be2eb5..ec705048 100644 --- a/src/linalg.jl +++ b/src/linalg.jl @@ -1577,7 +1577,7 @@ function cond(A::AbstractSparseMatrixCSC, p::Real=2) normA = opnorm(A, Inf) return normA * normAinv elseif p == 2 - throw(ArgumentError("only 1- and Inf-norm condition number are implemented for sparse matrices, for 2-norm try cond(Array(A), 2) instead")) + throw(ArgumentError("only 1- and Inf-norm condition numbers are implemented for sparse matrices, for 2-norm try cond(Array(A), 2) instead")) else throw(ArgumentError("second argument must be either 1 or Inf, got $p")) end