# Error matrix infinity norm

**URL:** https://discourse.julialang.org/t/error-matrix-infinity-norm/14600
**Category:** General Usage
**Created:** [September 6, 2018, 12:08am UTC](https://discourse.julialang.org/t/error-matrix-infinity-norm/14600 "2018-09-06T00:08:13Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![OlivierHnt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/olivierhnt/32/6227_2.png) [@OlivierHnt](https://discourse.julialang.org/u/OlivierHnt)
#### Post date: [September 6, 2018, 12:08am UTC](https://discourse.julialang.org/t/error-matrix-infinity-norm/14600/1 "2018-09-06T00:08:14Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)
#### Post date: [September 6, 2018, 1:05am UTC](https://discourse.julialang.org/t/error-matrix-infinity-norm/14600/2 "2018-09-06T01:05:38Z")

</div>

What do you think the correct result should be?

---

<div class="post-metadata">

### Author: ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)
#### Post date: [September 6, 2018, 1:07am UTC](https://discourse.julialang.org/t/error-matrix-infinity-norm/14600/3 "2018-09-06T01:07:36Z")

</div>

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

> **[Matrix norm](https://en.m.wikipedia.org/wiki/Matrix_norm)**
>
> In mathematics, a matrix norm is a vector norm in a vector space whose elements (vectors) are matrices (of given dimensions).
> Given a field 
>   
>     
>       
> K
>       
>     
> {\\displaystyle K}
>   
> of either real or complex numbers, let 
>   
>     
>       
>         
> K
>           
> m
> ×
> n
>           
>         
>       
>     
> {\\displaystyle K^{m\\times n}}
>   
> be the K-vector space of matrices with 
>   
>     
>       
> m
>       
>     
> {\\displaystyle m...

---

<div class="post-metadata">

### Author: ![Pbellive](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pbellive/32/3604_2.png) [@Pbellive](https://discourse.julialang.org/u/Pbellive)
#### Post date: [September 6, 2018, 1:22am UTC](https://discourse.julialang.org/t/error-matrix-infinity-norm/14600/4 "2018-09-06T01:22:56Z")

</div>

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
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

```

---

<div class="post-metadata">

### Author: ![OlivierHnt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/olivierhnt/32/6227_2.png) [@OlivierHnt](https://discourse.julialang.org/u/OlivierHnt)
#### Post date: [September 6, 2018, 1:31am UTC](https://discourse.julialang.org/t/error-matrix-infinity-norm/14600/5 "2018-09-06T01:31:29Z")

</div>

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