[Scipy-svn] r2467 - trunk/Lib/optimize
scipy-svn at scipy.org
scipy-svn at scipy.org
Tue Dec 26 20:16:07 EST 2006
Author: timl
Date: 2006-12-26 19:16:03 -0600 (Tue, 26 Dec 2006)
New Revision: 2467
Modified:
trunk/Lib/optimize/optimize.py
Log:
add an option to specify the initial direction set used in fmin_powell. fixes ticket #284
Modified: trunk/Lib/optimize/optimize.py
===================================================================
--- trunk/Lib/optimize/optimize.py 2006-12-27 01:01:53 UTC (rev 2466)
+++ trunk/Lib/optimize/optimize.py 2006-12-27 01:16:03 UTC (rev 2467)
@@ -1535,7 +1535,8 @@
def fmin_powell(func, x0, args=(), xtol=1e-4, ftol=1e-4, maxiter=None,
- maxfun=None, full_output=0, disp=1, retall=0, callback=None):
+ maxfun=None, full_output=0, disp=1, retall=0, callback=None,
+ direc=None):
"""Minimize a function using modified Powell's method.
Description:
@@ -1551,6 +1552,7 @@
callback -- an optional user-supplied function to call after each
iteration. It is called as callback(xk), where xk is the
current parameter vector.
+ direc -- initial direction set
Outputs: (xopt, {fopt, xi, direc, iter, funcalls, warnflag}, {allvecs})
@@ -1610,7 +1612,12 @@
if maxfun is None:
maxfun = N * 1000
- direc = eye(N,dtype=float)
+
+ if direc is None:
+ direc = eye(N, dtype=float)
+ else:
+ direc = asarray(direc, dtype=float)
+
fval = squeeze(func(x))
x1 = x.copy()
iter = 0;
More information about the Scipy-svn
mailing list