Re: [R] Outer product from matrix by row and a vector

2012-08-09 Thread Ingo Reinhold
Hi David, Petr, sorry for the fuzzy posts. I oversaw that it was just the transposed version as you indicate. Does exactly what it should. Many thanks, Ingo __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] Outer product from matrix by row and a vector

2012-08-08 Thread David Winsemius
On Aug 7, 2012, at 11:26 PM, Petr Savicky wrote: On Wed, Aug 08, 2012 at 06:03:19AM +, Ingo Reinhold wrote: Hi Jeff, David, what I'm trying to do is speed the currently used nest for loop a<-matrix(c(1:6),ncol=3) b<-c(1,2,3,4) result<-matrix(rep(0, times=dim(a)[1]*length(b)),nrow=dim(a)

Re: [R] Outer product from matrix by row and a vector

2012-08-07 Thread Petr Savicky
On Wed, Aug 08, 2012 at 06:03:19AM +, Ingo Reinhold wrote: > Hi Jeff, David, > > what I'm trying to do is speed the currently used nest for loop > > a<-matrix(c(1:6),ncol=3) > b<-c(1,2,3,4) > > result<-matrix(rep(0, times=dim(a)[1]*length(b)),nrow=dim(a)[1]) > for(ii in 1:dim(a)[1]){ > fo

Re: [R] Outer product from matrix by row and a vector

2012-08-07 Thread Ingo Reinhold
t.org Subject: Re: [R] Outer product from matrix by row and a vector Can you post what you want your answer to be for the a and b you have given already? --- Jeff NewmillerThe .

Re: [R] Outer product from matrix by row and a vector

2012-08-07 Thread Jeff Newmiller
Can you post what you want your answer to be for the a and b you have given already? --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

Re: [R] Outer product from matrix by row and a vector

2012-08-07 Thread David Winsemius
On Aug 7, 2012, at 9:02 PM, Ingo Reinhold wrote: Dear all, I am facing a challenge when applying the outer product with a matrix by rows. What I have is a rather big matrix, which I would like to convert into a different matrix by doing something like outer(matrix_row, vector, function