outer(x, y, FUN = "*", ...) x %o% y
x
| a vector. |
y
| a vector. |
FUN
| a function to use on the outer products, it may be a quoted string. |
...
|
optional arguments to be passed to fun.
|
x and y is the matrix
A with elements
A[i, j] = FUN(x[i], y[j], ...).
FUN must be a function which expects at least two arguments
and which operates elementwise on arrays.
This needs to be extended to taking arrays of arbitrary dimension for
x and y and returns an array of dimension
c(dim(x), dim(y)).
%o% is an .Alias for outer (where
FUN cannot be changed from "*".
outer(1:5, 1:5, "+") all(outer(1:5, 1:5) == 1:5 %o% 1:5)