Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 79280f6

Browse files
committed
Type stability fixes
1 parent 39657a4 commit 79280f6

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/nlsolve/raphson.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ function SciMLBase.__solve(prob::Union{NonlinearProblem, NonlinearLeastSquaresPr
4747
end
4848

4949
@bb copyto!(xo, x)
50-
Δx = _restructure(x, dfx \ _vec(fx))
51-
@bb x .-= Δx
50+
δx = _restructure(x, dfx \ _vec(fx))
51+
@bb x .-= δx
5252
end
5353

5454
return build_solution(prob, alg, x, fx; retcode = ReturnCode.MaxIters)

src/utils.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,11 @@ function __init_identity_jacobian!!(J)
161161
end
162162
function __init_identity_jacobian(u::StaticArray, fu)
163163
S1, S2 = length(fu), length(u)
164-
J = SMatrix{S1, S2, eltype(u)}(ntuple(i -> ifelse(i 1:(S1 + 1):(S1 * S2), 1, 0),
165-
S1 * S2))
164+
J = SMatrix{S1, S2, eltype(u)}(I)
166165
return J
167166
end
168167
function __init_identity_jacobian!!(J::StaticArray{S1, S2}) where {S1, S2}
169-
return SMMatrix{S1, S2, eltype(J)}(ntuple(i -> ifelse(i 1:(S1 + 1):(S1 * S2), 1, 0),
170-
S1 * S2))
168+
return SMMatrix{S1, S2, eltype(J)}(I)
171169
end
172170

173171
function __init_low_rank_jacobian(u::StaticArray{S1, T1}, fu::StaticArray{S2, T2},

0 commit comments

Comments
 (0)