From 2210767c85836b2cb2e9d57ffb19c57b7633a01a Mon Sep 17 00:00:00 2001 From: Nicholas Richardson Date: Thu, 30 Jan 2025 17:14:03 -0800 Subject: [PATCH 1/2] fix normest not working on rectangular matrices See https://github.com/JuliaSmoothOptimizers/LinearOperators.jl/issues/362 --- src/utilities.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utilities.jl b/src/utilities.jl index 70b0dedd..1252d959 100644 --- a/src/utilities.jl +++ b/src/utilities.jl @@ -36,7 +36,7 @@ function normest(S, tol = -1, maxiter = 100) x ./= e e_0 = zero(e) - Sx = zeros(eltype(S), n) + Sx = zeros(eltype(S), m) while abs(e - e_0) > tol * e e_0 = e From 1773afb5c6b4f502485a9664874f1316d5743faf Mon Sep 17 00:00:00 2001 From: Nicholas Richardson Date: Thu, 10 Apr 2025 14:57:55 -0700 Subject: [PATCH 2/2] Add rectangular matrix tests for normest --- test/test_normest.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/test_normest.jl b/test/test_normest.jl index abf2723b..7631e60f 100644 --- a/test/test_normest.jl +++ b/test/test_normest.jl @@ -17,8 +17,7 @@ function simple_matrix_test_helper(S, ϵ_norm, ϵ) end function simple_matrix_test(ϵ) - (nrow, ncol) = (10, 10) - for (nrow, ncol) in [(10, 10), (5, 5), (3, 3)] + for (nrow, ncol) in [(10, 10), (5, 5), (3, 3), (3, 5), (5, 3), (5, 10), (10, 5)] ϵ_norm = eps(Float64) A1 = simple_matrix(ComplexF64, nrow, ncol) simple_matrix_test_helper(A1, ϵ_norm, ϵ)