\Header{outer}{Outer Product of Arrays}
\alias{$\%$o$\%$}{outer}
\keyword{array}{outer}
\begin{Usage}
\begin{verbatim}
outer(X, Y, FUN="*", ...)
x %o% y
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{X}] A vector or array.
\item[\texttt{Y}] A vector or array.
\item[\texttt{FUN}] a function to use on the outer products, it may be
a quoted string.
\item[\texttt{...}] optional arguments to be passed to \texttt{FUN}.
\end{ldescription}
\end{Arguments}
\begin{Description}
The outer product of the arrays \texttt{X} and \texttt{Y} is the
array \texttt{A} with dimension \texttt{c(dim(X), dim(Y))} where
element \texttt{A[i, j, .., k, l, ..] = FUN(X[i, j, ..], Y[k, l,..], ..)}.\end{Description}
\begin{Details}
\texttt{FUN} must be a function (or the name of it) which expects at
least two arguments and which operates elementwise on arrays.

Where they exist, the [dim]names of \texttt{X} and \texttt{Y} will be
preserved.

\texttt{\%o\%} is an \texttt{.Alias} for \texttt{outer} (where \texttt{FUN}
cannot be changed from \texttt{"*"}).\end{Details}
\begin{Author}
Jonathan Rougier\end{Author}
\begin{SeeAlso}
\texttt{\Link{matmult}} for usual (\emph{inner}) matrix vector
multiplication; \texttt{\Link{kronecker}} which is based on \texttt{outer}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
x <- 1:9; names(x) <- x
# Multiplication & Power Tables
x %o% x
y <- 2:8; names(y) <- paste(y,":",sep="")
outer(y, x, "^")

outer(month.abb, 1999:2003, FUN = "paste")

## three way multiplication table:
x %o% x %o% y[1:3]
\end{ExampleCode}
\end{Examples}

