Skip to content

Commit a048ca0

Browse files
fix: fix inplace system taylor
1 parent fea7609 commit a048ca0

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

lib/NonlinearSolveHomotopyContinuation/src/interface_types.jl

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,24 @@ function HC.ModelKit.taylor!(u::AbstractVector, ::Val{N}, sys::HomotopySystemWra
8585
p = parameter_values(sys.prob)
8686
buffer, vars = sys.taylorvars
8787
for i in eachindex(vars)
88-
for j in 0:M
88+
for j in 0:M-1
8989
vars[i][j] = x[i, j + 1]
9090
end
91+
for j in M:4
92+
vars[i][j] = zero(vars[i][j])
93+
end
9194
end
9295
f.f(buffer, vars, p)
93-
for i in eachindex(vars)
94-
u[i] = ntuple(j -> buffer[i][j - 1], Val(N + 1))
96+
if u isa Vector
97+
for i in eachindex(vars)
98+
u[i] = buffer[i][N]
99+
end
100+
else
101+
for i in eachindex(vars)
102+
u[i] = ntuple(j -> buffer[i][j - 1], Val(N + 1))
103+
end
95104
end
105+
return u
96106
end
97107

98108
function HC.ModelKit.taylor!(u::AbstractVector, ::Val{N}, sys::HomotopySystemWrapper{OutOfPlace}, x::HC.ModelKit.TaylorVector{M}, p = nothing) where {N, M}

0 commit comments

Comments
 (0)