flipping specific bits in numeric array
les_ander at yahoo.com
Sun Oct 6 19:34:57 CEST 2002
suppose i have a numeric array of 1's and 0's and i would like
to flip the 1's --> 0's for only selected entries:
I_a=nonzero(a<0.5) # I would like to flip bits for entries of "state"
# at index in I_a
for i in I_a:
if state[i]==0: state[i]=1
is there are faster way? thanks
furthermore, is it possible to overload the "not" operator for
numeric so that the i could achieve the above with simply "not a"?
p.s. I know what numarray has array indexing, however, i don't
want to use numarray since i am using MLab which does not seem to support
More information about the Python-list