Skip to content

problems with outer

1 message · Bill Venables

#
At 10:57 PM 5/6/00 -0400, Faheem Mitha wrote:
It is a clear, concise and simple explanation, but sadly incomplete and for
your purposes rather misleading...  Darn!
How you do that is up to you.  There is no magic formula.  Sometimes
efficiency requires you to go right down to the C code (or extension) level
and write a fast loop.
Call me unkind, but this is precisely the kind of discussion I was seeking
to avoid in public as it gets so messy.  It takes a dialogue.
"Vectorization" is a rather slippery concept that means different things in
different contexts.  It may involve the recycling rule or it may not,
depending.

Take an example.  If I write

f <- function(x, y) x + y

this function will work with outer(), but it depends on a rather different
vectorization property than just the recycling rule.  In this case it works
because if either x or y are vectors (but not both), the result is a vector
of that length.  Note that if I use f(1:3, 2) or f(2, 1:3) the recycling
rule is used, but it is not used in, say, outer(1:3, 0:5, f) (which you
should check).

So your function to be supplied to outer() should
.-.-
._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._