[SciPy-User] Broyden with complex numbers [Was Re: ANN: SciPy 0.11.0 beta 1 released]

Pauli Virtanen pav at iki.fi
Tue Jun 26 16:53:13 EDT 2012


26.06.2012 22:04, Skipper Seabold kirjoitti:
> This is using broyden. Maybe it's my numpy?
> '1.8.0.dev-6a06466'
[clip]
> # raises an error
> optimize.broyden1(func, [0, -.203, .203, .5], line_search=None)
> 
> <snip>
> 
> TypeError: Cannot cast ufunc add output from dtype('complex128') to
> dtype('float64') with casting rule 'same_kind'

I get "nonlin.py:314: ComplexWarning: Casting complex values to real
discards the imaginary part" with Numpy 1.6.1.

There's indeed a probable bug on line 314 --- should maybe do
"x = x + d" instead of "x += d".

And yes, I think the inexact Newton should work OK also on the complex
plane. I'm not sure whether all the Jacobian approximations are fully
complex-safe, though.

	Pauli




More information about the SciPy-User mailing list