<div dir="ltr"><div>I could get behind the context manager approach. It would help keep backwards compatibility, while providing a very easy (and clean) way of consistently using the same reduction operation. Adding kwargs is just a road to hell.<br>

<br></div>Cheers!<br>Ben Root<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jul 26, 2014 at 9:53 AM, Julian Taylor <span dir="ltr"><<a href="mailto:jtaylor.debian@googlemail.com" target="_blank">jtaylor.debian@googlemail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On <a href="tel:26.07.2014%2015" value="+12607201415">26.07.2014 15</a>:38, Eelco Hoogendoorn wrote:<br>

><br>
> Why is it not always used?<br>
<br>
</div>for 1d reduction the iterator blocks by 8192 elements even when no<br>
buffering is required. There is a TODO in the source to fix that by<br>
adding additional checks. Unfortunately nobody knows hat these<br>
additional tests would need to be and Mark Wiebe who wrote it did not<br>
reply to a ping yet.<br>
<br>
Also along the non-fast axes the iterator optimizes the reduction to<br>
remove the strided access, see:<br>
<a href="https://github.com/numpy/numpy/pull/4697#issuecomment-42752599" target="_blank">https://github.com/numpy/numpy/pull/4697#issuecomment-42752599</a><br>
<br>
<br>
Instead of having a keyword argument to mean I would prefer a context<br>
manager that changes algorithms for different requirements.<br>
This would easily allow changing the accuracy and performance of third<br>
party functions using numpy without changing the third party library as<br>
long as they are using numpy as the base.<br>
E.g.<br>
with np.precisionstate(sum="kahan"):<br>
  scipy.stats.nanmean(d)<br>
<br>
We also have case where numpy uses algorithms that are far more precise<br>
than most people needs them. E.g. np.hypot and the related complex<br>
absolute value and division.<br>
These are very slow with glibc as it provides 1ulp accuracy, this is<br>
hardly ever needed.<br>
Another case that could use dynamic changing is flushing subnormals to zero.<br>
<br>
But this api is like Nathaniels parameterizable dtypes just an idea<br>
floating in my head which needs proper design and implementation written<br>
down. The issue is as usual ENOTIME.<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
</div></div></blockquote></div><br></div>