Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimpleHalley type unstable for StaticArray u0. #537

Open
oscardssmith opened this issue Mar 3, 2025 · 0 comments
Open

SimpleHalley type unstable for StaticArray u0. #537

oscardssmith opened this issue Mar 3, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@oscardssmith
Copy link
Contributor

SimpleHalley is type unstable when used with StaticArrays

using SimpleNonlinearSolve, StaticArrays, Test
julia> f_SA(u, p) = SA[u[1] * u[1] - p, u[2] * u[2] - p]
julia> prob = NonlinearProblem(f_SA, SA[1.0, 1.0], 2.0)

julia> @inferred solve(prob, SimpleHalley())
ERROR: return type SciMLBase.NonlinearSolution{Float64, 1, SVector{2, Float64}, SVector{2, Float64}, NonlinearSolveBase.ImmutableNonlinearProblem{SVector{2, Float64}, false, Float64, NonlinearFunction{false, SciMLBase.FullSpecialize, typeof(f_SA), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, @NamedTuple{}}, SciMLBase.StandardNonlinearProblem}, SimpleHalley{AutoForwardDiff{nothing, Nothing}}, Nothing, Nothing, Nothing, Nothing} does not match inferred return type SciMLBase.NonlinearSolution{_A, _B, _C, _D, NonlinearSolveBase.ImmutableNonlinearProblem{SVector{2, Float64}, false, Float64, NonlinearFunction{false, SciMLBase.FullSpecialize, typeof(f_SA), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, @NamedTuple{}}, SciMLBase.StandardNonlinearProblem}, SimpleHalley{AutoForwardDiff{nothing, Nothing}}, Nothing, Nothing, Nothing, Nothing} where {_A, _B, _C, _D}

which is caused by instability in the hessian computation

julia> @inferred SimpleNonlinearSolve.Utils.compute_jacobian_and_hessian(alg.autodiff, prob, prob.f(prob.u0, prob.p), prob.u0)
ERROR: return type Tuple{SVector{2, Float64}, SMatrix{2, 2, Float64, 4}, SMatrix{4, 2, Float64, 8}} does not match inferred return type Tuple{SVector{2, Float64}, SMatrix{2, 2, Float64, 4}, Any}
@oscardssmith oscardssmith added the bug Something isn't working label Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant