Skip to content

Commit

Permalink
Support BigFloat
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed May 25, 2024
1 parent e23cca8 commit ffb5d26
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SimpleNonlinearSolve"
uuid = "727e6d20-b764-4bd8-a329-72de5adea6c7"
authors = ["SciML"]
version = "1.8.1"
version = "1.8.2"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down Expand Up @@ -50,7 +50,7 @@ FiniteDiff = "2.22"
ForwardDiff = "0.10.36"
LinearAlgebra = "1.10"
LinearSolve = "2.30"
MaybeInplace = "0.1.1"
MaybeInplace = "0.1.3"
NonlinearProblemLibrary = "0.1.2"
Pkg = "1.10"
PolyesterForwardDiff = "0.1.1"
Expand Down
31 changes: 31 additions & 0 deletions test/core/exotic_type_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# File for different types of exotic types
@testsetup module SimpleNonlinearSolveExoticTypeTests
using SimpleNonlinearSolve

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=[:core] setup=[SimpleNonlinearSolveExoticTypeTests] begin
using SimpleNonlinearSolve, LinearAlgebra

for alg in [SimpleNewtonRaphson(), SimpleBroyden(), SimpleKlement(), SimpleDFSane(),
SimpleTrustRegion(), SimpleLimitedMemoryBroyden(; threshold = 2),
SimpleHalley()]
sol = solve(prob_oop_bf, alg)
@test norm(sol.resid, Inf) < 1e-6
@test SciMLBase.successful_retcode(sol.retcode)

alg isa SimpleHalley && continue

sol = solve(prob_iip_bf, alg)
@test norm(sol.resid, Inf) < 1e-6
@test SciMLBase.successful_retcode(sol.retcode)
end
end
4 changes: 2 additions & 2 deletions test/gpu/cuda_tests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testitem "Solving on GPUs" tags=[:cuda] begin
@testitem "Solving on GPUs" tags=[:cuda] skip=:(using CUDA; !CUDA.functional()) begin
using StaticArrays, CUDA

CUDA.allowscalar(false)
Expand Down Expand Up @@ -36,7 +36,7 @@
end
end

@testitem "CUDA Kernel Launch Test" tags=[:cuda] begin
@testitem "CUDA Kernel Launch Test" tags=[:cuda] skip=:(using CUDA; !CUDA.functional()) begin
using StaticArrays, CUDA

CUDA.allowscalar(false)
Expand Down

0 comments on commit ffb5d26

Please sign in to comment.