mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-12-22 12:23:54 +01:00
downgrade numpy.i SWIG interface to numpy 1.17.3
This commit is contained in:
parent
1ba0876d81
commit
68284161d3
201
src/numpy.i
201
src/numpy.i
@ -114,12 +114,17 @@
|
||||
if (py_obj == NULL ) return "C NULL value";
|
||||
if (py_obj == Py_None ) return "Python None" ;
|
||||
if (PyCallable_Check(py_obj)) return "callable" ;
|
||||
if (PyBytes_Check( py_obj)) return "string" ;
|
||||
if (PyLong_Check( py_obj)) return "int" ;
|
||||
if (PyString_Check( py_obj)) return "string" ;
|
||||
if (PyInt_Check( py_obj)) return "int" ;
|
||||
if (PyFloat_Check( py_obj)) return "float" ;
|
||||
if (PyDict_Check( py_obj)) return "dict" ;
|
||||
if (PyList_Check( py_obj)) return "list" ;
|
||||
if (PyTuple_Check( py_obj)) return "tuple" ;
|
||||
%#if PY_MAJOR_VERSION < 3
|
||||
if (PyFile_Check( py_obj)) return "file" ;
|
||||
if (PyModule_Check( py_obj)) return "module" ;
|
||||
if (PyInstance_Check(py_obj)) return "instance" ;
|
||||
%#endif
|
||||
|
||||
return "unknown type";
|
||||
}
|
||||
@ -540,7 +545,7 @@
|
||||
const npy_intp *dims = array_dimensions(ary);
|
||||
for (i=0; i < nd; ++i)
|
||||
n_non_one += (dims[i] != 1) ? 1 : 0;
|
||||
if (n_non_one > 1)
|
||||
if (n_non_one > 1)
|
||||
array_clearflags(ary,NPY_ARRAY_CARRAY);
|
||||
array_enableflags(ary,NPY_ARRAY_FARRAY);
|
||||
/* Recompute the strides */
|
||||
@ -2002,7 +2007,7 @@
|
||||
(PyObject* array = NULL)
|
||||
{
|
||||
npy_intp dims[1];
|
||||
if (!PyLong_Check($input))
|
||||
if (!PyInt_Check($input))
|
||||
{
|
||||
const char* typestring = pytype_string($input);
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
@ -2010,8 +2015,7 @@
|
||||
typestring);
|
||||
SWIG_fail;
|
||||
}
|
||||
$2 = (DIM_TYPE) PyLong_AsSsize_t($input);
|
||||
if ($2 == -1 && PyErr_Occurred()) SWIG_fail;
|
||||
$2 = (DIM_TYPE) PyInt_AsLong($input);
|
||||
dims[0] = (npy_intp) $2;
|
||||
array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
|
||||
if (!array) SWIG_fail;
|
||||
@ -2031,7 +2035,7 @@
|
||||
(PyObject* array = NULL)
|
||||
{
|
||||
npy_intp dims[1];
|
||||
if (!PyLong_Check($input))
|
||||
if (!PyInt_Check($input))
|
||||
{
|
||||
const char* typestring = pytype_string($input);
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
@ -2039,8 +2043,7 @@
|
||||
typestring);
|
||||
SWIG_fail;
|
||||
}
|
||||
$1 = (DIM_TYPE) PyLong_AsSsize_t($input);
|
||||
if ($1 == -1 && PyErr_Occurred()) SWIG_fail;
|
||||
$1 = (DIM_TYPE) PyInt_AsLong($input);
|
||||
dims[0] = (npy_intp) $1;
|
||||
array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
|
||||
if (!array) SWIG_fail;
|
||||
@ -2494,9 +2497,9 @@
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$2), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$2), free);
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
@ -2564,9 +2567,9 @@
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$3), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$3), free);
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
@ -2634,9 +2637,9 @@
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$3), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$3), free);
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
@ -2708,9 +2711,9 @@
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$4), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$4), free);
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
@ -2782,9 +2785,9 @@
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$4), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$4), free);
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
@ -2858,9 +2861,161 @@
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$5), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$5), free);
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
%#endif
|
||||
|
||||
$result = SWIG_Python_AppendOutput($result,obj);
|
||||
}
|
||||
|
||||
/* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
|
||||
DIM_TYPE* DIM3, DIM_TYPE* DIM4)
|
||||
*/
|
||||
%typemap(in,numinputs=0)
|
||||
(DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 )
|
||||
(DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
|
||||
{
|
||||
$1 = &data_temp;
|
||||
$2 = &dim1_temp;
|
||||
$3 = &dim2_temp;
|
||||
$4 = &dim3_temp;
|
||||
$5 = &dim4_temp;
|
||||
}
|
||||
%typemap(argout,
|
||||
fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements,NumPy_Utilities")
|
||||
(DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
|
||||
{
|
||||
npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
|
||||
PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
|
||||
PyArrayObject* array = (PyArrayObject*) obj;
|
||||
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
%#endif
|
||||
|
||||
$result = SWIG_Python_AppendOutput($result,obj);
|
||||
}
|
||||
|
||||
/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
|
||||
DATA_TYPE** ARGOUTVIEWM_FARRAY4)
|
||||
*/
|
||||
%typemap(in,numinputs=0)
|
||||
(DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 , DATA_TYPE** ARGOUTVIEWM_FARRAY4)
|
||||
(DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL )
|
||||
{
|
||||
$1 = &dim1_temp;
|
||||
$2 = &dim2_temp;
|
||||
$3 = &dim3_temp;
|
||||
$4 = &dim4_temp;
|
||||
$5 = &data_temp;
|
||||
}
|
||||
%typemap(argout,
|
||||
fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements,NumPy_Utilities")
|
||||
(DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_FARRAY4)
|
||||
{
|
||||
npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
|
||||
PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
|
||||
PyArrayObject* array = (PyArrayObject*) obj;
|
||||
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
%#endif
|
||||
|
||||
$result = SWIG_Python_AppendOutput($result,obj);
|
||||
}
|
||||
|
||||
/* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
|
||||
DIM_TYPE* DIM3, DIM_TYPE* DIM4)
|
||||
*/
|
||||
%typemap(in,numinputs=0)
|
||||
(DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 )
|
||||
(DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
|
||||
{
|
||||
$1 = &data_temp;
|
||||
$2 = &dim1_temp;
|
||||
$3 = &dim2_temp;
|
||||
$4 = &dim3_temp;
|
||||
$5 = &dim4_temp;
|
||||
}
|
||||
%typemap(argout,
|
||||
fragment="NumPy_Backward_Compatibility,NumPy_Utilities")
|
||||
(DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
|
||||
{
|
||||
npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
|
||||
PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
|
||||
PyArrayObject* array = (PyArrayObject*) obj;
|
||||
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
%#endif
|
||||
|
||||
$result = SWIG_Python_AppendOutput($result,obj);
|
||||
}
|
||||
|
||||
/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
|
||||
DATA_TYPE** ARGOUTVIEWM_ARRAY4)
|
||||
*/
|
||||
%typemap(in,numinputs=0)
|
||||
(DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 , DATA_TYPE** ARGOUTVIEWM_ARRAY4)
|
||||
(DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL )
|
||||
{
|
||||
$1 = &dim1_temp;
|
||||
$2 = &dim2_temp;
|
||||
$3 = &dim3_temp;
|
||||
$4 = &dim4_temp;
|
||||
$5 = &data_temp;
|
||||
}
|
||||
%typemap(argout,
|
||||
fragment="NumPy_Backward_Compatibility,NumPy_Utilities")
|
||||
(DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_ARRAY4)
|
||||
{
|
||||
npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
|
||||
PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
|
||||
PyArrayObject* array = (PyArrayObject*) obj;
|
||||
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
@ -2934,9 +3089,9 @@
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$5), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$5), free);
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
|
Loading…
Reference in New Issue
Block a user