ruler: Rcpp distance calculator

Description Usage Arguments Examples

View source: R/RcppExports.R

Description

Returns a vector of distances from all rows in vR to the single row uR using ciR as the inverted covariance matrix.

Usage

1
ruler(vR, uR, ciR)

Arguments

uR

a vector of length k containing a list of values for all features (k) for the target. Numeric and dense.

vR

an n x k matrix containing a matrix of values for all features (k) for all candidates (n). Numeric and dense.

ciR

a square k x k matrix containing the inverted covariance matrix for all features (k). Numeric and dense.

Examples

1
2
3
4
set.seed(123)
df <- data.frame(x = rpois(10, 20), y = rnorm(10, 50, 10))
cov_inv <- MASS::ginv(cov(df))
mmsample::ruler(as.matrix(df[2:10, ]), as.numeric(df[1, ]), cov_inv)

Gladwell5/mmsample documentation built on May 26, 2019, 7:26 a.m.