Learn R Programming

flintyR (version 0.1.0)

lp_distance: Fast \(l_p^p\) Distance Vector Computation

Description

Takes in a double matrix \(\mathbf{X}\), whose transpose \(\mathbf{X}^T\) has \(N\) rows, and computes a vector recording all \({N \choose 2}\) pairwise \(l_p^p\) distances of \(\mathbf{X}^T\), ordered lexicographically.

Usage

lp_distance(X, p)

Value

vector of \(l_p^p\) distances (arma::vec class)

Arguments

X

double matrix (arma::mat class)

p

numeric Minkowski power (double class)

Examples

Run this code
# X = [[0.5,0.5],[0,1],[0.3,0.7]] --> lPVec = [x,y,z]
# with x = (0.5^p + 0.5^p)

Run the code above in your browser using DataLab