[SciPy-dev] Trouble with fmin_cg

Nils Wagner nwagner@iam.uni-stuttgart...
Fri Jan 4 05:16:06 CST 2008

Hi all,

If I run the following script

from scipy import *

def func(x):
     return 0.5*dot(x,dot(A,x))-dot(x,b)

def monitor(x):
     res = linalg.norm(dot(A,x)-b)
     return res

n = 10
x0 = zeros(n,float)
A = random.rand(n,n)+diag(4*ones(n))
A = 0.5*(A+A.T)
b = random.rand(n)

x = optimize.fmin_cg(func,x0,callback=monitor(x0))

I get

Traceback (most recent call last):
   File "test_fmin_cg.py", line 16, in <module>
     x = optimize.fmin_cg(func,x0,callback=monitor(x0))
line 911, in fmin_cg
TypeError: 'numpy.float64' object is not callable

Is that a bug ?


More information about the Scipy-dev mailing list