hrldcpr / hungarian

Hungarian / Munkres' algorithm for the linear assignment problem, in Python
MIT License
71 stars 22 forks source link

ValueError: negative dimensions are not allowed #1

Closed atomos closed 11 years ago

atomos commented 12 years ago

Hi,

This looks like just what I'm looking for! However, it doesn't seem to compile on either mac or ubuntu. I was wonder if you've seen this error before?

ubuntu@cmb-staging:~/hungarian-master$ python setup.py build running build running config_cc unifing config_cc, config, build_clib, build_ext, build commands --compiler options running config_fc unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options running build_src build_src building extension "hungarian" sources build_src: building npy-pkg config files running build_ext customize UnixCCompiler customize UnixCCompiler using build_ext customize UnixCCompiler customize UnixCCompiler using build_ext building 'hungarian' extension compiling C++ sources C compiler: g++ -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC

compile options: '-I/usr/local/lib/python2.7/dist-packages/numpy-1.6.2-py2.7-linux-x8664.egg/numpy/core/include -I/usr/include/python2.7 -c' g++: hungarian.cpp hungarian.cpp: In function ‘PyObject* hungarian(PyObject, PyObject_)’: hungarian.cpp:76:1: error: jump to label ‘error’ [-fpermissive] hungarian.cpp:38:8: error: from here [-fpermissive] hungarian.cpp:45:15: error: crosses initialization of ‘npy_intp* strides’ hungarian.cpp:76:1: error: jump to label ‘error’ [-fpermissive] hungarian.cpp:32:8: error: from here [-fpermissive] hungarian.cpp:45:15: error: crosses initialization of ‘npyintp* strides’ hungarian.cpp: In function ‘PyObject* hungarian(PyObject, PyObject_)’: hungarian.cpp:76:1: error: jump to label ‘error’ [-fpermissive] hungarian.cpp:38:8: error: from here [-fpermissive] hungarian.cpp:45:15: error: crosses initialization of ‘npy_intp* strides’ hungarian.cpp:76:1: error: jump to label ‘error’ [-fpermissive] hungarian.cpp:32:8: error: from here [-fpermissive] hungarian.cpp:45:15: error: crosses initialization of ‘npy_intp* strides’ error: Command "g++ -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/local/lib/python2.7/dist-packages/numpy-1.6.2-py2.7-linux-x86_64.egg/numpy/core/include -I/usr/include/python2.7 -c hungarian.cpp -o build/temp.linux-x86_64-2.7/hungarian.o" failed with exit status 1

Thanks, Adam

atomos commented 12 years ago

I replaced the goto's with the two lines at the 'error' label. It now compiles, but I get a different error, this time in python:

In [3]: a = numpy.array([[1, 2], [3, 4]])

In [4]: print hungarian.lap(a)[0]

ValueError Traceback (most recent call last)

in () ----> 1 print hungarian.lap(a)[0] ValueError: negative dimensions are not allowed
hrldcpr commented 12 years ago

Thanks for the info! I hope to fix this in the next week.

hrldcpr commented 11 years ago

Thanks to @js850's pull request, everything should be fixed now. Please let me know if you still have issues. Thanks!

berhane commented 9 years ago

Hi, I downloaded the most current version (from 01/24/2013) and I'm still getting "ValueError: negative dimensions are not allowed" even for the example provided. Am I missing some update? Thx. SYSTEM: [Linux CentOS 6.4 running Python 2.6.6/2.7.6, Numpy 1.8.0]