[SciPy-dev] Trouble with fmin_cg
Nils Wagner
nwagner at iam.uni-stuttgart.de
Fri Jan 4 06:16:06 EST 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))
File
"/usr/local/lib64/python2.5/site-packages/scipy/optimize/optimize.py",
line 911, in fmin_cg
callback(xk)
TypeError: 'numpy.float64' object is not callable
Is that a bug ?
Nils
More information about the SciPy-Dev
mailing list