chiark / gitweb /
Explicitely specify npy flags.
authorxantares <xantares09@hotmail.com>
Fri, 30 Aug 2013 15:23:29 +0000 (17:23 +0200)
committerxantares <xantares09@hotmail.com>
Fri, 30 Aug 2013 15:23:29 +0000 (17:23 +0200)
swig/nlopt-python.i

index 200925d7c8ac71e7c1137712323529b8c59e5c4e..caf4bc358750c15ffcfbc02720aea52a3270acd4 100644 (file)
@@ -124,7 +124,7 @@ static double func_python(unsigned n, const double *x, double *grad, void *f)
   npy_intp sz = npy_intp(n), sz0 = 0, stride1 = sizeof(double);
   PyObject *xpy = PyArray_New(&PyArray_Type, 1, &sz, NPY_DOUBLE, &stride1,
                              const_cast<double*>(x), // not NPY_WRITEABLE
-                             0, NPY_ARRAY_IN_ARRAY, NULL);
+                             0, NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_ALIGNED, NULL);
   PyObject *gradpy = grad
     ? PyArray_SimpleNewFromData(1, &sz, NPY_DOUBLE, grad)
     : PyArray_SimpleNew(1, &sz0, NPY_DOUBLE);
@@ -160,7 +160,7 @@ static void mfunc_python(unsigned m, double *result,
   npy_intp sz0 = 0, stride1 = sizeof(double);
   PyObject *xpy = PyArray_New(&PyArray_Type, 1, &nsz, NPY_DOUBLE, &stride1,
                              const_cast<double*>(x), // not NPY_WRITEABLE
-                             0, NPY_ARRAY_IN_ARRAY, NULL);
+                             0, NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_ALIGNED, NULL);
   PyObject *rpy = PyArray_SimpleNewFromData(1, &msz, NPY_DOUBLE, result);
   PyObject *gradpy = grad
     ? PyArray_SimpleNewFromData(2, mnsz, NPY_DOUBLE, grad)