<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Dear Numpy maintainers and developers,<br class="">
<br class="">
Thanks for providing such a great numerical library!<br class="">
<br class="">
Iām currently trying to implement the Dynamic Time Warping metric as a set of generalised numpy ufuncs, but unfortunately, I have lasting issues with pointer arithmetic and segmentation faults. Is there any way that I can<br class="">
use GDB or some such to debug a python/numpy extension? Furthermore: is it necessary to use pointer arithmetic to access the function arguments (as seen on <a href="http://docs.scipy.org/doc/numpy/user/c-info.ufunc-tutorial.html" class="">http://docs.scipy.org/doc/numpy/user/c-info.ufunc-tutorial.html</a>)<br class="">
or is element access (operator[]) also permissible?<br class="">
<br class="">
To break it down quickly, I need to have a fast DTW distance function dist_dtw() with two vector inputs (broadcasting should be possible), two scalar parameters and one scalar output (signature: (i), (j), (), () -> ()) usable in python for a 1-Nearest Neighbor
classification algorithm. The extension also implements two functions compute_envelope() and piecewise_mean_reduction() which are used for lower-bounding based on Keogh and Ratanamahatana, 2005. The source code is available at <a href="http://pastebin.com/MunNaP7V" class="">http://pastebin.com/MunNaP7V</a> and
the prominent segmentation fault happens somewhere in the chain dist_dtw() ā> meta_dtw_dist() ā> slow_dtw_dist(), but I fail to pin it down.<br class="">
<br class="">
Aside from my primary questions, I wonder how to approach errors/exceptions and unit testing when developing numpy ufuncs. Are there any examples apart from the numpy manual that I could use as reference implementations of generalised numpy ufuncs?<br class="">
<br class="">
I would greatly appreciate some insight into properly developing generalised ufuncs.<br class="">
<br class="">
Best,<br class="">
Eleanore<br class="">
<br class="">
</body>
</html>