Skip to content

Commit 5c8eb86

Browse files
committed
core: fix argument according to the Numpy version
1 parent 2dd52b6 commit 5c8eb86

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

include/eigenpy/ufunc.hpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ namespace eigenpy
1212
namespace internal
1313
{
1414

15+
#ifdef NPY_1_19_API_VERSION
16+
#define EIGENPY_NPY_CONST_UFUNC_ARG const
17+
#else
18+
#define EIGENPY_NPY_CONST_UFUNC_ARG
19+
#endif
20+
1521
#define EIGENPY_REGISTER_BINARY_OPERATOR(name,op) \
1622
template<typename T1, typename T2, typename R> \
17-
void binary_op_##name(char** args, const npy_intp * dimensions, const npy_intp * steps, void * /*data*/) \
23+
void binary_op_##name(char** args, EIGENPY_NPY_CONST_UFUNC_ARG npy_intp * dimensions, EIGENPY_NPY_CONST_UFUNC_ARG npy_intp * steps, void * /*data*/) \
1824
{ \
1925
npy_intp is0 = steps[0], is1 = steps[1], \
2026
os = steps[2], n = *dimensions; \
@@ -31,7 +37,7 @@ namespace eigenpy
3137
} \
3238
\
3339
template<typename T> \
34-
void binary_op_##name(char** args, const npy_intp * dimensions, const npy_intp * steps, void * data) \
40+
void binary_op_##name(char** args, EIGENPY_NPY_CONST_UFUNC_ARG npy_intp * dimensions, EIGENPY_NPY_CONST_UFUNC_ARG npy_intp * steps, void * data) \
3541
{ \
3642
binary_op_##name<T,T,T>(args,dimensions,steps,data); \
3743
}
@@ -49,7 +55,7 @@ namespace eigenpy
4955

5056
#define EIGENPY_REGISTER_UNARY_OPERATOR(name,op) \
5157
template<typename T, typename R> \
52-
void unary_op_##name(char** args, const npy_intp * dimensions, const npy_intp * steps, void * /*data*/) \
58+
void unary_op_##name(char** args, EIGENPY_NPY_CONST_UFUNC_ARG npy_intp * dimensions, EIGENPY_NPY_CONST_UFUNC_ARG npy_intp * steps, void * /*data*/) \
5359
{ \
5460
npy_intp is = steps[0], \
5561
os = steps[1], n = *dimensions; \
@@ -65,7 +71,7 @@ namespace eigenpy
6571
} \
6672
\
6773
template<typename T> \
68-
void unary_op_##name(char** args, const npy_intp * dimensions, const npy_intp * steps, void * data) \
74+
void unary_op_##name(char** args, EIGENPY_NPY_CONST_UFUNC_ARG npy_intp * dimensions, EIGENPY_NPY_CONST_UFUNC_ARG npy_intp * steps, void * data) \
6975
{ \
7076
unary_op_##name<T,T>(args,dimensions,steps,data); \
7177
}

0 commit comments

Comments
 (0)