summaryrefslogtreecommitdiff
path: root/src/python/include
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2020-06-09 19:45:31 +0200
committerGitHub <noreply@github.com>2020-06-09 19:45:31 +0200
commit58f7cd2d1fec9b12665ad10c16b9812eba303570 (patch)
treed68fd29693505e78811db0ff1b9fe052fc11637b /src/python/include
parent434cc66fbf832ca492e5f0710c8afc67d681637a (diff)
parentdacc3e363ded8b68bb4b71c1602e2c52b10b36e5 (diff)
Merge pull request #337 from mglisse/herab
Interface for hera's bottleneck_distance
Diffstat (limited to 'src/python/include')
-rw-r--r--src/python/include/pybind11_diagram_utils.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/python/include/pybind11_diagram_utils.h b/src/python/include/pybind11_diagram_utils.h
index d9627258..2d5194f4 100644
--- a/src/python/include/pybind11_diagram_utils.h
+++ b/src/python/include/pybind11_diagram_utils.h
@@ -18,8 +18,8 @@ namespace py = pybind11;
typedef py::array_t<double> Dgm;
// Get m[i,0] and m[i,1] as a pair
-static auto pairify(void* p, ssize_t h, ssize_t w) {
- return [=](ssize_t i){
+static auto pairify(void* p, py::ssize_t h, py::ssize_t w) {
+ return [=](py::ssize_t i){
char* birth = (char*)p + i * h;
char* death = birth + w;
return std::make_pair(*(double*)birth, *(double*)death);
@@ -32,8 +32,8 @@ inline auto numpy_to_range_of_pairs(py::array_t<double> dgm) {
if((buf.ndim!=2 || buf.shape[1]!=2) && (buf.ndim!=1 || buf.shape[0]!=0))
throw std::runtime_error("Diagram must be an array of size n x 2");
// In the case of shape (0), avoid reading non-existing strides[1] even if we won't use it.
- ssize_t stride1 = buf.ndim == 2 ? buf.strides[1] : 0;
- auto cnt = boost::counting_range<ssize_t>(0, buf.shape[0]);
+ py::ssize_t stride1 = buf.ndim == 2 ? buf.strides[1] : 0;
+ auto cnt = boost::counting_range<py::ssize_t>(0, buf.shape[0]);
return boost::adaptors::transform(cnt, pairify(buf.ptr, buf.strides[0], stride1));
// Be careful that the returned range cannot contain references to dead temporaries.
}