[Scipy-tickets] [SciPy] #1451: Wrapper class 'integrate.complex_ode' does not accept function parameters

SciPy Trac scipy-tickets@scipy....
Mon Mar 19 20:06:21 CDT 2012


#1451: Wrapper class 'integrate.complex_ode' does not accept function parameters
--------------------------------------------+-------------------------------
 Reporter:  gideon                          |       Owner:  somebody
     Type:  defect                          |      Status:  new     
 Priority:  highest                         |   Milestone:          
Component:  scipy.integrate                 |     Version:  0.9.0   
 Keywords:  complex_ode, not subscriptable  |  
--------------------------------------------+-------------------------------

Comment(by borishim):

 After a quick reading of the source code, I think that to fix this, a
 major lifting in the f2py interface is required, and all integrators needs
 to be fixed separately. For example, for the dopri5 integrator, additional
 arguments will not work even for real valued problems. For the workaround,
 functools.partial or lambda can be used in place of the generator,
 although performance hits might be experienced:
 {{{
 import functools
 f_with_args = functools.partial(f, args=1)
 ...
 solver = integrate.complex_ode(f_with_args)
 ...
 }}}

 I actually am starting to think that the entire rewritting of
 set_f_params() method in terms of functools.partial could be a better
 design decision, considering that the target function is a python function
 after all.

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


More information about the Scipy-tickets mailing list