From 76c4e8eb4abc7fd7200ddb5c06789df004d72650 Mon Sep 17 00:00:00 2001 From: xantares Date: Fri, 30 Aug 2013 17:23:29 +0200 Subject: [PATCH] Explicitely specify npy flags. --- swig/nlopt-python.i | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swig/nlopt-python.i b/swig/nlopt-python.i index 200925d..caf4bc3 100644 --- a/swig/nlopt-python.i +++ b/swig/nlopt-python.i @@ -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(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(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) -- 2.30.2