Re: [Numpy-discussion] np.bitwise_and.identity

2009-09-02 Thread Citi, Luca
Thank you, Robert, for the quick reply. I just saw the line #define PyUFunc_None -1 in the ufuncobject.h file. It is always the same, you choose a sentinel thinking that it doesn't conflict with any possible value and you later find there is one such case. As said it is not a big deal. I wouldn't

Re: [Numpy-discussion] np.bitwise_and.identity

2009-09-02 Thread Robert Kern
On Wed, Sep 2, 2009 at 11:11, Citi, Luca wrote: > Hello, > I know I am splitting the hair, but should not > np.bitwise_and.identity be -1 instead of 1? > I mean, something with all the bits set? Probably. However, the .identity parts of ufuncs were designed mostly to support multiply and add, so .

[Numpy-discussion] np.bitwise_and.identity

2009-09-02 Thread Citi, Luca
Hello, I know I am splitting the hair, but should not np.bitwise_and.identity be -1 instead of 1? I mean, something with all the bits set? I am checking whether all elements of a vector 'v' have a certain bit 'b' set: if np.bitwise_and.reduce(v) & (1 << b): # do something If v is empty, the ex