distancew {lazy.tools} | R Documentation |
This program calculated weighted distance among the rows of X matrix
by applying the k-th row as a set of dimensional weights.
dijk =sqrt( sum_a=1^r w[k,a] (x[i,a]-x[j,a])^2 )
dijk =sqrt( (x[i,]-x[j,])' diag(W[k,]) (x[i,]-x[j,]) )
distancew(X, W = matrix(1, 1, ncol(X)), array = 1)
X |
n x r matrix |
W |
nG x r maatrix |
array |
= 0 to make the result a list |
An array or a list of nG matrices of size n x n
X <- matrix( c(0,0, 3,0, 0,4), 3,2, byrow=1 ) distancew( X ) W <- matrix( c(2,1, 1,2, 1,1), 3,2, byrow=1 ) distancew( X, W )