Yes, it should be. Thank you for pointing that out. Apologies for the noise.

Regards,
Jorge


On Sun, May 23, 2010 at 1:07 AM, Berend Hasselman <> wrote:

>
>
> Jorge Ivan Velez wrote:
> >
> > # The same using a function foo
> > foo <- function(A, B){
> >   rA <- 1:nrow(A)
> >   rB <- 1:nrow(B)
> >   grid <- as.matrix(expand.grid(rA, rB))
> >   t(apply(grid, 1, function(x) abs(A[x[1], ] - B1[x[2], ])))
> >  }
> >
> > foo(A, B)
> > foo(A, B1)
> >
> > As usual, there might be better and faster ways to do this.
> >
> > HTH,
> > Jorge
> >
>
> Shouldn't the B1 in the last line of the function 'foo' be B (the second
> argument of the function)?
>
> Berend
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Fast-Matrix-Computation-tp2227321p2227624.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to