Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Stefan Reiterer
That sounds like a good idea! I didn't see any real good examples of usage after some googling. Giving more examples of effective usage could also clear more things up regarding design decisions. Additionally I'm always interested in learning some new tricks :)   Cheers, Stefan   Gesendet:

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Stefan Reiterer
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 not that powerful and beautiful as the one of arrays. On t

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 co

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Sturla Molden
Simon Wood 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 overloaded the o

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Sturla Molden
Matthew Brett wrote: > I agree. I knew about broadcasting as soon as I started using numpy, > so I can honestly say this has never surprised me. Fortran 90 has broadcasting too. NumPy's broadcasting was inspired by Fortran 90, which was the lingua franca of scientific computing in the 1990s. Li

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread josef.pktd
On Sun, Feb 8, 2015 at 7:12 PM, Eric Firing wrote: > 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

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_demea

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Eelco Hoogendoorn
Yeah, its all about the preferred semantics. Indeed if you want to use LA semantics, ndarray semantics are somewhat of a disappointment; though I would argue they do have a very well design internal logic of their own. Much moreso than LA semantics in the first place; LA semantics fail to general

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread R Schumacher
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 (the Numpy community) have decided to >overload certain mathematical operators to act in a way that is not >consistent with linear algebra teachings. This c

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread cjw
On 08-Feb-15 5:47 PM, Nathaniel Smith wrote: On 8 Feb 2015 13:39, "Simon Wood" 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

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Nathaniel Smith
On 8 Feb 2015 13:04, "Stefan Reiterer" wrote: > > So I suggest that the best would be to throw warnings when arrays get Broadcasted like > Octave do. Python warnings can be catched and handled, that would be a great benefit. > > Another idea would to provide warning levels for braodcasting, e.g >

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Simon Wood
On Sun, Feb 8, 2015 at 5:28 PM, wrote: > On Sun, Feb 8, 2015 at 4:56 PM, Matthew Brett > wrote: > > Hi, > > > > On Sun, Feb 8, 2015 at 1:39 PM, Simon Wood wrote: > >> > >> > >> On Sun, Feb 8, 2015 at 4:24 PM, Stefan Reiterer wrote: > >>> > >>> I don't think this is a good comparison, especiall

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Nathaniel Smith
On 8 Feb 2015 13:39, "Simon Wood" 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. Also, Octave may

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread josef.pktd
On Sun, Feb 8, 2015 at 5:17 PM, 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. > > I won't stop using numpy because

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread josef.pktd
On Sun, Feb 8, 2015 at 4:56 PM, Matthew Brett wrote: > Hi, > > On Sun, Feb 8, 2015 at 1:39 PM, Simon Wood wrote: >> >> >> On Sun, Feb 8, 2015 at 4:24 PM, Stefan Reiterer wrote: >>> >>> I don't think this is a good comparison, especially since broadcasting is >>> a feature not a necessity ... >>>

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Stefan Reiterer
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.   I won't stop using numpy because of that, but I think this behavior may backfire, and thats t

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Benjamin Root
numpy is like Tesla. Everybody else has been doing it wrong... Ben Root On Sun, Feb 8, 2015 at 4:39 PM, Simon Wood wrote: > > > On Sun, Feb 8, 2015 at 4:24 PM, Stefan Reiterer wrote: > >> I don't think this is a good comparison, especially since broadcasting is >> a feature not a necessity ...

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Eelco Hoogendoorn
This. (nd)arrays are a far more widespread concept than linear algebraic operations. If you want LA semantics, use the matrix subclass. Or don't, since simply sticking to the much more pervasive and general ndarray semantics is usually simpler and less confusing. On Sun, Feb 8, 2015 at 10:54 PM, W

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Matthew Brett
Hi, On Sun, Feb 8, 2015 at 1:39 PM, Simon Wood wrote: > > > On Sun, Feb 8, 2015 at 4:24 PM, Stefan Reiterer wrote: >> >> I don't think this is a good comparison, especially since broadcasting is >> a feature not a necessity ... >> It's more like turning off/on driving assistance. >> >> And as al

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 t

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Simon Wood
On Sun, Feb 8, 2015 at 4:24 PM, Stefan Reiterer wrote: > I don't think this is a good comparison, especially since broadcasting is > a feature not a necessity ... > It's more like turning off/on driving assistance. > > And as already mentioned: other matrix languages also allow it, but they > war

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Matthew Brett
Hi, On Sun, Feb 8, 2015 at 1:24 PM, Stefan Reiterer wrote: > I don't think this is a good comparison, especially since broadcasting is a > feature not a necessity ... > It's more like turning off/on driving assistance. > > And as already mentioned: other matrix languages also allow it, but they >

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Stefan Reiterer
I don't think this is a good comparison, especially since broadcasting is a feature not a necessity ... It's more like turning off/on driving assistance.   And as already mentioned: other matrix languages also allow it, but they warn about it's usage. This has indeed it's merits. Gesendet: S

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Charles R Harris
On Sun, Feb 8, 2015 at 2:14 PM, Stefan Reiterer 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 code. > *Gesendet:* Sonntag, 08. Februar 2015 um 22:08 Uhr > *Von:* "Eelco Hoogen

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread josef.pktd
On Sun, Feb 8, 2015 at 4:08 PM, Eelco Hoogendoorn 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, there is some use for i

Re: [Numpy-discussion] Silent Broadcasting considered harmful

2015-02-08 Thread Stefan Reiterer
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 code. Gesendet: Sonntag, 08. Februar 2015 um 22:08 Uhr Von: "Eelco Hoogendoorn" An: "Discussion of Numerical Python" Betreff: Re: [Numpy-di

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 broadcas

[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