% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/distance.R
\name{distancew0}
\alias{distancew0}
\title{Calculation of Weighted Distance Matrix}
\usage{
distancew0(X, W = diag(ncol(X)))
}
\arguments{
\item{X}{n x r matrix}

\item{W}{r x r diagonal maatrix}
}
\value{
A matrices of size n x n
}
\description{
Calculation of Weighted Distance Matrix
}
\details{
This function calculates the weighted distance among the rows of
\code{X} matrix  by applying the a-th diagonal element of \code{W} matrix
as the dimensional weights as:
\deqn{ d_{ij} = \sqrt( \sum_{a=1}^r   w[a,a] (x[i,a]-x[j,a])^2 ) }
or
\deqn{ d_{ij} = \sqrt( (x[i,]-x[j,])' W (x[i,]-x[j,]) ) }
\cr
Note that \code{W} matrix will NOT be squared when calculating distance.
\cr
}
\examples{
X <- matrix( c(0,0,  3,0,  0,4), 3,2,  byrow=1 )
distancew0( X )
W <- diag(c(2,1))
distancew0( X,W )

}
