Error matrix infinity norm

Hello,

I was having a hard time trying to debug a code today, but it turns out the problem came from the function norm itself. The infinity norm of a matrix is not correct in Julia. According to Julia norm(A,Inf) = max(abs.(A)), that is it returns the largest element in abs.(A).
(Note: might be worth to check that the one norm works too then. I will check later tonight).

Is this issue known ? I never saw any comments about it. If it is not, who should be contacted ?
If it is known but not yet corrected, is there a simple fix ? (by “fix” I mean fixing the function itself not how to write a code to compute the infinity norm).

I tried Pkg.update("LinearAlgebra") but apparently nothing new.

Thank you for your help!

1 Like

What do you think the correct result should be?

I am no expert, but Wikipedia seems to agree with Julia (“max norm”) :

What version of Julia are you using? Looks like things have changed from 0.6 to 1.0. According to the 0.6 docs for the norm function, norm(A,Inf) should give the matrix norm induced by the vector infinity norm, so the maximum row sum of A rather than just the entry with largest absolute value. However, in 1.0 the norm function just treats a matrix as if it were a vector of all the entries. You now need to use the new function opnorm for matrix norms induced by vector norms. E.g. on 1.0 I get

julia> A = [1 2;3 4]
2Ă—2 Array{Int64,2}:
 1  2
 3  4

julia> norm(A,Inf)
4.0

julia> opnorm(A,Inf)
7.0
3 Likes

Oh I see, I should be using opnorm(A,Inf) then! Thank you very much.

1 Like