weighted_norm: Weighted Norm

Description Usage Arguments Details Value Examples

View source: R/RcppExports.R

Description

Weighted Norm

Usage

1
weighted_norm(X, W, p = 1)

Arguments

X

Numeric matrix of size n*K.

W

Numeric matrix of size K*K. When W is equal to solve(var(X)), it is the Mahalanobis norm.

p

Numeric scalar. See weighted_norm.

Details

Computes

[(x_i - x_j) %*% W %*% (x_i - x_j)]^(p/2), for all i, j

Value

A square matrix of size n * n.

Examples

1
2
3
4
5
set.seed(1231)
X <- matrix(rnorm(20*2), ncol=2)
W <- diag(2)

weighted_norm(X, W, 1.0)

gvegayon/blopmatch documentation built on Dec. 2, 2019, 6:27 a.m.