Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ DifferentiationInterface = "0.6.43, 0.7"
FiniteDiff = "2.0"
ForwardDiff = "0.10, 1.0"
LinearAlgebra = "<0.0.1, 1"
StaticArrays = "1.9"
julia = "1.10"

[extras]
Expand All @@ -25,7 +26,8 @@ OptimTestProblems = "cec144fc-5a64-5bc6-99fb-dde8f63e154c"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["ADTypes", "ComponentArrays", "OptimTestProblems", "Random", "RecursiveArrayTools", "SparseArrays", "Test"]
test = ["ADTypes", "ComponentArrays", "OptimTestProblems", "Random", "RecursiveArrayTools", "SparseArrays", "StaticArrays", "Test"]
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ using NLSolversBase, Test
using Random
using LinearAlgebra: Diagonal, I, mul!
using ComponentArrays
using StaticArrays
using SparseArrays
using OptimTestProblems
using RecursiveArrayTools
Expand Down Expand Up @@ -87,4 +88,5 @@ end
include("autodiff.jl")
include("sparse.jl")
include("kwargs.jl")
include("utils.jl")
end
26 changes: 26 additions & 0 deletions test/utils.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@testset "utililties" begin
@testset "x_of_nans" begin
for T in (Int, Float32, Float64)
for x in (zeros(T), zeros(T, 2), zeros(T, 3, 2))
x_nans = @inferred(NLSolversBase.x_of_nans(x))
@test x_nans isa Array{float(T),ndims(x)}
@test size(x_nans) == size(x)
@test all(isnan, x_nans)
end

for x in (SArray{Tuple{}}(zeros(T)), SArray{Tuple{2}}(zeros(T, 2)), SArray{Tuple{3,2}}(zeros(T, 3, 2)))
x_nans = @inferred(NLSolversBase.x_of_nans(x))
@test x_nans isa MArray{Tuple{size(x)...},float(T)}
@test size(x_nans) == size(x)
@test all(isnan, x_nans)
end

for x in (MArray{Tuple{}}(zeros(T)), MArray{Tuple{2}}(zeros(T, 2)), MArray{Tuple{3,2}}(zeros(T, 3, 2)))
x_nans = @inferred(NLSolversBase.x_of_nans(x))
@test x_nans isa MArray{Tuple{size(x)...},float(T)}
@test size(x_nans) == size(x)
@test all(isnan, x_nans)
end
end
end
end