Patrick, you have misundertood me, I mean that Dan's solution (which is
also your solution) are both:
a) more clear and elegant
b) more time efficient. I've checked it with my working 1*3000 element
matrixes. The improvement in speed with your solution is evident.
I do not advise at all to use
That may be a better solution, but I don't think
it is clearly a better solution.
I presume you mean that your computation is the
most time efficient. That seems believable to me.
It is not the most human efficient -- it will take
some one reading the code non-trivial effort to
understand it.
W
It seems that this solution provided by Dan (and also available in
SPoetry; I'm sorry I didn't notice it) is the fastest and simplest. I was
using a more standard approach:
V <- t(A)[(0:(nrow(A)-1))*ncol(A)+X],
That wasn't bad, but I was confident that you, R gurus, could outperform
this. This is
on 08/09/2008 06:52 AM Dan Davison wrote:
On Sat, Aug 09, 2008 at 06:29:59AM -0500, Marc Schwartz wrote:
on 08/09/2008 06:01 AM [EMAIL PROTECTED] wrote:
Hi;
If we have a matrix A, and a vector X, where length(X)=nrow(A), and X
contains a wanted column for each row in A, in row ascending order.
On Sat, Aug 09, 2008 at 06:29:59AM -0500, Marc Schwartz wrote:
> on 08/09/2008 06:01 AM [EMAIL PROTECTED] wrote:
>> Hi;
>> If we have a matrix A, and a vector X, where length(X)=nrow(A), and X
>> contains a wanted column for each row in A, in row ascending order. How
>> would be the most effective
on 08/09/2008 06:01 AM [EMAIL PROTECTED] wrote:
Hi;
If we have a matrix A, and a vector X, where length(X)=nrow(A), and X
contains a wanted column for each row in A, in row ascending order. How
would be the most effective way to extract the desired vector V (with
length(V)=nrow(A))?
A <- matri
Hi;
If we have a matrix A, and a vector X, where length(X)=nrow(A), and X
contains a wanted column for each row in A, in row ascending order. How
would be the most effective way to extract the desired vector V (with
length(V)=nrow(A))?
Wishes,
Javier
__
7 matches
Mail list logo