[Numpy-discussion] Silent Broadcasting considered harmful

Chris Barker chris.barker at noaa.gov
Mon Feb 9 20:02:27 EST 2015


On Mon, Feb 9, 2015 at 4:02 PM, cjw <cjw at ncf.ca> wrote:

> to overhaul the matrix class
> to make it more attractive for numerical linear algebra(?)
>
>  +1
>

Sure -- though I don't know that this actually has anyting to do with
braodcasting -- unless the idea is that Matrices would be broadcastable?

But anyway, the Matrix class leaves a lot to be desired. Enough, in fact,
that most of us don't recommend using it at all. There has been a bunch of
discussion on this list in the past about what could be done to make it
better. But the real blocker is that no-one that actually develops numpy
itself used them, or has  need for them. The strongest use-case seems to be
for teaching that involves linear algebra concepts, not real production
code.

Also -- it's proven to be really hard to write sub-classes of ndarray that
work consistently and well -- you tend to keep accidentally getting raw
arrays back... So maybe it can't really be done well at all?

-Chris





> I hope that this will be explored.  @ could still be used by those who
> wish remain in the array world.
>
> Colin W.
>
> Cheers,
> Stefan
> *Gesendet:* Sonntag, 08. Februar 2015 um 23:52 Uhr
> *Von:* "Nathaniel Smith" <njs at pobox.com> <njs at pobox.com>
> *An:* "Discussion of Numerical Python" <numpy-discussion at scipy.org> <numpy-discussion at scipy.org>
> *Betreff:* Re: [Numpy-discussion] Silent Broadcasting considered harmful
>
> On 8 Feb 2015 13:04, "Stefan Reiterer" <domors at gmx.net> <domors at gmx.net> 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
>  > 0 = Never, 1=Warn once, 2=Warn always, 3 = Forbid aka throw exception,
>  > with 0 as default.
>  > This would avoid breaking other code, and give the user some control over
> braodcasting.
>
> Unfortunately adding warnings is a non-starter for technical reasons, even
> before we get into the more subjective debate about ideal API design: issuing a
> warning is extremely slow (relative to typical array operations), EVEN IF the
> warning is disabled. (By the time you can figure out it's disabled, it's too
> late.) So this would cause massive slowdowns in existing code.
>
> Note also that in numpy, even simple expressions like '2 * arr' rely on
> broadcasting. Do you really want warnings for all these cases?
>
> -n
>
> _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion at scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
>
> _______________________________________________
> NumPy-Discussion mailing listNumPy-Discussion at scipy.orghttp://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150209/d02cdc1c/attachment.html>


More information about the NumPy-Discussion mailing list