distancew {lazy.tools}R Documentation

Calculation of Weighted Distance Matrices

Description

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,]) )

Usage

distancew(X, W = matrix(1, 1, ncol(X)), array = 1)

Arguments

X

n x r matrix

W

nG x r maatrix

array

= 0 to make the result a list

Value

An array or a list of nG matrices of size n x n

Examples

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 )


[Package lazy.tools version 0.1.3 Index]