<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; "><div style="word-wrap:break-word"><div><div><div class="h5"><div><br></div><blockquote type="cite"><div class="gmail_quote"><div>
  <br></div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="gmail_quote">
<div>That is sort of the point of all this.  We are using 16 bit integers because we wanted to be as efficient as possible and didn't need anything larger.  Note, that is what we changed the code to, I am just wondering if we are being too cautious.  The casting kwarg looks to be what I might want, though it isn't as clean as just writing an "*=" statement.<br>



<br></div></div></blockquote><div><br>I think even there you will have an intermediate float array followed by a cast.<br></div></div></blockquote><div><br></div></div></div><div>This is true, but it is done in chunks of a fixed size (controllable by a thread-local variable or keyword argument to the ufunc).    </div>
<div><br></div><div>How difficult would it be to change in-place operations back to the "unsafe" default?<br></div></div></div></blockquote><div><br>Probably not too difficult, but I think it would be a mistake. What keyword argument are you referring to? In the current case, I think what is wanted is a scaling function that will actually do things in place. The matplotlib folks would probably be happier with the result if they simply coded up a couple of small Cython routines to do that.<br></div></div></blockquote><div><br></div><div><a href="http://docs.scipy.org/doc/numpy/reference/ufuncs.html#ufunc">http://docs.scipy.org/doc/numpy/reference/ufuncs.html#ufunc</a></div><div><br></div><div>In particular, the extobj keyword argument or the thread-local variable at umath.UFUNC_PYVALS_NAME</div><div><br></div><div>But, the problem is not just for matplotlib.   Matplotlib is showing a symptom of the problem of just changing the default casting mode in one release.    I think this is too stark of a change for a single minor release without some kind of glide path or warning system.</div><div><br></div><div>I think we need to change in-place multiplication back to "unsafe" and then put in the release notes that we are planning on changing this for 1.8.   It would be ideal if we could raise a warning when "unsafe" castings occur. </div><div><br></div><div>-Travis</div><div><br></div><div><br></div></div></body></html>