[Scipy-svn] r3214 - trunk/Lib/optimize

scipy-svn@scip... scipy-svn@scip...
Wed Aug 1 08:13:32 CDT 2007


Author: dmitrey.kroshko
Date: 2007-08-01 08:13:03 -0500 (Wed, 01 Aug 2007)
New Revision: 3214

Modified:
   trunk/Lib/optimize/optimize.py
Log:
minor changes (atleast_1d in some scipy.optimize funcs have been added for to prevent errors like ticket 416)


Modified: trunk/Lib/optimize/optimize.py
===================================================================
--- trunk/Lib/optimize/optimize.py	2007-08-01 13:09:45 UTC (rev 3213)
+++ trunk/Lib/optimize/optimize.py	2007-08-01 13:13:03 UTC (rev 3214)
@@ -156,7 +156,7 @@
 
       """
     fcalls, func = wrap_function(func, args)
-    x0 = asfarray(x0)
+    x0 = atleast_1d(asfarray(x0))
     N = len(x0)
     rank = len(x0.shape)
     if not -1 < rank < 2:
@@ -523,7 +523,8 @@
 
     Outputs: (alpha, fc, gc)
     """
-
+    
+    xk = atleast_1d(xk)
     fc = 0
     phi0 = old_fval                            # compute f(xk) -- done in past loop
     phi_a0 = f(*((xk+alpha0*pk,)+args))     
@@ -828,7 +829,7 @@
       fixed_point -- scalar fixed-point finder
 
       """
-    x0 = asarray(x0)
+    x0 = atleast_1d(asarray(x0))
     if maxiter is None:
         maxiter = len(x0)*200
     func_calls, f = wrap_function(f, args)
@@ -996,7 +997,7 @@
       fixed_point -- scalar fixed-point finder
 
     """
-    x0 = asarray(x0)
+    x0 = atleast_1d(asarray(x0))
     fcalls, f = wrap_function(f, args)
     gcalls, fprime = wrap_function(fprime, args)
     hcalls = 0
@@ -1661,7 +1662,7 @@
     # we need to use a mutable object here that we can update in the
     # wrapper function
     fcalls, func = wrap_function(func, args)
-    x = asarray(x0)
+    x = atleast_1d(asarray(x0))
     if retall:
         allvecs = [x]
     N = len(x)



More information about the Scipy-svn mailing list