I have two large matrices, say, ABC and DEF, each with a shape of 7000 by
4500. I have another list, say, elem, containing 850 values from ABC. I am
interested in finding out the corresponding values in DEF where ABC has
elem and store them *separately*. The code that I am using is:

for i in range(len(elem)):
     DEF_distr = DEF[ABC==elem[i]]

DEF_distr gets used for further processing before it gets cleared from
memory and the next round of the above loop begins. The loop above
currently takes about 20 minutes! I think the bottle neck is where elem is
getting searched repeatedly in ABC. So I am looking for a solution where
all elem can get processed in a single call and the indices of ABC be
stored in another variable (separately). I would appreciate if you suggest
any faster method for getting DEF_distr.

Thanks,
Naresh
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to