SciML / NonlinearSolve.jl

High-performance and differentiation-enabled nonlinear solvers (Newton methods), bracketed rootfinding (bisection, Falsi), with sparsity and Newton-Krylov support.
https://docs.sciml.ai/NonlinearSolve/stable/
MIT License
229 stars 41 forks source link

Support for complex-values problems #177

Closed lgravina1997 closed 10 months ago

lgravina1997 commented 1 year ago

It seems that the present version does not support complex-valued problem. Let nlprob be a NonlinearProblem with uType Vector{ComplexF64}. Then

solve(nlprob, NewtonRaphson(), abstol = 1e-9)

yields ArgumentError: Cannot create a dual over scalar type ComplexF64. If the type behaves as a scalar, define ForwardDiff.can_dual(::Type{ComplexF64}) = true.

Is there a way around this?

avik-pal commented 10 months ago

The default used to be ForwardDiff.jl but now we can do things smarter and chose the AD or Finite Diff based on the problem type. So this shouldn't be an issue!

avik-pal commented 10 months ago

This can be closed!