[Scipy-tickets] [SciPy] #843: fmin_bfgs inconsistent with other optimizers while handling 2+D matrices

SciPy scipy-tickets@scipy....
Sun Jan 11 15:27:20 CST 2009


#843: fmin_bfgs inconsistent with other optimizers while handling 2+D matrices
----------------------------+-----------------------------------------------
 Reporter:  janislaw        |       Owner:  somebody 
     Type:  defect          |      Status:  new      
 Priority:  normal          |   Milestone:           
Component:  scipy.optimize  |     Version:           
 Severity:  normal          |    Keywords:  fmin_bfgs
----------------------------+-----------------------------------------------
 When given an initial guess being a 2D matrix the bfgs solver hangs with
 the following traceback:

 {{{
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/tmp/python-59082uR.py", line 43, in <module>
     test()
   File "/tmp/python-59082uR.py", line 41, in test
     plot=True, RL=1, Jph=0.035*1e4, rho=1e-5)
   File "/tmp/python-59082uR.py", line 31, in calculate_voltages
     result.count()
   File "opt_methods.py", line 79, in count
     **self.optimizer_options)
   File "/usr/lib/python2.5/site-packages/scipy/optimize/optimize.py", line
 771, in fmin_bfgs
     if isinf(rhok): # this is patch for numpy
 ValueError: The truth value of an array with more than one element is
 ambiguous. Use a.any() or a.all()
 }}}

 ... whereas other solvers from this family do not, because all of them
 flatten the matrix into vector. To be consistent I propose flatenning the
 matrix instead of squeezing. I attach the diff against 0.7beta.

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


More information about the Scipy-tickets mailing list