distancew0 {lazy.tools}R Documentation

Calculation of Weighted Distance Matrix

Description

This program calculated weighted distance among the rows of X matrix
with the diagonal weight matrix W. dij = sqrt( sum_k=1^r w_k,k( x_ik-x_jk )^2 ) dij =sqrt( (x[i,]-x[j,])' W (x[i,]-x[j,]) )

Usage

distancew0(X, W = diag(ncol(X)))

Arguments

X

n x r matrix

W

r x r diagonal maatrix

Value

A matrices of size n x n

Examples

X <- matrix( c(0,0,  3,0,  0,4), 3,2,  byrow=1 )
distancew0( X )
W <- diag(c(2,1))
distancew0( X,W )


[Package lazy.tools version 0.1.3 Index]