forked from compTAG/r-tda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdistFct.Rd
63 lines (49 loc) · 1.38 KB
/
distFct.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
\name{distFct}
\alias{distFct}
\title{
Distance function
}
\description{
The function \code{distFct} computes the distance between each point of a set \code{Grid} and the corresponding closest point of another set \code{X}.
}
\usage{
distFct(X, Grid)
}
\arguments{
\item{X}{
a numeric \eqn{m} by \eqn{d} matrix of coordinates in the space, where \eqn{m} is the number of points in \code{X} and \eqn{d} is the dimension of the space.
}
\item{Grid}{
a numeric \eqn{n} by \eqn{d} matrix of coordinates in the space, where \eqn{n} is the number of points in \code{Grid} and \eqn{d} is the dimension of the space.
}
}
\details{
Given a set of points \code{X}, the distance function computed at \eqn{g} is defined as
\deqn{
d(g) = \inf_{x \in X} \| x-g \|_2
}{
d(g) = inf_{x in X} ||x-g||_2
}
}
\value{
The function \code{distFct} returns a numeric vector of length \eqn{n}, where \eqn{n} is the number of points stored in \code{Grid}.
}
\author{
Fabrizio Lecci
}
\seealso{
\code{\link{kde}},\code{\link{kernelDist}}, \code{\link{dtm}}
}
\examples{
## Generate Data from the unit circle
n <- 300
X <- circleUnif(n)
## Construct a grid of points over which we evaluate the function
by <- 0.065
Xseq <- seq(-1.6, 1.6, by = by)
Yseq <- seq(-1.7, 1.7, by = by)
Grid <- expand.grid(Xseq, Yseq)
## distance fct
distance <- distFct(X, Grid)
}
\keyword{nonparametric}