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

lp_distance(X, p)

Arguments

X

double matrix (arma::mat class)

p

numeric Minkowski power (double class)

Value

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

Examples

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