manhattan: Manhattan distance

View source: R/metrics.manhattan.R

manhattanR Documentation

Manhattan distance

Description

Compute Manhattan distance between two dataset or SparseHist X and Y

Usage

manhattan(X, Y)

Arguments

X

[matrix or SparseHist] If matrix, dim = ( nrow = n_samples, ncol = n_features)

Y

[matrix or SparseHist] If matrix, dim = ( nrow = n_samples, ncol = n_features)

Value

[float] value of distance

Examples

X = base::cbind( stats::rnorm(2000) , stats::rnorm(2000)  )
Y = base::cbind( stats::rnorm(2000,mean=2)  , stats::rnorm(2000) )
bw = base::c(0.1,0.1)
muX = SBCK::SparseHist( X , bw )
muY = SBCK::SparseHist( Y , bw )

## The four are equals
d = SBCK::manhattan(  X ,   Y )
d = SBCK::manhattan(muX ,   Y )
d = SBCK::manhattan(  X , muY )
d = SBCK::manhattan(muX , muY )


SBCK documentation built on Sept. 11, 2023, 5:10 p.m.

Related to manhattan in SBCK...