Michael,
If you have a big.matrix, you just want to iterate over the rows. I'm not
in R and am just making this up on the fly (from a bar in Beijing, if you
believe that):
foreach(i=1:nrow(x),.combine=c) %dopar% f(x[i,])
should work, essentially applying the functin f() to the rows of x? But
perhaps I misunderstand you. Please feel free to email me or Mike (
michael.kane@yale.edu) directoy with questions about bigmemory, we are very
interested in applications of it to real problems.
Note that the package foreach uses package iterators, and is very flexible,
in case you need more general iteration in parellel.
Regards,
Jay
Original message:
Hi there!
I have become a big fan of the 'foreach' package allowing me to do a
lot of stuff in parallel. For example, evaluating the function f on
all elements in a vector x is easily accomplished:
foreach(i=1:length(x),.combine=c) %dopar% f(x[i])
Here the .combine=c option tells foreach to combine output using the
c()-function. That is, to return it as a vector.
Today I discovered the 'bigmemory' package, and I would like to
contruct a big.matrix in a parralel fashion row by row. To use foreach
I see no other way than to come up with a substitute for c in the
.combine option. I have checked out the big.matrix manual, but I can't
find a function suitable for just that.
Actually, I wouldn't even know how to do it for a usual matrix. Any clues?
Thanks!
--
Michael Knudsen
micknudsen@gmail.com
http://lifeofknudsen.blogspot.com/
--
John W. Emerson (Jay)
Associate Professor of Statistics
Department of Statistics
Yale University
http://www.stat.yale.edu/~jay
[[alternative HTML version deleted]]