distUnitk {WaveSampling} | R Documentation |
Squared Euclidean distances of the unit k.
Description
Calculate the squared Euclidean distance from unit to the other units.
Usage
distUnitk(X, k, tore, toreBound)
Arguments
X |
matrix representing the spatial coordinates. |
k |
the unit index to be used. |
tore |
an optional logical value, if we are considering the distance on a tore. See Details. |
toreBound |
an optional numeric value that specify the length of the tore. |
Details
Let be the spatial coordinates of the unit
. The classical euclidean distance is given by
When the points are distributed on a regular grid of
.
It is possible to consider the units like they were placed on a tore. It can be illustrated by Pac-Man passing through the wall to get away from ghosts. Specifically,
we could consider two units on the same column (resp. row) that are on the opposite have a small distance,
The option toreBound
specify the length of the tore in the case of .
It is omitted if the
tore
option is equal to FALSE
.
Value
a vector of length that contains the distances from the unit
to all other units.
Author(s)
Raphaël Jauslin raphael.jauslin@unine.ch
See Also
Examples
N <- 5
x <- seq(1,N,1)
X <- as.matrix(expand.grid(x,x))
distUnitk(X,k = 2,tore = TRUE,toreBound = 5)
distUnitk(X,k = 2,tore = FALSE,toreBound = -1)