distrectw {lazy.tools}R Documentation

Calculation of Weighted Distance Matrix between the rows of F and A

Description

Calculation of Weighted Distance Matrix between the rows of F and A

Usage

distrectw(F, A, Wa = matrix(1, nrow(A), ncol(A)))

Arguments

F

n x r matrix

A

p x r matrix

Wa

p x r maatrix

Details

This program calculated weighted distance between the rows of F matrix and the rows of A matrix
by applying the j-th row as a set of dimensional weights.

d_ij = sqrt( (f[i,]-a[j,])' diag(Wa[j,]) (f[i,]-a[j,]) )


Note that Wa matrix will NOT be squared when calculating distance.

Value

A matrices of size n x p

Examples

F <- matrix( c(0,0,  3,0,  0,4), 3,2,  byrow=1 )
A <- matrix( c(0,0,  3,4 ), 2,2, byrow=1 )
distrectw( F,A )
Wa <- matrix( c(1,1,  1,2 ), 2,2, byrow=1 )
distrectw( F,A, Wa )


[Package lazy.tools version 0.1.6 ]