В Mon, 10 Oct 2011 11:20:08 -0400
Olivier Delalleau <sh...@keba.be> пишет:

> 
> The following doesn't use numpy but seems to be about 20x faster:
> 
>     A_rows = {}
>     for i, row in enumerate(A):
>         A_rows[tuple(row)] = i
>     for i, row in enumerate(B):
>         C[i] = A_rows.get(tuple(row), -1)
> 
> -=- Olivier

Thanks a lot, Olivier, that's makes my program like 3x faster. 
One lesson I can draw from this - don't try to use NumPy in 
situations it doesn't fit :)

WBR,
Andrey


-- 
Researcher,
General and theoretical physics dept., South Ural State University
454080, Pr. Lenina, 76, Chelyabinsk, Russia
Tel: +7 351 265-47-13
and...@physics.susu.ac.ru
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to