Learn R Programming

SpatioTemporal (version 1.1.9.1)

crossDist: Computed the Euclidian Distance Matrix

Description

Computed the Euclidian distance matrix between to sets of points.

Usage

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.

See Also

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

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

Examples

Run this code
# NOT RUN {
##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)


# }
# NOT RUN {

# }

Run the code above in your browser using DataLab