[Numpy-discussion] Multiple Boolean Operations

Stéfan van der Walt stefan@sun.ac...
Thu May 22 19:02:43 CDT 2008


Hi Andrea

2008/5/23 Andrea Gavana <andrea.gavana@gmail.com>:
> Thank you very much for this! I am going to try it and time it,
> comparing it with the other implementations. I think I need to study a
> bit your code as I know almost nothing about Cython :-D

That won't be necessary -- the Fortran-implementation is guaranteed to win!

Just to make sure, I timed it anyway (on somewhat larger arrays):

Francesc's Solution: 0.062797403 Seconds/Trial
Fortran Solution 1: 0.050316906 Seconds/Trial
Fortran Solution 2: 0.052595496 Seconds/Trial
Nathan's Solution: 0.055562282 Seconds/Trial
Cython Solution: 0.06250751 Seconds/Trial

Nathan's version runs over the data 6 times, and still does better
than the Pyrex version.  I don't know why!

But, hey, this algorithm is parallelisable!  Wait, no, it's bedtime.

Regards
Stéfan


More information about the Numpy-discussion mailing list