Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-10 Thread Sturla Molden
Chris Barker chris.bar...@noaa.gov wrote: The strongest use-case seems to be for teaching that involves linear algebra concepts, not real production code. Not really. SymPy is a better teaching tool. Some find A*B easier to read than dot(A,B). But with the @ operator in Python 3.5 it does

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-10 Thread Todd
On Feb 10, 2015 1:03 AM, cjw c...@ncf.ca wrote: On 09-Feb-15 2:34 AM, Stefan Reiterer wrote: Ok that are indeed some good reasons to keep the status quo, especially since performance is crucial for numpy. It's a dillemma: Using the matrix class for linear algebra would be the correct way

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-10 Thread Ralf Gommers
On Tue, Feb 10, 2015 at 5:40 PM, Chris Barker chris.bar...@noaa.gov wrote: On Tue, Feb 10, 2015 at 12:28 AM, Todd toddr...@gmail.com wrote: So maybe the better way would be not to add warnings to braodcasting operations, but to overhaul the matrix class to make it more attractive for

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-10 Thread Sturla Molden
Chris Barker chris.bar...@noaa.gov wrote: Well, splitting it off is a good idea, seeing as how it hasn't gotten much love. But if the rest of numpy does not work well with it, then it becomes even less useful. PEP 3118 takes care of that. Sturla

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-09 Thread Sturla Molden
On 09/02/15 08:34, Stefan Reiterer wrote: So maybe the better way would be not to add warnings to braodcasting operations, but to overhaul the matrix class to make it more attractive for numerical linear algebra(?) I think you underestimate the amount of programming this would take. Take an

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-09 Thread Nathaniel Smith
On 8 Feb 2015 23:34, Stefan Reiterer dom...@gmx.net wrote: Ok that are indeed some good reasons to keep the status quo, especially since performance is crucial for numpy. It's a dillemma: Using the matrix class for linear algebra would be the correct way for such thing, but the matrix API is

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-09 Thread Stefan Reiterer
that discussion. -Stefan Gesendet:Montag, 09. Februar 2015 um 09:51 Uhr Von:Nathaniel Smith n...@pobox.com An:Discussion of Numerical Python numpy-discussion@scipy.org Betreff:Re: [Numpy-discussion] Silent Broadcasting considered harmful On 8 Feb 2015 23:34, Stefan Reiterer dom...@gmx.net wrote: Ok

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-09 Thread R Schumacher
Schumacher r...@blue-cove.com An: Discussion of Numerical Python numpy-discussion@scipy.org Betreff: Re: [Numpy-discussion] Silent Broadcasting considered harmful At 02:47 PM 2/8/2015, Simon Wood wrote: Not quite the same. This is not so much about language semantics as mathematical definitions. You

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-09 Thread Chris Barker
On Sun, Feb 8, 2015 at 2:17 PM, Stefan Reiterer dom...@gmx.net wrote: Till now the only way out of the misery is to make proper unit tests, That's the only way out of the misery of software bugs in general -- nothing special here ;-) Python is a dynamically typed language -- EVERYTHING

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-09 Thread Sturla Molden
Chris Barker chris.bar...@noaa.gov wrote: Do you realize that: arr = np.ones((5,)) ar2 = arr * 5 is broadcasting, too? Perhaps we should only warn for a subset of broadcastings? E.g. avoid the warning on scalar times array. I prefer we don't warn about this though, because it might

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-09 Thread Chris Barker
...@pobox.com *An:* Discussion of Numerical Python numpy-discussion@scipy.org numpy-discussion@scipy.org *Betreff:* Re: [Numpy-discussion] Silent Broadcasting considered harmful On 8 Feb 2015 13:04, Stefan Reiterer dom...@gmx.net dom...@gmx.net wrote: So I suggest that the best would

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Stefan Reiterer
numpy-discussion@scipy.org Betreff:Re: [Numpy-discussion] Silent Broadcasting considered harmful I personally use Octave and/or Numpy for several years now and never ever needed braodcasting. But since it is still there there will be many users who need it, there will be some use for it. Uhm, yeah

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread josef.pktd
On Sun, Feb 8, 2015 at 4:08 PM, Eelco Hoogendoorn hoogendoorn.ee...@gmail.com wrote: I personally use Octave and/or Numpy for several years now and never ever needed braodcasting. But since it is still there there will be many users who need it, there will be some use for it. Uhm, yeah,

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Charles R Harris
:* Eelco Hoogendoorn hoogendoorn.ee...@gmail.com *An:* Discussion of Numerical Python numpy-discussion@scipy.org *Betreff:* Re: [Numpy-discussion] Silent Broadcasting considered harmful I personally use Octave and/or Numpy for several years now and never ever needed braodcasting. But since

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Stefan Reiterer
, 08. Februar 2015 um 22:17 Uhr Von:Charles R Harris charlesr.har...@gmail.com An:Discussion of Numerical Python numpy-discussion@scipy.org Betreff:Re: [Numpy-discussion] Silent Broadcasting considered harmful On Sun, Feb 8, 2015 at 2:14 PM, Stefan Reiterer dom...@gmx.net wrote: Yeah Im

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Matthew Brett
it, but they warn about it's usage. This has indeed it's merits. Gesendet: Sonntag, 08. Februar 2015 um 22:17 Uhr Von: Charles R Harris charlesr.har...@gmail.com An: Discussion of Numerical Python numpy-discussion@scipy.org Betreff: Re: [Numpy-discussion] Silent Broadcasting considered harmful

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Simon Wood
:* Eelco Hoogendoorn hoogendoorn.ee...@gmail.com *An:* Discussion of Numerical Python numpy-discussion@scipy.org *Betreff:* Re: [Numpy-discussion] Silent Broadcasting considered harmful I personally use Octave and/or Numpy for several years now and never ever needed braodcasting. But since

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Warren Focke
On Sun, 8 Feb 2015, Stefan Reiterer wrote: And as already mentioned: other matrix languages also allow it, but they warn about it's usage. This has indeed it's merits. numpy isn't a matrix language. They're arrays. Storing numbers that you are thinking of as a vector in an array doesn't

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Matthew Brett
Betreff: Re: [Numpy-discussion] Silent Broadcasting considered harmful On Sun, Feb 8, 2015 at 2:14 PM, Stefan Reiterer dom...@gmx.net wrote: Yeah I'm aware of that, that's the reason why I suggested a warning level as an alternative. Setting no warnings as default would avoid breaking existing

[Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Stefan Reiterer
Hi! As shortly discussed on github: https://github.com/numpy/numpy/issues/5541 I personally think that silent Broadcasting is not a good thing. I had recently a lot of trouble with row and column vectors which got bradcastet toghether altough it was more annoying than useful, especially

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Eelco Hoogendoorn
I personally use Octave and/or Numpy for several years now and never ever needed braodcasting. But since it is still there there will be many users who need it, there will be some use for it. Uhm, yeah, there is some use for it. Im all for explicit over implicit, but personally current

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Stefan Reiterer
:56 Uhr Von:Matthew Brett matthew.br...@gmail.com An:Discussion of Numerical Python numpy-discussion@scipy.org Betreff:Re: [Numpy-discussion] Silent Broadcasting considered harmful Hi, On Sun, Feb 8, 2015 at 1:39 PM, Simon Wood sgwoo...@gmail.com wrote: On Sun, Feb 8, 2015 at 4:24 PM, Stefan

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread josef.pktd
...@gmail.com An: Discussion of Numerical Python numpy-discussion@scipy.org Betreff: Re: [Numpy-discussion] Silent Broadcasting considered harmful On Sun, Feb 8, 2015 at 2:14 PM, Stefan Reiterer dom...@gmx.net wrote: Yeah I'm aware of that, that's the reason why I suggested a warning level

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread josef.pktd
...@gmail.com An: Discussion of Numerical Python numpy-discussion@scipy.org Betreff: Re: [Numpy-discussion] Silent Broadcasting considered harmful Hi, On Sun, Feb 8, 2015 at 1:39 PM, Simon Wood sgwoo...@gmail.com wrote: On Sun, Feb 8, 2015 at 4:24 PM, Stefan Reiterer dom...@gmx.net wrote: I

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Nathaniel Smith
On 8 Feb 2015 13:39, Simon Wood sgwoo...@gmail.com wrote: I find the broadcasting aspect of Numpy a turn off. If I go to add a 1x3 vector to a 3x1 vector, I want the program to warn me or error out. I don't want it to do something under the covers that has no mathematical basis or definition.

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Simon Wood
. Gesendet: Sonntag, 08. Februar 2015 um 22:17 Uhr Von: Charles R Harris charlesr.har...@gmail.com An: Discussion of Numerical Python numpy-discussion@scipy.org Betreff: Re: [Numpy-discussion] Silent Broadcasting considered harmful On Sun, Feb 8, 2015 at 2:14 PM, Stefan Reiterer dom...@gmx.net

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Sturla Molden
Simon Wood sgwoo...@gmail.com wrote: Not quite the same. This is not so much about language semantics as mathematical definitions. You (the Numpy community) have decided to overload certain mathematical operators to act in a way that is not consistent with linear algebra teachings. We have

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Sturla Molden
On 08/02/15 23:17, Stefan Reiterer wrote: Actually I use numpy for several years now, and I love it. The reason that I think silent broadcasting of sums is bad comes simply from the fact, that I had more trouble with it, than it helped me. In Fortran 90, broadcasting allows us to write

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Stefan Reiterer
Gesendet:Sonntag, 08. Februar 2015 um 23:52 Uhr Von:Nathaniel Smith n...@pobox.com An:Discussion of Numerical Python numpy-discussion@scipy.org Betreff:Re: [Numpy-discussion] Silent Broadcasting considered harmful On 8 Feb 2015 13:04, Stefan Reiterer dom...@gmx.net wrote: So I suggest that the best would

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Eric Firing
On 2015/02/08 12:43 PM, josef.p...@gmail.com wrote: For me the main behavior I had to adjust to was loosing a dimension in any reduce operation, mean, sum, ... if x is 2d x - x.mean(1) we loose a dimension, and it doesn't broadcast in the right direction Though you can use: x_demeaned =