-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
questionable norm(NaN, 0) #30631
Comments
Isn't it
then it should be 1.0: julia> 0.0 ^ 0.0 ^ (1/0.0)
1.0
julia> NaN ^ 0.0 ^ (1/0.0)
1.0 It's currently special-cased (introduced in #6057): norm(x::Number, p::Real=2) = p == 0 ? (x==0 ? zero(abs(float(x))) : oneunit(abs(float(x)))) : abs(float(x)) The current julia> NaN^0.0^(1/0.0)
1.0 Or maybe the docstring should be changed? If |
The reason here is that "0 norm" is a bit funny, and the standard definition is
|
That is not the case though. The limit diverges whenever 2 or more elements are non-zero. It seems that our |
Whoops, sorry, you are quite right, I gave the wrong definition. The conventional definition is simply the number of non-zero elements of We should either allow |
Indeed but I just don't think it makes much sense to include this definition in a p-norm function. It's a pretty drastic discontinuity in |
Yes, but those are both breaking changes, so not an option until a 2.0 release of LinearAlgebra, which can't be done until we can change stdlib versions independent of Julia versions. |
I've opened JuliaLang/LinearAlgebra.jl#596 to track the possible deprecation of |
While reviewing #30481 I noticed an unrelated problem in
norm(::Number)
:Surely
norm(NaN, 0)
should giveNaN
?The text was updated successfully, but these errors were encountered: