[Scipy-tickets] [SciPy] #1770: root() doesn't work well with matrices

SciPy Trac scipy-tickets@scipy....
Thu Nov 8 12:29:48 CST 2012

#1770: root() doesn't work well with matrices
 Reporter:  pv              |       Owner:  somebody   
     Type:  defect          |      Status:  new        
 Priority:  normal          |   Milestone:  Unscheduled
Component:  scipy.optimize  |     Version:  0.11.0     
 Keywords:                  |  
 from scipy.optimize import root
 import numpy as np

 x0 = np.matrix([0, 0])
 print root(lambda z: z - 1, x0)
 The problem is that minpack.py:179 does
     x0 = array(x0, ndmin=1)
     n = len(x0)
     if type(args) != type(()):
         args = (args,)
     _check_func('fsolve', 'func', func, x0, args, n, (n,))
 which will not work for 2-D arrays.

 Obviously, tests are missing... There are possibly similar problems with
 the optimization routines, should be also checked.

Ticket URL: <http://projects.scipy.org/scipy/ticket/1770>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.

More information about the Scipy-tickets mailing list