[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Was: Index... Now: Vectorize, huh?



Stein Vidar Hagfors Haugan wrote:

> Now, this is a bit unfair! First (but least), you're generating a useless "a =
> fltarr.." for the vector case. Then, you're doing everything in the wrong
> order (exploding the array first, then squaring it), and you're also using
> a transpose when it is not necessary:

Well, if nothing else, this thread can be used as an example of how not
to write programs! I admit, I did not think much when I wrote that
example function, partially because I was really surprised by the
*large* time gap in the results. Not saying that if I did think that
would've changed anything :-(
Oh well. At least we've justified the loops completely now. And pulled
Stein Vidar ouf of hiding, too :-)

Cheers,
Pavel