% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/distance.R
\name{distrectw}
\alias{distrectw}
\title{Calculation of Weighted Distance Matrix between the rows of F and A}
\usage{
distrectw(F, A, W = matrix(1, nrow(A), ncol(A)), R = NULL, outD2 = 0)
}
\arguments{
\item{F}{n x r matrix}

\item{A}{p x r matrix}

\item{W}{p x r maatrix}

\item{R}{p x (r x r) array}
}
\value{
A matrices of size n x p
}
\description{
Calculation of Weighted Distance Matrix between the rows of F and A
}
\details{
This program calculates the weighted distance between the rows of F matrix
and the rows of A matrix as\cr
\deqn{ d_{ij} = \sqrt( (f[i,]-a[j,])' diag(W[j,]) (f[i,]-a[j,]) )  } \cr
\deqn{ d_{ij} = \sqrt( (f[i,]-a[j,])' R[,,j] (f[i,]-a[j,]) )  }

\cr
Note that \code{W} matrix will NOT be squared when calculating distance.
\cr
}
\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 )
R <- matrix(c(1,0, 0,1, 1,0.5, 0.5,3 ), ,2, byrow=TRUE)
# R <- t(R)
# dim(R)=c(2,2,2)
distrectw( F,A, R=R )

}
