JuliaLang / LinearAlgebra.jl

Julia Linear Algebra standard library
Other
18 stars 4 forks source link

Deprecate norm(x,0) #596

Open andreasnoack opened 5 years ago

andreasnoack commented 5 years ago

It's not a norm and it's not p (in the same way as norm(x,p) for p>0). See the discussion in https://github.com/JuliaLang/julia/issues/30631. It currently behaves as norm(x,p)^p -> norm(x,0) in p so it's questionable to bundle this functionality inside norm(x,p). Sure, it can be useful to count the number of non-zeros in an array but count(!iszero, x) should be just fine for that.

StefanKarpinski commented 5 years ago

As I said on the other issue, would have to be a LinearAlgebra 2.0 change unless we genuinely believe that no one out there is using this feature.

andreasnoack commented 5 years ago

I already added the "breaking" label. Is there another way to label 2.0 changes?

StefanKarpinski commented 5 years ago

The 2.0 milestone.

lostella commented 5 years ago

Should the cases 0 < p < 1 be deprecated for the same reason? They're p, but they're not norms.

andreasnoack commented 5 years ago

I think it's okay to allow 0 < p < 1 since it the same definition as for p >= 1.

Jutho commented 4 years ago

Another option would be to not take the power 1/p for 0<=p<1. Even more breaking, but then the definition for p=0 remains continuous (and thus makes sense as the limit), and it is also continuous at p=1 (but probably not smooth?). This seems to be a choice that is sometimes (often?) made in the context of L^p spaces I think, but I am not very familiar with that.