crossDist: Computed the Euclidian Distance Matrix

Description Usage Arguments Value Author(s) See Also Examples

View source: R/c_cov_matrices.R

Description

Computed the Euclidian distance matrix between to sets of points.

Usage

1
crossDist(coord1, coord2 = coord1)

Arguments

coord1, coord2

Matrices with the coordinates of locations, between which distances are to be computed.

Value

A dim(coord1)[1]-by-dim(coord2)[1] distance matrix.

Author(s)

Johan Lindstrom

See Also

Other covariance functions: evalCovFuns, makeSigmaB, makeSigmaNu, namesCovFuns, parsCovFuns, updateCovf

Other basic linear algebra: blockMult, makeCholBlock, norm2, sumLogDiag

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
##First create some random locations
x <- rnorm(5)
y <- rnorm(5)

##compute distance matrix
D <- crossDist( cbind(x,y) )

##or distance between different locations
X <- matrix(rnorm(6),3,2)
Y <- rbind(X, matrix(rnorm(8),4,2))
Dcross <- crossDist(X, Y)

##or distances between coordinates in R3
C1 <- matrix(rnorm(9),3,3)
C2 <- matrix(rnorm(12),4,3)
Dcross.R3 <- crossDist(C1, C2)

SpatioTemporal documentation built on June 25, 2018, 9:03 a.m.