From 2d753055ce20b3c3c40a963098a0bbb1b07e0b60 Mon Sep 17 00:00:00 2001 From: Pete Shadbolt Date: Wed, 22 Oct 2014 07:52:34 +1100 Subject: [PATCH] Fixing complex algebra --- src/permanent.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/permanent.c b/src/permanent.c index 35db4dd..e77fc30 100644 --- a/src/permanent.c +++ b/src/permanent.c @@ -3,6 +3,7 @@ #include #include #include +#include // Forward function declaration. static PyObject *permanent(PyObject *self, PyObject *args); @@ -22,6 +23,7 @@ PyMODINIT_FUNC initpermanent(void) { /***************************************************************************** * Array access macros. * *****************************************************************************/ +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #define m(x0) (*(npy_float64*)((PyArray_DATA(py_m) + \ (x0) * PyArray_STRIDES(py_m)[0]))) #define m_shape(i) (py_m->dimensions[(i)]) @@ -44,7 +46,7 @@ PyMODINIT_FUNC initpermanent(void) { static PyObject *permanent(PyObject *self, PyObject *args) { // Declare variables. npy_int64 d, i, j; - Py_complex sum; + double complex sum; PyArrayObject *submatrix; // Parse variables. @@ -55,10 +57,12 @@ static PyObject *permanent(PyObject *self, PyObject *args) { // Compute the permanent for(i = 0; i < d; ++i) { for(j = 0; j