https://github.com/cran/spatstat
Raw File
Tip revision: 6ab7c0c792ac3663bd8dc4742b868062996b7371 authored by Adrian Baddeley on 10 March 2010, 10:20:21 UTC
version 1.18-0
Tip revision: 6ab7c0c
nndist.R

require(spatstat)
eps <- .Machine$double.eps * 4

X <- runifpoint(42)

nnC <- nndist(X, method="C")
nnI <- nndist(X, method="interpreted")
if(any(abs(nnC - nnI) > eps))
  stop("Algorithms for nndist() do not agree")

nn3C <- nndist(X, k=3, method="C")
nn3I <- nndist(X, k=3, method="interpreted")
if(any(abs(nn3C - nn3I) > eps))
  stop("Algorithms for nndist(k=3) do not agree")

nwC <- nnwhich(X, method="C")
nwI <- nnwhich(X, method="interpreted")
if(any(nwC != nwI))
  stop("Algorithms for nnwhich() do not agree")

nw3C <- nnwhich(X, k=3, method="C")
nw3I <- nnwhich(X, k=3, method="interpreted")
if(any(nw3C != nw3I))
  stop("Algorithms for nnwhich(k=3) do not agree")







back to top