Giter Club home page Giter Club logo

Comments (6)

jkfurtney avatar jkfurtney commented on July 18, 2024

Just a small change may fix this? c0e3849 uses a different include for numpy. It looks like including that specific header was a mistake from the beginning (2012) as none of the noprefix names are ever used anywhere. The linux build seem to still work, if this looks good I can create another release.

from scikit-fmm.

jkfurtney avatar jkfurtney commented on July 18, 2024

I should add I tested this with numpy 1.26.4

from scikit-fmm.

jan-janssen avatar jan-janssen commented on July 18, 2024

I tried patching it but I got the following error:

../skfmm/fmm.cpp:115:48: error: 'PyArray_DOUBLE' was not declared in this scope; did you mean 'PyArray_DTYPE'?

from scikit-fmm.

jan-janssen avatar jan-janssen commented on July 18, 2024

I used the following patch:

From c0e384906a1017c4e49d9da1534a0bddf5230e28 Mon Sep 17 00:00:00 2001
From: Jason Furtney <[email protected]>
Date: Thu, 30 May 2024 13:05:44 -0500
Subject: [PATCH] change numpy header include

---
 skfmm/fmm.cpp | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletion(-)

diff --git a/skfmm/fmm.cpp b/skfmm/fmm.cpp
index 351a51d..5714206 100644
--- a/skfmm/fmm.cpp
+++ b/skfmm/fmm.cpp
@@ -2,7 +2,8 @@
 // implementation of the fast marching method in fast_marching.cpp
 
 #include "Python.h"
-#include "numpy/noprefix.h"
+#include "numpy/ndarraytypes.h"
+#include "numpy/ufuncobject.h"
 
 #include "distance_marcher.h"
 #include "travel_time_marcher.h"
@@ -112,7 +112,7 @@ static PyObject *distance_method(PyObject *self, PyObject *args)
     return NULL;
   }
 
-  phi = (PyArrayObject *)PyArray_FROMANY(pphi, PyArray_DOUBLE, 1,
+  phi = (PyArrayObject *)PyArray_FROMANY(pphi, NPY_DOUBLE, 1,
                                          10, NPY_IN_ARRAY);
   if (!phi)
   {
@@ -121,7 +121,7 @@ static PyObject *distance_method(PyObject *self, PyObject *args)
     return NULL;
   }
 
-  dx = (PyArrayObject *)PyArray_FROMANY(pdx, PyArray_DOUBLE, 1,
+  dx = (PyArrayObject *)PyArray_FROMANY(pdx, NPY_DOUBLE, 1,
                                         1, NPY_IN_ARRAY);
   if (!dx)
   {
@@ -130,7 +130,7 @@ static PyObject *distance_method(PyObject *self, PyObject *args)
     return NULL;
   }
 
-  flag = (PyArrayObject *)PyArray_FROMANY(pflag, PyArray_LONG, 1,
+  flag = (PyArrayObject *)PyArray_FROMANY(pflag, NPY_LONG, 1,
                                           10, NPY_IN_ARRAY);
   if (!flag)
   {
@@ -144,7 +144,7 @@ static PyObject *distance_method(PyObject *self, PyObject *args)
   if (mode == TRAVEL_TIME || mode == EXTENSION_VELOCITY)
   {
     {
-      speed = (PyArrayObject *)PyArray_FROMANY(pspeed, PyArray_DOUBLE, 1,
+      speed = (PyArrayObject *)PyArray_FROMANY(pspeed, NPY_DOUBLE, 1,
                                                10, NPY_IN_ARRAY);
       if (!speed)
       {
@@ -213,16 +213,16 @@ static PyObject *distance_method(PyObject *self, PyObject *args)
 
   // make a new array for the return value
   distance = (PyArrayObject *)PyArray_ZEROS(PyArray_NDIM(phi),
-                                            shape2, PyArray_DOUBLE, 0);
+                                            shape2, NPY_DOUBLE, 0);
   if (! distance) return NULL;
 
   if (mode == EXTENSION_VELOCITY)
   {
     f_ext = (PyArrayObject *)PyArray_ZEROS(PyArray_NDIM(phi),
-                                           shape2, PyArray_DOUBLE, 0);
+                                           shape2, NPY_DOUBLE, 0);
     if (! f_ext) return NULL;
 
-    ext_mask = (PyArrayObject *)PyArray_FROMANY(pext_mask, PyArray_LONG, 1,
+    ext_mask = (PyArrayObject *)PyArray_FROMANY(pext_mask, NPY_LONG, 1,
                                                 10, NPY_IN_ARRAY);
     if (! ext_mask)
       {

from scikit-fmm.

jkfurtney avatar jkfurtney commented on July 18, 2024

OK, this patch also works in the current code with the 1.x versions of numpy. I added you to the contributors.txt, I should have acknowledged you in the commit message, but forgot.

from scikit-fmm.

jkfurtney avatar jkfurtney commented on July 18, 2024

Thanks

from scikit-fmm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.