[SciPy-user] Would like to simplify my 3 where statements

David Grant davidgrant at gmail.com
Tue Jul 18 20:23:20 EDT 2006


What I want to do is find out which row indices in the jth column of a
matrix are 1 except for A[i,j]. I came up with this:

where(A[:,j])[0][where(where(A[:,j])[0]!=i)]

It is really ugly, but it is already faster than my previous
implementation using a for loop and no longer the bottleneck in my
code, but I'd like something that looks more readable.

Thanks,
-- 
David Grant



More information about the SciPy-User mailing list