|
| 1 | +# File for different types of exotic types |
| 2 | +@testsetup module NonlinearSolveExoticTypeTests |
| 3 | +using NonlinearSolve |
| 4 | + |
| 5 | +fn_iip = NonlinearFunction{true}((du, u, p) -> du .= u .* u .- p) |
| 6 | +fn_oop = NonlinearFunction{false}((u, p) -> u .* u .- p) |
| 7 | + |
| 8 | +u0 = BigFloat[1.0, 1.0, 1.0] |
| 9 | +prob_iip_bf = NonlinearProblem{true}(fn_iip, u0, BigFloat(2)) |
| 10 | +prob_oop_bf = NonlinearProblem{false}(fn_oop, u0, BigFloat(2)) |
| 11 | + |
| 12 | +export fn_iip, fn_oop, u0, prob_iip_bf, prob_oop_bf |
| 13 | +end |
| 14 | + |
| 15 | +@testitem "BigFloat Support" tags=[:misc] setup=[NonlinearSolveExoticTypeTests] begin |
| 16 | + using NonlinearSolve, LinearAlgebra |
| 17 | + |
| 18 | + for alg in [NewtonRaphson(), Broyden(), Klement(), DFSane(), TrustRegion()] |
| 19 | + sol = solve(prob_oop_bf, alg) |
| 20 | + @test norm(sol.resid, Inf) < 1e-6 |
| 21 | + @test SciMLBase.successful_retcode(sol.retcode) |
| 22 | + |
| 23 | + sol = solve(prob_iip_bf, alg) |
| 24 | + @test norm(sol.resid, Inf) < 1e-6 |
| 25 | + @test SciMLBase.successful_retcode(sol.retcode) |
| 26 | + end |
| 27 | +end |
0 commit comments