<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Ok that are indeed some good reasons to keep the status quo, especially since performance is crucial for numpy.</div>
<div> </div>
<div>It's a dillemma: Using the matrix class for linear algebra would be the correct way for such thing,</div>
<div>but the matrix API is not that powerful and beautiful as the one of arrays.</div>
<div>On the other hand arrays are beautiful, but not exactly intended to use for linear algebra.</div>
<div> </div>
<div>So maybe the better way would be not to add warnings to braodcasting operations, but to overhaul the matrix class</div>
<div>to make it more attractive for numerical linear algebra(?)</div>
<div>
<div> </div>
<div>Cheers,</div>
<div>Stefan</div>
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Sonntag, 08. Februar 2015 um 23:52 Uhr<br/>
<b>Von:</b> "Nathaniel Smith" <njs@pobox.com><br/>
<b>An:</b> "Discussion of Numerical Python" <numpy-discussion@scipy.org><br/>
<b>Betreff:</b> Re: [Numpy-discussion] Silent Broadcasting considered harmful</div>
<div name="quoted-content">
<p>On 8 Feb 2015 13:04, "Stefan Reiterer" <<a href="domors@gmx.net" target="_parent">domors@gmx.net</a>> wrote:<br/>
><br/>
> So I suggest that the best would be to throw warnings when arrays get Broadcasted like<br/>
> Octave do. Python warnings can be catched and handled, that would be a great benefit.<br/>
> <br/>
> Another idea would to provide warning levels for braodcasting, e.g<br/>
> 0 = Never, 1=Warn once, 2=Warn always, 3 = Forbid aka throw exception,<br/>
> with 0 as default.<br/>
> This would avoid breaking other code, and give the user some control over braodcasting.</p>
<p>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.</p>
<p>Note also that in numpy, even simple expressions like '2 * arr' rely on broadcasting. Do you really want warnings for all these cases?</p>
<p>-n</p>
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org <a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a></div>
</div>
</div>
</div></div></body></html>