Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

norm(matrix) -> opnorm(matrix) in Julia 0.7 #125

Closed
stevengj opened this issue Jun 15, 2018 · 2 comments
Closed

norm(matrix) -> opnorm(matrix) in Julia 0.7 #125

stevengj opened this issue Jun 15, 2018 · 2 comments

Comments

@stevengj
Copy link
Member

It looks like may be using norm(matrix). In Julia 0.7, this will compute the Frobenius norm (vecnorm in Julia 0.6), due to JuliaLang/julia#27401. If you want the induced/operator norm as in Julia 0.6, use opnorm(matrix) instead, or Compat.opnorm(matrix) to work in 0.6 and 0.7 (JuliaLang/Compat.jl#577).

Note that, for testing purposes, rather than @test norm(A - B) ≤ tol, it is usually preferred to do @test A ≈ B or @test A ≈ B rtol=... (which uses isapprox).

@MahyarFardin
Copy link

It looks like may be using norm(matrix). In Julia 0.7, this will compute the Frobenius norm (vecnorm in Julia 0.6), due to JuliaLang/julia#27401. If you want the induced/operator norm as in Julia 0.6, use opnorm(matrix) instead, or Compat.opnorm(matrix) to work in 0.6 and 0.7 (JuliaLang/Compat.jl#577).

Note that, for testing purposes, rather than @test norm(A - B) ≤ tol, it is usually preferred to do @test A ≈ B or @test A ≈ B rtol=... (which uses isapprox).

Hi,
although the documentation is not clear about this, you can find that they are the same; as they define an inequality in isapprox function it does not really affect except this one is faster.

@stevengj
Copy link
Member Author

stevengj commented Sep 4, 2023

I'm not sure what you mean by "they". norm(A - B) ≤ tol is not the same as A ≈ B since the former is an absolute tolerance while the latter uses a relative tolerance by default (though you could specify @test A ≈ B atol=tol to get a mathematically equivalent test to @test norm(A - B) ≤ tol. Also, @test A ≈ B has more informative printing if there is an error.

In any case, that's an aside to the reason for this issue, which is that this package was using a function (norm) which changed meaning in Julia 0.7, so we wanted to notify them in case they were reliant on the old behavior. As this package declared itself to be compatible with Julia 1, with passing tests, I think this issue can be closed.

@stevengj stevengj closed this as completed Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants