distFct | R Documentation |
The function distFct
computes the distance between each point of a set Grid
and the corresponding closest point of another set X
.
distFct(X, Grid)
X |
a numeric m by d matrix of coordinates in the space, where m is the number of points in |
Grid |
a numeric n by d matrix of coordinates in the space, where n is the number of points in |
Given a set of points X
, the distance function computed at g is defined as
d(g) = inf_{x in X} ||x-g||_2
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.
Fabrizio Lecci
kde
,kernelDist
, dtm
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.