Skip to content

Commit 677ecb7

Browse files
Merge pull request #767 from SciML/myb/mm
Mass matrix handling for SDEs
2 parents ea2cd75 + 6a50544 commit 677ecb7

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/sde_default_alg.jl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,29 @@ function default_algorithm(prob::DiffEqBase.AbstractSDEProblem{uType,tType,isinp
99
alg = RKMilCommute()
1010
end
1111

12-
if :stiff alg_hints
12+
is_stiff = :stiff alg_hints
13+
is_stratonovich = :stratonovich alg_hints
14+
if is_stiff || prob.f.mass_matrix !== I
1315
alg = ImplicitRKMil(autodiff=false)
1416
end
1517

16-
if :stratonovich alg_hints
17-
if :stiff alg_hints
18+
if is_stratonovich
19+
if is_stiff || prob.f.mass_matrix !== I
1820
alg = ImplicitRKMil(autodiff=false,interpretation=:stratonovich)
1921
else
2022
alg = RKMil(interpretation=:stratonovich)
2123
end
2224
end
2325

2426
if prob.noise_rate_prototype != nothing || prob.noise != nothing
25-
if :stratonovich alg_hints
26-
if :stiff alg_hints
27+
if is_stratonovich
28+
if is_stiff || prob.f.mass_matrix !== I
2729
alg = ImplicitEulerHeun(autodiff=false)
2830
else
2931
alg = LambaEulerHeun()
3032
end
3133
else
32-
if :stiff alg_hints
34+
if is_stiff || prob.f.mass_matrix !== I
3335
alg = ISSEM(autodiff=false)
3436
else
3537
alg = LambaEM()
@@ -38,7 +40,7 @@ function default_algorithm(prob::DiffEqBase.AbstractSDEProblem{uType,tType,isinp
3840
end
3941

4042
if :additive alg_hints
41-
if :stiff alg_hints
43+
if is_stiff || prob.f.mass_matrix !== I
4244
alg = SKenCarp(autodiff=false)
4345
else
4446
alg = SOSRA()

0 commit comments

Comments
 (0)