Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

hausdorff

Hausdorff Distance


Description

Hausdorff distance (aka Hausdorff dimension)

Usage

hausdorff_dist(P, Q)

Arguments

P, Q

numerical matrices, representing points in an m-dim. space.

Details

Calculates the Hausdorff Distance between two sets of points, P and Q. Sets P and Q must be matrices with the same number of columns (dimensions).

The ‘directional’ Hausdorff distance (dhd) is defined as:

dhd(P,Q) = max p in P [ min q in Q [ ||p-q|| ] ]

Intuitively dhd finds the point p from the set P that is farthest from any point in Q and measures the distance from p to its nearest neighbor in Q. The Hausdorff Distance is defined as max(dhd(P,Q),dhd(Q,P)).

Value

A single scalar, the Hausdorff distance (dimension).

References

Barnsley, M. (1993). Fractals Everywhere. Morgan Kaufmann, San Francisco.

See Also

Examples

P <- matrix(c(1,1,2,2, 5,4,5,4), 4, 2)
Q <- matrix(c(4,4,5,5, 2,1,2,1), 4, 2)
hausdorff_dist(P, Q)    # 4.242641 = sqrt(sum((c(4,2)-c(1,5))^2))

pracma

Practical Numerical Math Functions

v2.3.3
GPL (>= 3)
Authors
Hans W. Borchers [aut, cre]
Initial release
2021-01-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.