distFct {TDA}R Documentation

Distance function

Description

The function distFct computes the distance between each point of a set Grid and the corresponding closest point of another set X.

Usage

distFct(X, Grid)

Arguments

X

a numeric m by d matrix of coordinates in the space, where m is the number of points in X and d is the dimension of the space. X is the set of points whose distance is being measured from a base grid.

Grid

a numeric n by d matrix of coordinates in the space, where n is the number of points in Grid and d is the dimension of the space. Grid is the base set from which each point is compared to the closest point in X.

Details

Given a set of points X, the distance function computed at g is defined as

d(g) = \inf_{x \in X} \| x-g \|_2

Value

The function distFct returns a numeric vector of length n, where n is the number of points stored in Grid. Each value in V corresponds to the distance between a point in G and the nearest point in X.

Author(s)

Fabrizio Lecci

See Also

kde,kernelDist, dtm

Examples

## Generate Data from the unit circle
n <- 300
X <- circleUnif(n)

## Construct a grid of points over which we evaluate the function
interval <- 0.065
Xseq <- seq(-1.6, 1.6, by = interval)
Yseq <- seq(-1.7, 1.7, by = interval)
Grid <- expand.grid(Xseq, Yseq)

## distance fct
distance <- distFct(X, Grid)

[Package TDA version 1.9.1 Index]