Skip to content

Commit

Permalink
Add bigfloat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed May 26, 2024
1 parent 3f37005 commit 301f874
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ LinearAlgebra = "1.10"
LinearSolve = "2.30"
MINPACK = "1.2"
MaybeInplace = "0.1.3"
ModelingToolkit = "9.13.0"
ModelingToolkit = "9.15.0"
NLSolvers = "0.5"
NLsolve = "4.5"
NaNMath = "1"
Expand Down
27 changes: 27 additions & 0 deletions test/misc/exotic_type_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# File for different types of exotic types
@testsetup module NonlinearSolveExoticTypeTests
using NonlinearSolve

fn_iip = NonlinearFunction{true}((du, u, p) -> du .= u .* u .- p)
fn_oop = NonlinearFunction{false}((u, p) -> u .* u .- p)

u0 = BigFloat[1.0, 1.0, 1.0]
prob_iip_bf = NonlinearProblem{true}(fn_iip, u0, BigFloat(2))
prob_oop_bf = NonlinearProblem{false}(fn_oop, u0, BigFloat(2))

export fn_iip, fn_oop, u0, prob_iip_bf, prob_oop_bf
end

@testitem "BigFloat Support" tags=[:misc] setup=[NonlinearSolveExoticTypeTests] begin
using NonlinearSolve, LinearAlgebra

for alg in [NewtonRaphson(), Broyden(), Klement(), DFSane(), TrustRegion()]
sol = solve(prob_oop_bf, alg)
@test norm(sol.resid, Inf) < 1e-6
@test SciMLBase.successful_retcode(sol.retcode)

sol = solve(prob_iip_bf, alg)
@test norm(sol.resid, Inf) < 1e-6
@test SciMLBase.successful_retcode(sol.retcode)
end
end

0 comments on commit 301f874

Please sign in to comment.