\Header{colCors}{Correlation coefficients between the corresponding columns (rows)
of two matrices that have the same size.}
\alias{rowCors}{colCors}
\keyword{math}{colCors}
\begin{Description}\relax
Correlation coefficients between the corresponding columns (rows)
of two matrices that have the same size.
\end{Description}
\begin{Usage}
\begin{verbatim}
rowCors(x,y)
colCors(x,y)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] Matrix
\item[\code{y}] Matrix, same size as \code{x}
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The implementation is naive.
\end{Details}
\begin{Value}
A vector with the correlation coefficients for each row (\code{rowWiseSds}),
or column  (\code{rowWiseSds})
\end{Value}
\begin{SeeAlso}\relax
\code{\Link{colSums}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
x  = matrix(runif(1e6), ncol=100)
y  = matrix(runif(1e6), ncol=100)

commands = c(
  "c1 <<- colCors(x,y)",
  "c2 <<- sapply(1:ncol(x), function(i) cor(x[,i], y[,i]))",
  "c3 <<- rowCors(x,y)",
  "c4 <<- sapply(1:nrow(x), function(i) cor(x[i,], y[i,]))")
  
times = sapply(commands, function(text) system.time(eval(parse(text=text)))[1])
print(t(times))

stopifnot(all(abs(c1-c2) < 1e-3))
stopifnot(all(abs(c3-c4) < 1e-3))

\end{ExampleCode}
\end{Examples}

