e***@artorg.unibe.ch
2015-10-25 12:06:46 UTC
Dear Numpy maintainers and developers,
Thanks for providing such a great numerical library!
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
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 http://docs.scipy.org/doc/numpy/user/c-info.ufunc-tutorial.html)
or is element access (operator[]) also permissible?
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 http://pastebin.com/MunNaP7V 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.
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?
I would greatly appreciate some insight into properly developing generalised ufuncs.
Best,
Eleanore
Thanks for providing such a great numerical library!
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
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 http://docs.scipy.org/doc/numpy/user/c-info.ufunc-tutorial.html)
or is element access (operator[]) also permissible?
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 http://pastebin.com/MunNaP7V 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.
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?
I would greatly appreciate some insight into properly developing generalised ufuncs.
Best,
Eleanore