Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-08 Thread josef . pktd
On Fri, Dec 6, 2013 at 11:25 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Fri, Dec 6, 2013 at 2:14 PM, josef.p...@gmail.com wrote: On Fri, Dec 6, 2013 at 3:50 PM, Sebastian Berg sebast...@sipsolutions.net wrote: On Fri, 2013-12-06 at 15:30 -0500, josef.p...@gmail.com wrote:

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread Nathaniel Smith
On Thu, Dec 5, 2013 at 7:33 PM, josef.p...@gmail.com wrote: On Thu, Dec 5, 2013 at 5:37 PM, Sebastian Berg sebast...@sipsolutions.net wrote: Hey, there was a discussion that for numpy booleans math operators +,-,* (and the unary -), while defined, are not very helpful. I have set up a quick

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread Sebastian Berg
On Thu, 2013-12-05 at 23:02 -0500, josef.p...@gmail.com wrote: On Thu, Dec 5, 2013 at 10:56 PM, Alexander Belopolsky ndar...@mac.com wrote: On Thu, Dec 5, 2013 at 5:37 PM, Sebastian Berg sebast...@sipsolutions.net wrote: there was a discussion that for numpy booleans math operators +,-,*

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread josef . pktd
On Fri, Dec 6, 2013 at 4:39 AM, Sebastian Berg sebast...@sipsolutions.net wrote: On Thu, 2013-12-05 at 23:02 -0500, josef.p...@gmail.com wrote: On Thu, Dec 5, 2013 at 10:56 PM, Alexander Belopolsky ndar...@mac.com wrote: On Thu, Dec 5, 2013 at 5:37 PM, Sebastian Berg

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread Alan G Isaac
On Thu, Dec 5, 2013 at 8:05 PM, Alan G Isaac alan.is...@gmail.com wrote: For + and * (and thus `dot`), this will fix something that is not broken. It is in fact in conformance with a large literature on boolean arrays and boolean matrices. On 12/6/2013 3:24 AM, Nathaniel Smith wrote:

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread josef . pktd
On Fri, Dec 6, 2013 at 9:32 AM, josef.p...@gmail.com wrote: On Fri, Dec 6, 2013 at 4:39 AM, Sebastian Berg sebast...@sipsolutions.net wrote: On Thu, 2013-12-05 at 23:02 -0500, josef.p...@gmail.com wrote: On Thu, Dec 5, 2013 at 10:56 PM, Alexander Belopolsky ndar...@mac.com wrote: On Thu,

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread Alan G Isaac
On 12/5/2013 11:14 PM, Alexander Belopolsky wrote: did you find minus to be as useful? It is also a correct usage. I think a good approach to this is to first realize that there were good reasons for the current behavior. Alan Isaac ___

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread josef . pktd
On Fri, Dec 6, 2013 at 11:13 AM, Alan G Isaac alan.is...@gmail.com wrote: On 12/5/2013 11:14 PM, Alexander Belopolsky wrote: did you find minus to be as useful? It is also a correct usage. I think a good approach to this is to first realize that there were good reasons for the current

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread Alexander Belopolsky
On Fri, Dec 6, 2013 at 11:13 AM, Alan G Isaac alan.is...@gmail.com wrote: On 12/5/2013 11:14 PM, Alexander Belopolsky wrote: did you find minus to be as useful? It is also a correct usage. Can you provide a reference? I think a good approach to this is to first realize that there

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread josef . pktd
On Fri, Dec 6, 2013 at 12:23 PM, Alexander Belopolsky ndar...@mac.com wrote: On Fri, Dec 6, 2013 at 11:13 AM, Alan G Isaac alan.is...@gmail.com wrote: On 12/5/2013 11:14 PM, Alexander Belopolsky wrote: did you find minus to be as useful? It is also a correct usage. Can you provide a

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread Alan G Isaac
On 12/6/2013 12:23 PM, Alexander Belopolsky wrote: What is the rationale for this: -array(True) + array(True) True The minus is complementation. So you are just writing False or True Alan Isaac ___ NumPy-Discussion mailing list

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread Alan G Isaac
On 12/5/2013 11:14 PM, Alexander Belopolsky wrote: did you find minus to be as useful? On Fri, Dec 6, 2013 at 11:13 AM, Alan G Isaac It is also a correct usage. On 12/6/2013 12:23 PM, Alexander Belopolsky wrote: Can you provide a reference? For use of the minus sign, I don't have one

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread josef . pktd
On Fri, Dec 6, 2013 at 1:16 PM, Alan G Isaac alan.is...@gmail.com wrote: On 12/6/2013 12:23 PM, Alexander Belopolsky wrote: What is the rationale for this: -array(True) + array(True) True The minus is complementation. So you are just writing False or True unary versus binary

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread Alan G Isaac
On 12/6/2013 1:35 PM, josef.p...@gmail.com wrote: unary versus binary minus Oh right; I consider binary `-` broken for Boolean arrays. (Sorry Alexander; I did not see your entire issue.) I'd rather write ~ than unary - if that's what it is. I agree. So I have no objection to elimination of

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread josef . pktd
On Fri, Dec 6, 2013 at 1:46 PM, Alan G Isaac alan.is...@gmail.com wrote: On 12/6/2013 1:35 PM, josef.p...@gmail.com wrote: unary versus binary minus Oh right; I consider binary `-` broken for Boolean arrays. (Sorry Alexander; I did not see your entire issue.) I'd rather write ~ than unary

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread Alexander Belopolsky
On Fri, Dec 6, 2013 at 1:46 PM, Alan G Isaac alan.is...@gmail.com wrote: On 12/6/2013 1:35 PM, josef.p...@gmail.com wrote: unary versus binary minus Oh right; I consider binary `-` broken for Boolean arrays. (Sorry Alexander; I did not see your entire issue.) I'd rather write ~ than

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread Nathaniel Smith
On Fri, Dec 6, 2013 at 11:55 AM, Alexander Belopolsky ndar...@mac.com wrote: On Fri, Dec 6, 2013 at 1:46 PM, Alan G Isaac alan.is...@gmail.com wrote: On 12/6/2013 1:35 PM, josef.p...@gmail.com wrote: unary versus binary minus Oh right; I consider binary `-` broken for Boolean arrays.

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread josef . pktd
On Fri, Dec 6, 2013 at 2:59 PM, Nathaniel Smith n...@pobox.com wrote: On Fri, Dec 6, 2013 at 11:55 AM, Alexander Belopolsky ndar...@mac.com wrote: On Fri, Dec 6, 2013 at 1:46 PM, Alan G Isaac alan.is...@gmail.com wrote: On 12/6/2013 1:35 PM, josef.p...@gmail.com wrote: unary versus binary

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread Sebastian Berg
On Fri, 2013-12-06 at 15:30 -0500, josef.p...@gmail.com wrote: On Fri, Dec 6, 2013 at 2:59 PM, Nathaniel Smith n...@pobox.com wrote: On Fri, Dec 6, 2013 at 11:55 AM, Alexander Belopolsky ndar...@mac.com wrote: On Fri, Dec 6, 2013 at 1:46 PM, Alan G Isaac alan.is...@gmail.com wrote:

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread josef . pktd
On Fri, Dec 6, 2013 at 3:50 PM, Sebastian Berg sebast...@sipsolutions.net wrote: On Fri, 2013-12-06 at 15:30 -0500, josef.p...@gmail.com wrote: On Fri, Dec 6, 2013 at 2:59 PM, Nathaniel Smith n...@pobox.com wrote: On Fri, Dec 6, 2013 at 11:55 AM, Alexander Belopolsky ndar...@mac.com wrote:

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread Alan G Isaac
On 12/6/2013 3:30 PM, josef.p...@gmail.com wrote: 6 `**` follows from 1. Yes, but what really matters is that linalg.matrix_power give the correct (boolean) result. Alan ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread Alan G Isaac
On 12/6/2013 3:50 PM, Sebastian Berg wrote: Both of these are currently not defined, they will just cause upcast to int8. What does currently mean? `**` works fine for boolean arrays in 1.7.1. (It's useless, but it works.) Alan Isaac ___

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread josef . pktd
On Fri, Dec 6, 2013 at 4:14 PM, josef.p...@gmail.com wrote: On Fri, Dec 6, 2013 at 3:50 PM, Sebastian Berg sebast...@sipsolutions.net wrote: On Fri, 2013-12-06 at 15:30 -0500, josef.p...@gmail.com wrote: On Fri, Dec 6, 2013 at 2:59 PM, Nathaniel Smith n...@pobox.com wrote: On Fri, Dec 6,

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread Nathaniel Smith
Not sure how much time it's worth spending on coming up with new definitions for boolean subtraction, since even if we deprecate the current behavior now we won't be able to implement any of them for a year+, and then we'll end up having to go through these debates again then anyway. -n On Fri,

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread josef . pktd
On Fri, Dec 6, 2013 at 5:45 PM, Nathaniel Smith n...@pobox.com wrote: Not sure how much time it's worth spending on coming up with new definitions for boolean subtraction, since even if we deprecate the current behavior now we won't be able to implement any of them for a year+, and then we'll

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-06 Thread Charles R Harris
On Fri, Dec 6, 2013 at 2:14 PM, josef.p...@gmail.com wrote: On Fri, Dec 6, 2013 at 3:50 PM, Sebastian Berg sebast...@sipsolutions.net wrote: On Fri, 2013-12-06 at 15:30 -0500, josef.p...@gmail.com wrote: On Fri, Dec 6, 2013 at 2:59 PM, Nathaniel Smith n...@pobox.com wrote: On Fri, Dec 6,

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread Alexander Belopolsky
On Thu, Dec 5, 2013 at 5:37 PM, Sebastian Berg sebast...@sipsolutions.netwrote: For the moment I saw one annoying change in numpy, and that is `abs(x - y)` being used for allclose and working nicely currently. It would probably be an improvement if allclose returned all(x == y) unless one of

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread josef . pktd
On Thu, Dec 5, 2013 at 5:37 PM, Sebastian Berg sebast...@sipsolutions.net wrote: Hey, there was a discussion that for numpy booleans math operators +,-,* (and the unary -), while defined, are not very helpful. I have set up a quick PR with start (needs some fixes inside numpy still):

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread josef . pktd
On Thu, Dec 5, 2013 at 10:33 PM, josef.p...@gmail.com wrote: On Thu, Dec 5, 2013 at 5:37 PM, Sebastian Berg sebast...@sipsolutions.net wrote: Hey, there was a discussion that for numpy booleans math operators +,-,* (and the unary -), while defined, are not very helpful. I have set up a

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread Alexander Belopolsky
On Thu, Dec 5, 2013 at 5:37 PM, Sebastian Berg sebast...@sipsolutions.net wrote: there was a discussion that for numpy booleans math operators +,-,* (and the unary -), while defined, are not very helpful. It has been suggested at the Github that there is an area where it is useful to have

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread Alexander Belopolsky
On Thu, Dec 5, 2013 at 10:35 PM, josef.p...@gmail.com wrote: what about np.dot,np.dot(mask, x) which is the same as (mask * x).sum(0) ? I am not sure which way your argument goes, but I don't think you would find the following natural: x = array([True, True]) dot(x,x) True (x*x).sum()

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread josef . pktd
On Thu, Dec 5, 2013 at 10:56 PM, Alexander Belopolsky ndar...@mac.com wrote: On Thu, Dec 5, 2013 at 5:37 PM, Sebastian Berg sebast...@sipsolutions.net wrote: there was a discussion that for numpy booleans math operators +,-,* (and the unary -), while defined, are not very helpful. It has

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread Alan G Isaac
For + and * (and thus `dot`), this will fix something that is not broken. It is in fact in conformance with a large literature on boolean arrays and boolean matrices. That not everyone pays attention to this literature does not constitute a reason to break the extant, correct behavior. I'm sure

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread Alexander Belopolsky
On Thu, Dec 5, 2013 at 11:05 PM, Alan G Isaac alan.is...@gmail.com wrote: For + and * (and thus `dot`), this will fix something that is not broken. + and * are not broken - just redundant given | and . What is really broken is -, both unary and binary: int(np.bool_(0) - np.bool_(1)) 1

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread josef . pktd
On Thu, Dec 5, 2013 at 11:00 PM, Alexander Belopolsky ndar...@mac.com wrote: On Thu, Dec 5, 2013 at 10:35 PM, josef.p...@gmail.com wrote: what about np.dot,np.dot(mask, x) which is the same as (mask * x).sum(0) ? I am not sure which way your argument goes, but I don't think you would