Skip to content

Commit 52c3f77

Browse files
Merge pull request #2381 from SciML/os/complex-eigen_est
fix Complex `eigen est`
2 parents aa436e4 + 8b04477 commit 52c3f77

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ end
762762
g7 = u
763763
# Hairer II, page 22 modified to use the Inf norm
764764
integrator.eigen_est = integrator.opts.internalnorm(
765-
maximum(abs.(k7 .- k6) ./ (g7 .- g6)), t)
765+
maximum(abs.((k7 .- k6) ./ (g7 .- g6))), t)
766766
end
767767
if integrator.opts.adaptive
768768
utilde = dt *

lib/OrdinaryDiffEqTsit5/src/tsit_perform_step.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ end
141141
g7 = u
142142
# Hairer II, page 22 modified to use the Inf norm
143143
integrator.eigen_est = integrator.opts.internalnorm(
144-
maximum(abs.(k7 .- k6) ./ (g7 .- g6)), t)
144+
maximum(abs.((k7 .- k6) ./ (g7 .- g6))), t)
145145
end
146146
if integrator.opts.adaptive
147147
utilde = dt *

test/interface/default_solver_tests.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,11 @@ using StaticArrays
110110
cb = ContinuousCallback((u, t, integrator) -> t - 1, (integrator) -> nothing)
111111
SA_ode_problem = ODEProblem((u, p, t) -> zero(u), SA[0], 2)
112112
@test solve(SA_ode_problem; callback = cb).retcode == ReturnCode.Success
113+
114+
# test Complex numbers
115+
H(s) = (1-s) * complex([0 1; 1 0]) + s * complex([1 0; 0 -1])
116+
schrod_eq(state, time, s) = -im * time * H(s) * state
117+
118+
prob_complex = ODEProblem(schrod_eq, complex([1, -1]/sqrt(2)), (0,1), 100)
119+
complex_sol = solve(prob_complex)
120+
@test complex_sol.retcode == ReturnCode.Success

0 commit comments

Comments
 (0)