Skip to content

Commit 9b4ecb2

Browse files
Merge pull request #2552 from Shreyas-Ekanathan/master
Cache Radau Tableaus
2 parents d01c8c1 + 81f6fc3 commit 9b4ecb2

File tree

5 files changed

+24
-276
lines changed

5 files changed

+24
-276
lines changed

lib/OrdinaryDiffEqFIRK/src/firk_caches.jl

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -518,18 +518,13 @@ function alg_cache(alg::AdaptiveRadau, u, rate_prototype, ::Type{uEltypeNoUnits}
518518
end
519519
num_stages = min_stages
520520

521-
tabs = [RadauIIATableau5(uToltype, constvalue(tTypeNoUnits)), RadauIIATableau9(uToltype, constvalue(tTypeNoUnits)), RadauIIATableau13(uToltype, constvalue(tTypeNoUnits))]
522-
i = max(min_stages, 9)
523-
while i <= max_stages
524-
push!(tabs, RadauIIATableau(uToltype, constvalue(tTypeNoUnits), i))
525-
i += 2
526-
end
521+
tabs = [RadauIIATableau(uToltype, constvalue(tTypeNoUnits), i) for i in min_stages:2:max_stages]
527522
cont = Vector{typeof(u)}(undef, max_stages)
528523
for i in 1:max_stages
529524
cont[i] = zero(u)
530525
end
531526

532-
index = min((min_stages - 1) ÷ 2, 4)
527+
index = 1
533528

534529
κ = alg.κ !== nothing ? convert(uToltype, alg.κ) : convert(uToltype, 1 // 100)
535530
J = false .* _vec(rate_prototype) .* _vec(rate_prototype)'
@@ -602,14 +597,9 @@ function alg_cache(alg::AdaptiveRadau, u, rate_prototype, ::Type{uEltypeNoUnits}
602597
end
603598
num_stages = min_stages
604599

605-
tabs = [RadauIIATableau5(uToltype, constvalue(tTypeNoUnits)), RadauIIATableau9(uToltype, constvalue(tTypeNoUnits)), RadauIIATableau13(uToltype, constvalue(tTypeNoUnits))]
606-
i = max(min_stages, 9)
607-
while i <= max_stages
608-
push!(tabs, RadauIIATableau(uToltype, constvalue(tTypeNoUnits), i))
609-
i += 2
610-
end
600+
tabs = [RadauIIATableau(uToltype, constvalue(tTypeNoUnits), i) for i in min_stages:2:max_stages]
611601

612-
index = min((min_stages - 1) ÷ 2, 4)
602+
index = 1
613603

614604
κ = alg.κ !== nothing ? convert(uToltype, alg.κ) : convert(uToltype, 1 // 100)
615605

0 commit comments

Comments
 (0)