Learn R Programming

HDCD (version 1.0)

hausdorff: Hausdorff distance between two sets

Description

Computes the Hausdorff distance between two sets represented as vectors v1 and v2. If v1 == NULL and v2 != NULL, then the largest distance between an element of v1 and the set \(\{1,n\}\) is returned, and vice versa. If both vectors are NULL, 0 is returned.

Usage

hausdorff(v1, v2, n)

Value

The Hausdorff distance between v1 and v2

Arguments

v1

Vector representing set 1

v2

Vector representing set 2

n

Sample size (only relevant when either v1 or v2 is NULL)

Examples

Run this code
library(HDCD)
n = 400
true_changepoints = c(50,100)
est_changepoints = c(51,110)
hausdorff(true_changepoints, est_changepoints,n)
hausdorff(true_changepoints, NULL,n)
hausdorff(NULL, est_changepoints,n)
hausdorff(NULL,NULL)

Run the code above in your browser using DataLab