[R] extension to outer()
J.C.Rougier at durham.ac.uk
Fri Mar 12 11:20:18 CET 1999
I have been struggling to extend outer() with a bind argument which is
NULL by default but has the property
V <- outer(A, B, bind=c(2,3))
V[i, j, k, l, m, n] == A[i, j, k] * B[l, m, j, n]
The really crude way to do it would be to subscript the full outer object,
but this would use far too much memory for some applications. I can think
of an alternative which uses a for loop along the bound extent, with a
smaller outer inside the loop. Has anyone tried to solve this problem, or
have any suggestions for an approach more efficient than the for loop?
Many thanks, Jonathan.
Jonathan Rougier Science Laboratories
Department of Mathematical Sciences South Road
University of Durham Durham DH1 3LE
"[B]egin upon the precept ... that the things we see are to be
weighed in the scale with what we know" (Meredith, 1879, The Egoist)
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
More information about the R-help