diff --git a/.gitignore b/.gitignore index c548dcc..e91945c 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,9 @@ var/ pip-log.txt pip-delete-this-directory.txt +# VIM swp files +*.swp + # Unit test / coverage reports htmlcov/ .tox/ diff --git a/permanentbis/__init__.py b/permanentbis/__init__.py deleted file mode 100644 index f7354ab..0000000 --- a/permanentbis/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from permanentbis import permanent diff --git a/setup.py b/setup.py index 830f9b4..6fb0966 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( ext_modules=[ Extension( - 'permanentbis.permanent', ['./src/permanent.c'], + 'permanentbis', ['./src/permanent.c'], extra_compile_args=["-Ofast", "-march=native"], include_dirs=[numpy.get_include()]), ], diff --git a/src/npy_util.h b/src/npy_util.h index ecad18c..bbec383 100644 --- a/src/npy_util.h +++ b/src/npy_util.h @@ -50,7 +50,7 @@ void complex_inc(npy_complex128 *a, npy_complex128 b) { ((double *)a)[1] = cimag(tmp); return; #else /* !defined(_MSC_VER) */ - *a *= b; + *a += b; #endif return; } diff --git a/src/permanent.c b/src/permanent.c index e9531a4..f251613 100644 --- a/src/permanent.c +++ b/src/permanent.c @@ -10,7 +10,7 @@ static PyObject *permanent(PyObject *self, PyObject *args); // Method list static PyMethodDef methods[] = { - { "permanentbis", permanent, METH_VARARGS, "Computes the permanent of a numpy using the most appropriate method available"}, + { "permanent", permanent, METH_VARARGS, "Computes the permanent of a numpy using the most appropriate method available"}, { NULL, NULL, 0, NULL } // Sentinel }; @@ -18,17 +18,17 @@ static PyMethodDef methods[] = { #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef cModPyDem = { - PyModuleDef_HEAD_INIT, - "permanentbis", "Computes the permanent of a numpy using the most appropriate method available", - -1, - methods + PyModuleDef_HEAD_INIT, + "permanentbis", "Computes the permanent of a numpy using the most appropriate method available", + -1, + methods }; PyMODINIT_FUNC -PyInit_permanent(void) +PyInit_permanentbis(void) { - import_array(); - return PyModule_Create(&cModPyDem); + import_array(); + return PyModule_Create(&cModPyDem); } #else diff --git a/tests/test_permanent.py b/tests/test_permanent.py index eac0dee..b79bb91 100644 --- a/tests/test_permanent.py +++ b/tests/test_permanent.py @@ -1,11 +1,12 @@ import numpy as np -from permanentbis.permanent import permanent +from permanentbis import permanent import pytest def test_permanent(): """ Test that basic functions work right """ m = np.eye(10, dtype=complex) + print(permanent(m)) assert permanent(m) == 1 m = np.zeros((10, 10), dtype=complex) assert permanent(m) == 0