[SciPy-dev] f2py and character arrays

Ed Schofield schofield at ftw.at
Thu Nov 10 09:10:40 CST 2005


Ed Schofield wrote:

>On Tue, 8 Nov 2005, Nils Wagner wrote:
>  
>
>>======================================================================
>>ERROR: limited-memory bound-constrained BFGS algorithm
>>----------------------------------------------------------------------
>>Traceback (most recent call last):
>>   File
>>"/usr/local/lib/python2.4/site-packages/scipy/optimize/tests/test_optimize.py",
>>line 114, in check_l_bfgs_b
>>     args=(), maxfun=self.maxiter)
>>   File
>>"/usr/local/lib/python2.4/site-packages/scipy/optimize/lbfgsb.py",
>>line 207, in fmin_l_bfgs_b
>>     return x, f[0], d
>>ValueError: 0-d arrays can't be indexed.
>>    
>>
>Yes, I know this is broken.  I added some new unit tests today, partly to
>highlight this problem. It hasn't ever worked with the new scipy core.
>I'm working on it :)
>  
>

I'd like to call for help here. It would be nice to fix this so these
tests pass before the code freeze / new release today. As Travis
described
(http://www.scipy.net/pipermail/scipy-dev/2005-October/003685.html),
f2py probably needs changing to support the new format for character
arrays (which the lbfgsb.py module uses). I don't understand f2py well
enough to fix it myself.

It seems that lbfgsb.py passes the "task" character array to the Fortran
subroutine "setulb" in the file optimize/lbfgsb-0.9/routines.f without
problem and the Fortran code then manipulates this character array
correctly. The problem is that only the first character of "task" is
modified when control returns to the Python code.

Pearu? :)

-- Ed




More information about the Scipy-dev mailing list