<p dir="ltr">Hi,</p>
<p dir="ltr">It sounds like putting together a PR makes sense then. I'll try hacking on this a bit.</p>
<p dir="ltr">-Robert</p>
<div class="gmail_quote">On Mar 16, 2015 11:20 AM, "Jaime Fernández del Río" <<a href="mailto:jaime.frio@gmail.com">jaime.frio@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Mar 16, 2015 at 9:28 AM, Jerome Kieffer <span dir="ltr"><<a href="mailto:Jerome.Kieffer@esrf.fr" target="_blank">Jerome.Kieffer@esrf.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, 16 Mar 2015 06:56:58 -0700<br>
<span>Jaime Fernández del Río <<a href="mailto:jaime.frio@gmail.com" target="_blank">jaime.frio@gmail.com</a>> wrote:<br>
<br>
</span><span>> Dispatching to a different method seems like a no brainer indeed. The<br>
> question is whether we really need to do this in C.<br>
<br>
</span>I need to do both unweighted & weighted histograms and we got a factor 5 using (simple) cython:<br>
it is in the proceedings of Euroscipy, last year.<br>
<a href="http://arxiv.org/pdf/1412.6367.pdf" target="_blank">http://arxiv.org/pdf/1412.6367.pdf</a></blockquote><div><br></div><div>If I read your paper and code properly, you got 5x faster, mostly because you combined the weighted and unweighted histograms into a single search of the array, and because you used an algorithm that can only be applied to equal- sized bins, similarly to the 10x speed-up Robert was reporting.</div><div><br></div><div>I think that having a special path for equal sized bins is a great idea: let's do it, PRs are always welcome!</div><div>Similarly, getting the counts together with the weights seems like a very good idea.</div><div><br></div><div>I also think that writing it in Python is going to take us 80% of the way there: most of the improvements both of you have reported are not likely to be coming from the language chosen, but from the algorithm used. And if C proves to be sufficiently faster to warrant using it, it should be confined to the number crunching: I don;t think there is any point in rewriting argument parsing in C.</div><div><br></div><div>Also, keep in mind `np.histogram` can now handle arrays of just about **any** dtype. Handling that complexity in C is not a ride in the park. Other functions like `np.bincount` and `np.digitize` cheat by only handling `double` typed arrays, a luxury that histogram probably can't afford at this point in time.</div><div><br></div><div>Jaime</div><div><br></div></div>-- <br><div>(\__/)<br>( O.o)<br>( > <) Este es Conejo. Copia a Conejo en tu firma y ayúdale en sus planes de dominación mundial.</div>
</div></div>
<br>_______________________________________________<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>
<br></blockquote></div>