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

Minkowski with p<1 not a metric #110

Open
chethega opened this issue Sep 11, 2018 · 0 comments
Open

Minkowski with p<1 not a metric #110

chethega opened this issue Sep 11, 2018 · 0 comments

Comments

@chethega
Copy link

julia> using Distances
julia> d = Minkowski(0.5);
julia> a=[1.0,0.0]; b=[0.0,1.0]; c=[0.0,0.0];
julia> evaluate(d, a, b) - evaluate(d,a,c) - evaluate(d,c,b)
2.0
julia> d isa Metric
true

This violates the triangle inequality. For p<1 we should probably throw in the constructor, or skip the outer root (then L^p for p<1 can be considered a metric vector space, albeit not locally convex). Skipping the outer root means something like

julia> using Distances
julia> import Distances.evaluate
julia> struct M<:Metric end
julia> evaluate(::M, x, y) = sum(t->sqrt(abs(t)) , x-y)
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

1 participant