diff --git a/src/python/histogram.cpp b/src/python/histogram.cpp index e7d8a5cd..c7634410 100644 --- a/src/python/histogram.cpp +++ b/src/python/histogram.cpp @@ -7,6 +7,7 @@ #include "serialization_suite.hpp" #include #include +#include #include #include #include @@ -74,8 +75,8 @@ histogram_fill(python::tuple args, python::dict kwargs) { if (nargs == 2) { object o = args[1]; if (PySequence_Check(o.ptr())) { - PyArrayObject* a = (PyArrayObject*) - PyArray_FROM_OTF(o.ptr(), NPY_DOUBLE, NPY_ARRAY_IN_ARRAY); + PyArrayObject* a = reinterpret_cast + (PyArray_FROM_OTF(o.ptr(), NPY_DOUBLE, NPY_ARRAY_IN_ARRAY)); if (!a) { PyErr_SetString(PyExc_ValueError, "could not convert sequence into array"); throw_error_already_set(); @@ -103,8 +104,8 @@ histogram_fill(python::tuple args, python::dict kwargs) { if (!ow.is_none()) { if (PySequence_Check(ow.ptr())) { - PyArrayObject* aw = (PyArrayObject*) - PyArray_FROM_OTF(ow.ptr(), NPY_DOUBLE, NPY_ARRAY_IN_ARRAY); + PyArrayObject* aw = reinterpret_cast + (PyArray_FROM_OTF(ow.ptr(), NPY_DOUBLE, NPY_ARRAY_IN_ARRAY)); if (!aw) { PyErr_SetString(PyExc_ValueError, "could not convert sequence into array"); throw_error_already_set(); @@ -121,9 +122,9 @@ histogram_fill(python::tuple args, python::dict kwargs) { } for (unsigned i = 0; i < dims[0]; ++i) { - double* v = (double*)PyArray_GETPTR1(a, i); - double* w = (double*)PyArray_GETPTR1(aw, i); - self.wfill_c(self.dim(), v, *w); + double* v = reinterpret_cast(PyArray_GETPTR1(a, i) ); + double* w = reinterpret_cast(PyArray_GETPTR1(aw, i)); + self.wfill(boost::make_iterator_range(v, v+self.dim()), *w); } Py_DECREF(aw); @@ -133,8 +134,8 @@ histogram_fill(python::tuple args, python::dict kwargs) { } } else { for (unsigned i = 0; i < dims[0]; ++i) { - double* v = (double*)PyArray_GETPTR1(a, i); - self.fill_c(self.dim(), v); + double* v = reinterpret_cast(PyArray_GETPTR1(a, i)); + self.fill(boost::make_iterator_range(v, v+self.dim())); } } @@ -155,10 +156,11 @@ histogram_fill(python::tuple args, python::dict kwargs) { v[i] = extract(args[1 + i]); if (ow.is_none()) { - self.fill_c(self.dim(), v); + self.fill(boost::make_iterator_range(v, v+self.dim())); + } else { const double w = extract(ow); - self.wfill_c(self.dim(), v, w); + self.wfill(boost::make_iterator_range(v, v+self.dim()), w); } return object(); @@ -183,7 +185,7 @@ histogram_value(python::tuple args, python::dict kwargs) { for (unsigned i = 0; i < self.dim(); ++i) idx[i] = extract(args[1 + i]); - return object(self.value_c(self.dim(), idx)); + return object(self.value(boost::make_iterator_range(idx, idx + self.dim()))); } python::object @@ -205,7 +207,7 @@ histogram_variance(python::tuple args, python::dict kwargs) { for (unsigned i = 0; i < self.dim(); ++i) idx[i] = extract(args[1 + i]); - return object(self.variance_c(self.dim(), idx)); + return object(self.variance(boost::make_iterator_range(idx, idx + self.dim()))); } class histogram_access { @@ -217,14 +219,14 @@ public: python::list shape; for (unsigned i = 0; i < self.dim(); ++i) shape.append(self.shape(i)); - if (self.data_.depth() == sizeof(detail::wtype)) { + if (self.depth() == sizeof(detail::wtype)) { shape.append(2); d["typestr"] = python::str("(self.buffer()), false); return d; } };