diff --git a/.travis.yml b/.travis.yml index 760a9e7d9f..4ccf51ad13 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ os: - linux # - osx julia: - - 0.6 + - 0.7 - nightly env: - GROUP=Regression @@ -15,7 +15,6 @@ env: matrix: allow_failures: - julia: nightly - fast_finish: true notifications: email: false after_success: diff --git a/REQUIRE b/REQUIRE index 93bc65601d..72dec754e8 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,4 +1,4 @@ -julia 0.6 +julia 0.7- DiffEqBase 3.8.0 DiffEqOperators Parameters 0.5.0 diff --git a/appveyor.yml b/appveyor.yml index 0488b30a72..6f4eed3af5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ environment: matrix: - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe" - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe" + - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-0.7-latest-win32.exe" + - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-0.7-latest-win64.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" matrix: allow_failures: diff --git a/src/OrdinaryDiffEq.jl b/src/OrdinaryDiffEq.jl index dfb56d3490..f51aa640ee 100644 --- a/src/OrdinaryDiffEq.jl +++ b/src/OrdinaryDiffEq.jl @@ -9,8 +9,10 @@ module OrdinaryDiffEq using MuladdMacro + using LinearAlgebra + # Interfaces - import DiffEqBase: solve, solve!, init, step!, build_solution, initialize! + import DiffEqBase: solve!, step!, initialize! # Internal utils import DiffEqBase: ODE_DEFAULT_NORM, ODE_DEFAULT_ISOUTOFDOMAIN, ODE_DEFAULT_PROG_MESSAGE, ODE_DEFAULT_UNSTABLE_CHECK @@ -22,8 +24,6 @@ module OrdinaryDiffEq using Parameters, GenericSVD, ForwardDiff, RecursiveArrayTools, NLsolve, Juno, Roots, DataStructures, DiffEqDiffTools - import Base: linspace - import ForwardDiff.Dual # Required by temporary fix in not in-place methods with 12+ broadcasts @@ -164,7 +164,7 @@ module OrdinaryDiffEq export GenericIIF1, GenericIIF2 - export LawsonEuler, NorsettEuler, ETD1, ETDRK2, ETDRK3, ETDRK4, HochOst4, Exp4, EPIRK4s3A, EPIRK4s3B, + export LawsonEuler, NorsettEuler, ETD1, ETDRK2, ETDRK3, ETDRK4, HochOst4, Exp4, EPIRK4s3A, EPIRK4s3B, EPIRK5s3, EXPRB53s3, EPIRK5P1, EPIRK5P2, ETD2 export SymplecticEuler, VelocityVerlet, VerletLeapfrog, PseudoVerletLeapfrog, diff --git a/src/alg_utils.jl b/src/alg_utils.jl index 2512dca771..070d83cc91 100644 --- a/src/alg_utils.jl +++ b/src/alg_utils.jl @@ -1,7 +1,7 @@ isautodifferentiable(alg::OrdinaryDiffEqAlgorithm) = true isfsal(alg::OrdinaryDiffEqAlgorithm) = true -isfsal{MType,VType,fsal}(tab::ExplicitRKTableau{MType,VType,fsal}) = fsal +isfsal(tab::DiffEqBase.ExplicitRKTableau{MType,VType,fsal}) where {MType,VType,fsal} = fsal # isfsal(alg::CompositeAlgorithm) = isfsal(alg.algs[alg.current]) isfsal(alg::FunctionMap) = false isfsal(alg::Rodas4) = false @@ -51,13 +51,13 @@ qmax_default(alg::CompositeAlgorithm) = minimum(qmax_default.(alg.algs)) qmax_default(alg::DP8) = 6 get_chunksize(alg::OrdinaryDiffEqAlgorithm) = error("This algorithm does not have a chunk size defined.") -get_chunksize{CS,AD}(alg::OrdinaryDiffEqAdaptiveImplicitAlgorithm{CS,AD}) = CS -get_chunksize{CS,AD}(alg::OrdinaryDiffEqImplicitAlgorithm{CS,AD}) = CS +get_chunksize(alg::OrdinaryDiffEqAdaptiveImplicitAlgorithm{CS,AD}) where {CS,AD} = CS +get_chunksize(alg::OrdinaryDiffEqImplicitAlgorithm{CS,AD}) where {CS,AD} = CS # get_chunksize(alg::CompositeAlgorithm) = get_chunksize(alg.algs[alg.current_alg]) alg_autodiff(alg::OrdinaryDiffEqAlgorithm) = error("This algorithm does not have an autodifferentiation option defined.") -alg_autodiff{CS,AD}(alg::OrdinaryDiffEqAdaptiveImplicitAlgorithm{CS,AD}) = AD -alg_autodiff{CS,AD}(alg::OrdinaryDiffEqImplicitAlgorithm{CS,AD}) = AD +alg_autodiff(alg::OrdinaryDiffEqAdaptiveImplicitAlgorithm{CS,AD}) where {CS,AD} = AD +alg_autodiff(alg::OrdinaryDiffEqImplicitAlgorithm{CS,AD}) where {CS,AD} = AD # alg_autodiff(alg::CompositeAlgorithm) = alg_autodiff(alg.algs[alg.current_alg]) get_current_alg_autodiff(alg, cache) = alg_autodiff(alg) get_current_alg_autodiff(alg::CompositeAlgorithm, cache) = alg_autodiff(alg.algs[cache.current]) @@ -294,7 +294,7 @@ qsteady_max_default(alg::AN5) = 3//2 qsteady_max_default(alg::JVODE) = 3//2 qsteady_max_default(alg::QNDF1) = 2//1 -FunctionMap_scale_by_time{scale_by_time}(alg::FunctionMap{scale_by_time}) = scale_by_time +FunctionMap_scale_by_time(alg::FunctionMap{scale_by_time}) where {scale_by_time} = scale_by_time # SSP coefficients """ diff --git a/src/algorithms.jl b/src/algorithms.jl index af24a936ff..bbed581342 100644 --- a/src/algorithms.jl +++ b/src/algorithms.jl @@ -1,4 +1,4 @@ -abstract type OrdinaryDiffEqAlgorithm <: AbstractODEAlgorithm end +abstract type OrdinaryDiffEqAlgorithm <: DiffEqBase.AbstractODEAlgorithm end abstract type OrdinaryDiffEqAdaptiveAlgorithm <: OrdinaryDiffEqAlgorithm end abstract type OrdinaryDiffEqCompositeAlgorithm <: OrdinaryDiffEqAlgorithm end @@ -17,7 +17,7 @@ abstract type OrdinaryDiffEqAdamsVarOrderVarStepAlgorithm <: OrdinaryDiffEqAdapt struct FunctionMap{scale_by_time} <: OrdinaryDiffEqAlgorithm end Base.@pure function Discrete(;apply_map=false,scale_by_time=false) - warn("Discrete is deprecated. Use FunctionMap instead.") + @warn("Discrete is deprecated. Use FunctionMap instead.") FunctionMap{scale_by_time}() end Base.@pure FunctionMap(;scale_by_time=false) = FunctionMap{scale_by_time}() @@ -729,7 +729,7 @@ struct GeneralRosenbrock{CS,AD,F,TabType} <: OrdinaryDiffEqRosenbrockAdaptiveAlg end Base.@pure GeneralRosenbrock(;chunk_size=0,autodiff=true, - factorization=lufact!,tableau=ROSENBROCK_DEFAULT_TABLEAU) = + factorization=lu!,tableau=ROSENBROCK_DEFAULT_TABLEAU) = GeneralRosenbrock{chunk_size,autodiff,typeof(factorization),typeof(tableau)}(tableau,factorization) ###################################### diff --git a/src/bdf_utils.jl b/src/bdf_utils.jl index bfcbe11088..257b79d5f4 100644 --- a/src/bdf_utils.jl +++ b/src/bdf_utils.jl @@ -7,10 +7,10 @@ function U!(k, cache) if typeof(cache) <: OrdinaryDiffEqMutableCache @. U[j,r] = inv(factorial(j)) * prod([m-r for m in 0:(j-1)]) else - U[j,r] = inv(factorial(j)) * prod([m-r for m in 0:(j-1)]) + U[j,r] = inv(factorial(j)) * prod([m-r for m in 0:(j-1)]) end end - end + end end function R!(k, ρ, cache) @@ -39,8 +39,8 @@ end function D2!(u, uprev, k, cache) @unpack D, D2 = cache if typeof(cache) <: OrdinaryDiffEqMutableCache - @. D2[1,1] = (u - uprev) - D[1,1] + @. D2[1,1] = (u - uprev) - D[1,1] else - D2[1,1] = (u - uprev) - D[1,1] + D2[1,1] = (u - uprev) - D[1,1] end end diff --git a/src/caches/adams_bashforth_moulton_caches.jl b/src/caches/adams_bashforth_moulton_caches.jl index c779b8c015..2966240c86 100644 --- a/src/caches/adams_bashforth_moulton_caches.jl +++ b/src/caches/adams_bashforth_moulton_caches.jl @@ -20,11 +20,11 @@ mutable struct AB3ConstantCache{rateType} <: OrdinaryDiffEqConstantCache end function alg_cache(alg::AB3,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - fsalfirst = zeros(rate_prototype) - k2 = zeros(rate_prototype) - k3 = zeros(rate_prototype) - ralk2 = zeros(rate_prototype) - k = zeros(rate_prototype) + fsalfirst = zero(rate_prototype) + k2 = zero(rate_prototype) + k3 = zero(rate_prototype) + ralk2 = zero(rate_prototype) + k = zero(rate_prototype) tmp = similar(u) AB3Cache(u,uprev,fsalfirst,k2,k3,ralk2,k,tmp,1) end @@ -57,11 +57,11 @@ mutable struct ABM32ConstantCache{rateType} <: OrdinaryDiffEqConstantCache end function alg_cache(alg::ABM32,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - fsalfirst = zeros(rate_prototype) - k2 = zeros(rate_prototype) - k3 = zeros(rate_prototype) - ralk2 = zeros(rate_prototype) - k = zeros(rate_prototype) + fsalfirst = zero(rate_prototype) + k2 = zero(rate_prototype) + k3 = zero(rate_prototype) + ralk2 = zero(rate_prototype) + k = zero(rate_prototype) tmp = similar(u) ABM32Cache(u,uprev,fsalfirst,k2,k3,ralk2,k,tmp,1) end @@ -99,16 +99,16 @@ mutable struct AB4ConstantCache{rateType} <: OrdinaryDiffEqConstantCache end function alg_cache(alg::AB4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - fsalfirst = zeros(rate_prototype) - k2 = zeros(rate_prototype) - k3 = zeros(rate_prototype) - k4 = zeros(rate_prototype) - ralk2 = zeros(rate_prototype) - k = zeros(rate_prototype) + fsalfirst = zero(rate_prototype) + k2 = zero(rate_prototype) + k3 = zero(rate_prototype) + k4 = zero(rate_prototype) + ralk2 = zero(rate_prototype) + k = zero(rate_prototype) tmp = similar(u) - t2 = zeros(rate_prototype) - t3 = zeros(rate_prototype) - t4 = zeros(rate_prototype) + t2 = zero(rate_prototype) + t3 = zero(rate_prototype) + t4 = zero(rate_prototype) AB4Cache(u,uprev,fsalfirst,k2,k3,k4,ralk2,k,tmp,t2,t3,t4,1) end @@ -149,19 +149,19 @@ mutable struct ABM43ConstantCache{rateType} <: OrdinaryDiffEqConstantCache end function alg_cache(alg::ABM43,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - fsalfirst = zeros(rate_prototype) - k2 = zeros(rate_prototype) - k3 = zeros(rate_prototype) - k4 = zeros(rate_prototype) - ralk2 = zeros(rate_prototype) - k = zeros(rate_prototype) + fsalfirst = zero(rate_prototype) + k2 = zero(rate_prototype) + k3 = zero(rate_prototype) + k4 = zero(rate_prototype) + ralk2 = zero(rate_prototype) + k = zero(rate_prototype) tmp = similar(u) - t2 = zeros(rate_prototype) - t3 = zeros(rate_prototype) - t4 = zeros(rate_prototype) - t5 = zeros(rate_prototype) - t6 = zeros(rate_prototype) - t7 = zeros(rate_prototype) + t2 = zero(rate_prototype) + t3 = zero(rate_prototype) + t4 = zero(rate_prototype) + t5 = zero(rate_prototype) + t6 = zero(rate_prototype) + t7 = zero(rate_prototype) ABM43Cache(u,uprev,fsalfirst,k2,k3,k4,ralk2,k,tmp,t2,t3,t4,t5,t6,t7,1) end @@ -200,16 +200,16 @@ mutable struct AB5ConstantCache{rateType} <: OrdinaryDiffEqConstantCache end function alg_cache(alg::AB5,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - fsalfirst = zeros(rate_prototype) - k2 = zeros(rate_prototype) - k3 = zeros(rate_prototype) - k4 = zeros(rate_prototype) - k5 = zeros(rate_prototype) - k = zeros(rate_prototype) + fsalfirst = zero(rate_prototype) + k2 = zero(rate_prototype) + k3 = zero(rate_prototype) + k4 = zero(rate_prototype) + k5 = zero(rate_prototype) + k = zero(rate_prototype) tmp = similar(u) - t2 = zeros(rate_prototype) - t3 = zeros(rate_prototype) - t4 = zeros(rate_prototype) + t2 = zero(rate_prototype) + t3 = zero(rate_prototype) + t4 = zero(rate_prototype) AB5Cache(u,uprev,fsalfirst,k2,k3,k4,k5,k,tmp,t2,t3,t4,1) end @@ -253,20 +253,20 @@ mutable struct ABM54ConstantCache{rateType} <: OrdinaryDiffEqConstantCache end function alg_cache(alg::ABM54,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - fsalfirst = zeros(rate_prototype) - k2 = zeros(rate_prototype) - k3 = zeros(rate_prototype) - k4 = zeros(rate_prototype) - k5 = zeros(rate_prototype) - k = zeros(rate_prototype) + fsalfirst = zero(rate_prototype) + k2 = zero(rate_prototype) + k3 = zero(rate_prototype) + k4 = zero(rate_prototype) + k5 = zero(rate_prototype) + k = zero(rate_prototype) tmp = similar(u) - t2 = zeros(rate_prototype) - t3 = zeros(rate_prototype) - t4 = zeros(rate_prototype) - t5 = zeros(rate_prototype) - t6 = zeros(rate_prototype) - t7 = zeros(rate_prototype) - t8 = zeros(rate_prototype) + t2 = zero(rate_prototype) + t3 = zero(rate_prototype) + t4 = zero(rate_prototype) + t5 = zero(rate_prototype) + t6 = zero(rate_prototype) + t7 = zero(rate_prototype) + t8 = zero(rate_prototype) ABM54Cache(u,uprev,fsalfirst,k2,k3,k4,k5,k,tmp,t2,t3,t4,t5,t6,t7,t8,1) end @@ -316,18 +316,18 @@ u_cache(c::VCAB3Cache) = () du_cache(c::VCAB3Cache) = () function alg_cache(alg::VCAB3,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{false}}) - dts = zeros(typeof(dt),3) - c = zeros(typeof(t), 3, 3) - g = zeros(typeof(t), 3) - ϕ_n = Vector{typeof(rate_prototype)}(3) - ϕstar_nm1 = Vector{typeof(rate_prototype)}(3) - ϕstar_n = Vector{typeof(rate_prototype)}(3) + dts = fill(zero(typeof(dt)),3) + c = fill(zero(typeof(t)), 3, 3) + g = fill(zero(typeof(t)), 3) + ϕ_n = Vector{typeof(rate_prototype)}(undef, 3) + ϕstar_nm1 = Vector{typeof(rate_prototype)}(undef, 3) + ϕstar_n = Vector{typeof(rate_prototype)}(undef, 3) for i in 1:3 ϕ_n[i] = copy(rate_prototype) ϕstar_nm1[i] = copy(rate_prototype) ϕstar_n[i] = copy(rate_prototype) end - β = zeros(typeof(t),3) + β = fill(zero(typeof(t)),3) order = 3 tab = BS3ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) VCAB3ConstantCache(dts,c,g,ϕ_n,ϕstar_nm1,ϕstar_n,β,order,tab,1) @@ -335,32 +335,32 @@ end function alg_cache(alg::VCAB3,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tab = BS3ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - bk1 = zeros(rate_prototype) - bk2 = zeros(rate_prototype) - bk3 = zeros(rate_prototype) - bk4 = zeros(rate_prototype) - butilde = similar(u,indices(u)) + bk1 = zero(rate_prototype) + bk2 = zero(rate_prototype) + bk3 = zero(rate_prototype) + bk4 = zero(rate_prototype) + butilde = similar(u,axes(u)) batmp = similar(u,uEltypeNoUnits) btmp = similar(u) bs3cache = BS3Cache(u,uprev,bk1,bk2,bk3,bk4,butilde,btmp,batmp,tab) - fsalfirst = zeros(rate_prototype) - k4 = zeros(rate_prototype) - dts = zeros(typeof(dt),3) - c = zeros(typeof(t),3,3) - g = zeros(typeof(t),3) - ϕ_n = Vector{typeof(rate_prototype)}(3) - ϕstar_nm1 = Vector{typeof(rate_prototype)}(3) - ϕstar_n = Vector{typeof(rate_prototype)}(3) + fsalfirst = zero(rate_prototype) + k4 = zero(rate_prototype) + dts = fill(zero(typeof(dt)),3) + c = fill(zero(typeof(t)), 3, 3) + g = fill(zero(typeof(t)), 3) + ϕ_n = Vector{typeof(rate_prototype)}(undef, 3) + ϕstar_nm1 = Vector{typeof(rate_prototype)}(undef, 3) + ϕstar_n = Vector{typeof(rate_prototype)}(undef, 3) for i in 1:3 - ϕ_n[i] = zeros(rate_prototype) - ϕstar_nm1[i] = zeros(rate_prototype) - ϕstar_n[i] = zeros(rate_prototype) + ϕ_n[i] = zero(rate_prototype) + ϕstar_nm1[i] = zero(rate_prototype) + ϕstar_n[i] = zero(rate_prototype) end - β = zeros(typeof(t),3) + β = fill(zero(typeof(t)),3) order = 3 atmp = similar(u,uEltypeNoUnits) tmp = similar(u) - utilde = similar(u,indices(u)) + utilde = similar(u,axes(u)) VCAB3Cache(u,uprev,fsalfirst,bs3cache,k4,ϕstar_nm1,dts,c,g,ϕ_n,ϕstar_n,β,order,atmp,tmp,utilde,tab,1) end @@ -401,49 +401,49 @@ u_cache(c::VCAB4Cache) = () du_cache(c::VCAB4Cache) = () function alg_cache(alg::VCAB4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{false}}) - dts = zeros(typeof(dt),4) - c = zeros(typeof(t), 4, 4) - g = zeros(typeof(t), 4) - ϕ_n = Vector{typeof(rate_prototype)}(4) - ϕstar_nm1 = Vector{typeof(rate_prototype)}(4) - ϕstar_n = Vector{typeof(rate_prototype)}(4) + dts = fill(zero(typeof(dt)),4) + c = fill(zero(typeof(t)), 4, 4) + g = fill(zero(typeof(t)), 4) + ϕ_n = Vector{typeof(rate_prototype)}(undef, 4) + ϕstar_nm1 = Vector{typeof(rate_prototype)}(undef, 4) + ϕstar_n = Vector{typeof(rate_prototype)}(undef, 4) for i in 1:4 ϕ_n[i] = copy(rate_prototype) ϕstar_nm1[i] = copy(rate_prototype) ϕstar_n[i] = copy(rate_prototype) end - β = zeros(typeof(t),4) + β = fill(zero(typeof(t)),4) order = 4 rk4constcache = RK4ConstantCache() VCAB4ConstantCache(ϕstar_nm1,dts,c,g,ϕ_n,ϕstar_n,β,order,rk4constcache,1) end function alg_cache(alg::VCAB4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - rk1 = zeros(rate_prototype) - rk2 = zeros(rate_prototype) - rk3 = zeros(rate_prototype) - rk4 = zeros(rate_prototype) - rk = zeros(rate_prototype) + rk1 = zero(rate_prototype) + rk2 = zero(rate_prototype) + rk3 = zero(rate_prototype) + rk4 = zero(rate_prototype) + rk = zero(rate_prototype) rtmp = similar(u); ratmp = similar(u, uEltypeNoUnits) rk4cache = RK4Cache(u,uprev,rk1,rk2,rk3,rk4,rk,rtmp,ratmp) - fsalfirst = zeros(rate_prototype) - k4 = zeros(rate_prototype) - dts = zeros(typeof(dt),4) - c = zeros(typeof(t),4,4) - g = zeros(typeof(t),4) - ϕ_n = Vector{typeof(rate_prototype)}(4) - ϕstar_nm1 = Vector{typeof(rate_prototype)}(4) - ϕstar_n = Vector{typeof(rate_prototype)}(4) + fsalfirst = zero(rate_prototype) + k4 = zero(rate_prototype) + dts = fill(zero(typeof(dt)),4) + c = fill(zero(typeof(t)), 4, 4) + g = fill(zero(typeof(t)), 4) + ϕ_n = Vector{typeof(rate_prototype)}(undef, 4) + ϕstar_nm1 = Vector{typeof(rate_prototype)}(undef, 4) + ϕstar_n = Vector{typeof(rate_prototype)}(undef, 4) for i in 1:4 - ϕ_n[i] = zeros(rate_prototype) - ϕstar_nm1[i] = zeros(rate_prototype) - ϕstar_n[i] = zeros(rate_prototype) + ϕ_n[i] = zero(rate_prototype) + ϕstar_nm1[i] = zero(rate_prototype) + ϕstar_n[i] = zero(rate_prototype) end - β = zeros(typeof(t),4) + β = fill(zero(typeof(t)),4) order = 4 atmp = similar(u,uEltypeNoUnits) tmp = similar(u) - utilde = similar(u,indices(u)) + utilde = similar(u,axes(u)) VCAB4Cache(u,uprev,fsalfirst,rk4cache,k4,ϕstar_nm1,dts,c,g,ϕ_n,ϕstar_n,β,order,atmp,tmp,utilde,1) end @@ -486,49 +486,49 @@ u_cache(c::VCAB5Cache) = () du_cache(c::VCAB5Cache) = () function alg_cache(alg::VCAB5,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{false}}) - dts = zeros(typeof(dt),5) - c = zeros(typeof(t), 5, 5) - g = zeros(typeof(t), 5) - ϕ_n = Vector{typeof(rate_prototype)}(5) - ϕstar_nm1 = Vector{typeof(rate_prototype)}(5) - ϕstar_n = Vector{typeof(rate_prototype)}(5) + dts = fill(zero(typeof(dt)),5) + c = fill(zero(typeof(t)), 5, 5) + g = fill(zero(typeof(t)), 5) + ϕ_n = Vector{typeof(rate_prototype)}(undef, 5) + ϕstar_nm1 = Vector{typeof(rate_prototype)}(undef, 5) + ϕstar_n = Vector{typeof(rate_prototype)}(undef, 5) for i in 1:5 ϕ_n[i] = copy(rate_prototype) ϕstar_nm1[i] = copy(rate_prototype) ϕstar_n[i] = copy(rate_prototype) end - β = zeros(typeof(t),5) + β = fill(zero(typeof(t)),5) order = 5 rk4constcache = RK4ConstantCache() VCAB5ConstantCache(ϕstar_nm1,dts,c,g,ϕ_n,ϕstar_n,β,order,rk4constcache,1) end function alg_cache(alg::VCAB5,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - rk1 = zeros(rate_prototype) - rk2 = zeros(rate_prototype) - rk3 = zeros(rate_prototype) - rk4 = zeros(rate_prototype) - rk = zeros(rate_prototype) + rk1 = zero(rate_prototype) + rk2 = zero(rate_prototype) + rk3 = zero(rate_prototype) + rk4 = zero(rate_prototype) + rk = zero(rate_prototype) rtmp = similar(u); ratmp = similar(u, uEltypeNoUnits) rk4cache = RK4Cache(u,uprev,rk1,rk2,rk3,rk4,rk,rtmp,ratmp) - fsalfirst = zeros(rate_prototype) - k4 = zeros(rate_prototype) - dts = zeros(typeof(dt),5) - c = zeros(typeof(t),5,5) - g = zeros(typeof(t),5) - ϕ_n = Vector{typeof(rate_prototype)}(5) - ϕstar_nm1 = Vector{typeof(rate_prototype)}(5) - ϕstar_n = Vector{typeof(rate_prototype)}(5) + fsalfirst = zero(rate_prototype) + k4 = zero(rate_prototype) + dts = fill(zero(typeof(dt)),5) + c = fill(zero(typeof(t)), 5, 5) + g = fill(zero(typeof(t)), 5) + ϕ_n = Vector{typeof(rate_prototype)}(undef, 5) + ϕstar_nm1 = Vector{typeof(rate_prototype)}(undef, 5) + ϕstar_n = Vector{typeof(rate_prototype)}(undef, 5) for i in 1:5 - ϕ_n[i] = zeros(rate_prototype) - ϕstar_nm1[i] = zeros(rate_prototype) - ϕstar_n[i] = zeros(rate_prototype) + ϕ_n[i] = zero(rate_prototype) + ϕstar_nm1[i] = zero(rate_prototype) + ϕstar_n[i] = zero(rate_prototype) end - β = zeros(typeof(t),5) + β = fill(zero(typeof(t)),5) order = 5 atmp = similar(u,uEltypeNoUnits) tmp = similar(u) - utilde = similar(u,indices(u)) + utilde = similar(u,axes(u)) VCAB5Cache(u,uprev,fsalfirst,rk4cache,k4,ϕstar_nm1,dts,c,g,ϕ_n,ϕstar_n,β,order,atmp,tmp,utilde,1) end @@ -574,19 +574,19 @@ u_cache(c::VCABM3Cache) = () du_cache(c::VCABM3Cache) = () function alg_cache(alg::VCABM3,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{false}}) - dts = zeros(typeof(dt),3) - c = zeros(typeof(t), 4, 4) - g = zeros(typeof(t), 4) - ϕ_n = Vector{typeof(rate_prototype)}(3) - ϕstar_nm1 = Vector{typeof(rate_prototype)}(3) - ϕstar_n = Vector{typeof(rate_prototype)}(3) - ϕ_np1 = Vector{typeof(rate_prototype)}(4) + dts = fill(zero(typeof(dt)),3) + c = fill(zero(typeof(t)), 4, 4) + g = fill(zero(typeof(t)), 4) + ϕ_n = Vector{typeof(rate_prototype)}(undef, 3) + ϕstar_nm1 = Vector{typeof(rate_prototype)}(undef, 3) + ϕstar_n = Vector{typeof(rate_prototype)}(undef, 3) + ϕ_np1 = Vector{typeof(rate_prototype)}(undef, 4) for i in 1:3 ϕ_n[i] = copy(rate_prototype) ϕstar_nm1[i] = copy(rate_prototype) ϕstar_n[i] = copy(rate_prototype) end - β = zeros(typeof(t),3) + β = fill(zero(typeof(t)),3) order = 3 tab = BS3ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) VCABM3ConstantCache(dts,c,g,ϕ_n,ϕ_np1,ϕstar_nm1,ϕstar_n,β,order,tab,1) @@ -594,36 +594,36 @@ end function alg_cache(alg::VCABM3,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tab = BS3ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - bk1 = zeros(rate_prototype) - bk2 = zeros(rate_prototype) - bk3 = zeros(rate_prototype) - bk4 = zeros(rate_prototype) - butilde = similar(u,indices(u)) + bk1 = zero(rate_prototype) + bk2 = zero(rate_prototype) + bk3 = zero(rate_prototype) + bk4 = zero(rate_prototype) + butilde = similar(u,axes(u)) batmp = similar(u,uEltypeNoUnits) btmp = similar(u) bs3cache = BS3Cache(u,uprev,bk1,bk2,bk3,bk4,butilde,btmp,batmp,tab) - fsalfirst = zeros(rate_prototype) - k4 = zeros(rate_prototype) - dts = zeros(typeof(dt),3) - c = zeros(typeof(t),4,4) - g = zeros(typeof(t),4) - ϕ_n = Vector{typeof(rate_prototype)}(3) - ϕstar_nm1 = Vector{typeof(rate_prototype)}(3) - ϕstar_n = Vector{typeof(rate_prototype)}(3) - ϕ_np1 = Vector{typeof(rate_prototype)}(4) + fsalfirst = zero(rate_prototype) + k4 = zero(rate_prototype) + dts = fill(zero(typeof(dt)),3) + c = fill(zero(typeof(t)), 4, 4) + g = fill(zero(typeof(t)), 4) + ϕ_n = Vector{typeof(rate_prototype)}(undef, 3) + ϕstar_nm1 = Vector{typeof(rate_prototype)}(undef, 3) + ϕstar_n = Vector{typeof(rate_prototype)}(undef, 3) + ϕ_np1 = Vector{typeof(rate_prototype)}(undef, 4) for i in 1:3 - ϕ_n[i] = zeros(rate_prototype) - ϕstar_nm1[i] = zeros(rate_prototype) - ϕstar_n[i] = zeros(rate_prototype) + ϕ_n[i] = zero(rate_prototype) + ϕstar_nm1[i] = zero(rate_prototype) + ϕstar_n[i] = zero(rate_prototype) end for i in 1:4 - ϕ_np1[i] = zeros(rate_prototype) + ϕ_np1[i] = zero(rate_prototype) end - β = zeros(typeof(t),3) + β = fill(zero(typeof(t)),3) order = 3 atmp = similar(u,uEltypeNoUnits) tmp = similar(u) - utilde = similar(u,indices(u)) + utilde = similar(u,axes(u)) VCABM3Cache(u,uprev,fsalfirst,bs3cache,k4,ϕstar_nm1,dts,c,g,ϕ_n,ϕ_np1,ϕstar_n,β,order,atmp,tmp,utilde,tab,1) end @@ -668,54 +668,54 @@ u_cache(c::VCABM4Cache) = () du_cache(c::VCABM4Cache) = () function alg_cache(alg::VCABM4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{false}}) - dts = zeros(typeof(dt),4) - c = zeros(typeof(t), 5, 5) - g = zeros(typeof(t), 5) - ϕ_n = Vector{typeof(rate_prototype)}(4) - ϕstar_nm1 = Vector{typeof(rate_prototype)}(4) - ϕstar_n = Vector{typeof(rate_prototype)}(4) - ϕ_np1 = Vector{typeof(rate_prototype)}(5) + dts = fill(zero(typeof(dt)),4) + c = fill(zero(typeof(t)), 5, 5) + g = fill(zero(typeof(t)), 5) + ϕ_n = Vector{typeof(rate_prototype)}(undef, 4) + ϕstar_nm1 = Vector{typeof(rate_prototype)}(undef, 4) + ϕstar_n = Vector{typeof(rate_prototype)}(undef, 4) + ϕ_np1 = Vector{typeof(rate_prototype)}(undef, 5) for i in 1:4 ϕ_n[i] = copy(rate_prototype) ϕstar_nm1[i] = copy(rate_prototype) ϕstar_n[i] = copy(rate_prototype) end - β = zeros(typeof(t),4) + β = fill(zero(typeof(t)),4) order = 4 rk4constcache = RK4ConstantCache() VCABM4ConstantCache(ϕstar_nm1,dts,c,g,ϕ_n,ϕ_np1,ϕstar_n,β,order,rk4constcache,1) end function alg_cache(alg::VCABM4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - rk1 = zeros(rate_prototype) - rk2 = zeros(rate_prototype) - rk3 = zeros(rate_prototype) - rk4 = zeros(rate_prototype) - rk = zeros(rate_prototype) + rk1 = zero(rate_prototype) + rk2 = zero(rate_prototype) + rk3 = zero(rate_prototype) + rk4 = zero(rate_prototype) + rk = zero(rate_prototype) rtmp = similar(u); ratmp = similar(u, uEltypeNoUnits) rk4cache = RK4Cache(u,uprev,rk1,rk2,rk3,rk4,rk,rtmp,ratmp) - fsalfirst = zeros(rate_prototype) - k4 = zeros(rate_prototype) - dts = zeros(typeof(dt),4) - c = zeros(typeof(t),5,5) - g = zeros(typeof(t),5) - ϕ_n = Vector{typeof(rate_prototype)}(4) - ϕstar_nm1 = Vector{typeof(rate_prototype)}(4) - ϕstar_n = Vector{typeof(rate_prototype)}(4) - ϕ_np1 = Vector{typeof(rate_prototype)}(5) + fsalfirst = zero(rate_prototype) + k4 = zero(rate_prototype) + dts = fill(zero(typeof(dt)),4) + c = fill(zero(typeof(t)), 5, 5) + g = fill(zero(typeof(t)), 5) + ϕ_n = Vector{typeof(rate_prototype)}(undef, 4) + ϕstar_nm1 = Vector{typeof(rate_prototype)}(undef, 4) + ϕstar_n = Vector{typeof(rate_prototype)}(undef, 4) + ϕ_np1 = Vector{typeof(rate_prototype)}(undef, 5) for i in 1:4 - ϕ_n[i] = zeros(rate_prototype) - ϕstar_nm1[i] = zeros(rate_prototype) - ϕstar_n[i] = zeros(rate_prototype) + ϕ_n[i] = zero(rate_prototype) + ϕstar_nm1[i] = zero(rate_prototype) + ϕstar_n[i] = zero(rate_prototype) end for i in 1:5 - ϕ_np1[i] = zeros(rate_prototype) + ϕ_np1[i] = zero(rate_prototype) end - β = zeros(typeof(t),4) + β = fill(zero(typeof(t)),4) order = 4 atmp = similar(u,uEltypeNoUnits) tmp = similar(u) - utilde = similar(u,indices(u)) + utilde = similar(u,axes(u)) VCABM4Cache(u,uprev,fsalfirst,rk4cache,k4,ϕstar_nm1,dts,c,g,ϕ_n,ϕ_np1,ϕstar_n,β,order,atmp,tmp,utilde,1) end @@ -760,54 +760,54 @@ u_cache(c::VCABM5Cache) = () du_cache(c::VCABM5Cache) = () function alg_cache(alg::VCABM5,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{false}}) - dts = zeros(typeof(dt),5) - c = zeros(typeof(t), 6, 6) - g = zeros(typeof(t), 6) - ϕ_n = Vector{typeof(rate_prototype)}(5) - ϕstar_nm1 = Vector{typeof(rate_prototype)}(5) - ϕstar_n = Vector{typeof(rate_prototype)}(5) - ϕ_np1 = Vector{typeof(rate_prototype)}(6) + dts = fill(zero(typeof(dt)),5) + c = fill(zero(typeof(t)), 6, 6) + g = fill(zero(typeof(t)), 6) + ϕ_n = Vector{typeof(rate_prototype)}(undef, 5) + ϕstar_nm1 = Vector{typeof(rate_prototype)}(undef, 5) + ϕstar_n = Vector{typeof(rate_prototype)}(undef, 5) + ϕ_np1 = Vector{typeof(rate_prototype)}(undef, 6) for i in 1:5 ϕ_n[i] = copy(rate_prototype) ϕstar_nm1[i] = copy(rate_prototype) ϕstar_n[i] = copy(rate_prototype) end - β = zeros(typeof(t),5) + β = fill(zero(typeof(t)),5) order = 5 rk4constcache = RK4ConstantCache() VCABM5ConstantCache(ϕstar_nm1,dts,c,g,ϕ_n,ϕ_np1,ϕstar_n,β,order,rk4constcache,1) end function alg_cache(alg::VCABM5,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - rk1 = zeros(rate_prototype) - rk2 = zeros(rate_prototype) - rk3 = zeros(rate_prototype) - rk4 = zeros(rate_prototype) - rk = zeros(rate_prototype) + rk1 = zero(rate_prototype) + rk2 = zero(rate_prototype) + rk3 = zero(rate_prototype) + rk4 = zero(rate_prototype) + rk = zero(rate_prototype) rtmp = similar(u); ratmp = similar(u, uEltypeNoUnits) rk4cache = RK4Cache(u,uprev,rk1,rk2,rk3,rk4,rk,rtmp,ratmp) - fsalfirst = zeros(rate_prototype) - k4 = zeros(rate_prototype) - dts = zeros(typeof(dt),5) - c = zeros(typeof(t),6,6) - g = zeros(typeof(t),6) - ϕ_n = Vector{typeof(rate_prototype)}(5) - ϕstar_nm1 = Vector{typeof(rate_prototype)}(5) - ϕstar_n = Vector{typeof(rate_prototype)}(5) - ϕ_np1 = Vector{typeof(rate_prototype)}(6) + fsalfirst = zero(rate_prototype) + k4 = zero(rate_prototype) + dts = fill(zero(typeof(dt)),5) + c = fill(zero(typeof(t)), 6, 6) + g = fill(zero(typeof(t)), 6) + ϕ_n = Vector{typeof(rate_prototype)}(undef, 5) + ϕstar_nm1 = Vector{typeof(rate_prototype)}(undef, 5) + ϕstar_n = Vector{typeof(rate_prototype)}(undef, 5) + ϕ_np1 = Vector{typeof(rate_prototype)}(undef, 6) for i in 1:5 - ϕ_n[i] = zeros(rate_prototype) - ϕstar_nm1[i] = zeros(rate_prototype) - ϕstar_n[i] = zeros(rate_prototype) + ϕ_n[i] = zero(rate_prototype) + ϕstar_nm1[i] = zero(rate_prototype) + ϕstar_n[i] = zero(rate_prototype) end for i in 1:6 - ϕ_np1[i] = zeros(rate_prototype) + ϕ_np1[i] = zero(rate_prototype) end - β = zeros(typeof(t),5) + β = fill(zero(typeof(t)),5) order = 5 atmp = similar(u,uEltypeNoUnits) tmp = similar(u) - utilde = similar(u,indices(u)) + utilde = similar(u,axes(u)) VCABM5Cache(u,uprev,fsalfirst,rk4cache,k4,ϕstar_nm1,dts,c,g,ϕ_n,ϕ_np1,ϕstar_n,β,order,atmp,tmp,utilde,1) end @@ -862,19 +862,19 @@ u_cache(c::VCABMCache) = () du_cache(c::VCABMCache) = () function alg_cache(alg::VCABM,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{false}}) - dts = zeros(typeof(dt), 13) - c = zeros(typeof(t), 13, 13) - g = zeros(typeof(t), 13) - ϕ_n = Vector{typeof(rate_prototype)}(13) - ϕstar_nm1 = Vector{typeof(rate_prototype)}(13) - ϕstar_n = Vector{typeof(rate_prototype)}(13) - ϕ_np1 = Vector{typeof(rate_prototype)}(14) + dts = fill(zero(typeof(dt)),13) + c = fill(zero(typeof(t)), 13, 13) + g = fill(zero(typeof(t)), 13) + ϕ_n = Vector{typeof(rate_prototype)}(undef, 13) + ϕstar_nm1 = Vector{typeof(rate_prototype)}(undef, 13) + ϕstar_n = Vector{typeof(rate_prototype)}(undef, 13) + ϕ_np1 = Vector{typeof(rate_prototype)}(undef, 14) for i in 1:13 ϕ_n[i] = copy(rate_prototype) ϕstar_nm1[i] = copy(rate_prototype) ϕstar_n[i] = copy(rate_prototype) end - β = zeros(typeof(t), 13) + β = fill(zero(typeof(t)),13) ξ = zero(dt) ξ0 = zero(dt) order = 1 @@ -883,34 +883,34 @@ function alg_cache(alg::VCABM,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUni end function alg_cache(alg::VCABM,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - fsalfirst = zeros(rate_prototype) - k4 = zeros(rate_prototype) - dts = zeros(typeof(dt), 13) - c = zeros(typeof(t), 13, 13) - g = zeros(typeof(t), 13) - ϕ_n = Vector{typeof(rate_prototype)}(13) - ϕstar_nm1 = Vector{typeof(rate_prototype)}(13) - ϕstar_n = Vector{typeof(rate_prototype)}(13) - ϕ_np1 = Vector{typeof(rate_prototype)}(14) + fsalfirst = zero(rate_prototype) + k4 = zero(rate_prototype) + dts = fill(zero(typeof(dt)),13) + c = fill(zero(typeof(t)), 13, 13) + g = fill(zero(typeof(t)), 13) + ϕ_n = Vector{typeof(rate_prototype)}(undef, 13) + ϕstar_nm1 = Vector{typeof(rate_prototype)}(undef, 13) + ϕstar_n = Vector{typeof(rate_prototype)}(undef, 13) + ϕ_np1 = Vector{typeof(rate_prototype)}(undef, 14) for i in 1:13 - ϕ_n[i] = zeros(rate_prototype) - ϕstar_nm1[i] = zeros(rate_prototype) - ϕstar_n[i] = zeros(rate_prototype) + ϕ_n[i] = zero(rate_prototype) + ϕstar_nm1[i] = zero(rate_prototype) + ϕstar_n[i] = zero(rate_prototype) end for i in 1:14 - ϕ_np1[i] = zeros(rate_prototype) + ϕ_np1[i] = zero(rate_prototype) end - β = zeros(typeof(t), 13) + β = fill(zero(typeof(t)), 13) order = 1 max_order = 12 atmp = similar(u,uEltypeNoUnits) tmp = similar(u) ξ = zero(dt) ξ0 = zero(dt) - utilde = similar(u,indices(u)) - utildem2 = similar(u,indices(u)) - utildem1 = similar(u,indices(u)) - utildep1 = similar(u,indices(u)) + utilde = similar(u,axes(u)) + utildem2 = similar(u,axes(u)) + utildem1 = similar(u,axes(u)) + utildep1 = similar(u,axes(u)) atmp = similar(u,uEltypeNoUnits) atmpm1 = similar(u,uEltypeNoUnits) atmpm2 = similar(u,uEltypeNoUnits) @@ -987,18 +987,18 @@ function alg_cache(alg::CNAB2,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUni end function alg_cache(alg::CNAB2,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J) - z = similar(u,indices(u)) - dz = similar(u,indices(u)) - tmp = similar(u); b = similar(u,indices(u)); - atmp = similar(u,uEltypeNoUnits,indices(u)) - fsalfirst = zeros(rate_prototype) - k = zeros(rate_prototype) - k1 = zeros(rate_prototype) - k2 = zeros(rate_prototype) - du1 = zeros(rate_prototype) - du₁ = zeros(rate_prototype) + z = similar(u,axes(u)) + dz = similar(u,axes(u)) + tmp = similar(u); b = similar(u,axes(u)); + atmp = similar(u,uEltypeNoUnits,axes(u)) + fsalfirst = zero(rate_prototype) + k = zero(rate_prototype) + k1 = zero(rate_prototype) + k2 = zero(rate_prototype) + du1 = zero(rate_prototype) + du₁ = zero(rate_prototype) if typeof(f) <: SplitFunction uf = DiffEqDiffTools.UJacobianWrapper(f.f1,t,p) @@ -1098,18 +1098,18 @@ function alg_cache(alg::CNLF2,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUni end function alg_cache(alg::CNLF2,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J) - z = similar(u,indices(u)) - dz = similar(u,indices(u)) - tmp = similar(u); b = similar(u,indices(u)); - atmp = similar(u,uEltypeNoUnits,indices(u)) - fsalfirst = zeros(rate_prototype) - k = zeros(rate_prototype) - k1 = zeros(rate_prototype) - k2 = zeros(rate_prototype) - du₁ = zeros(rate_prototype) - du1 = zeros(rate_prototype) + z = similar(u,axes(u)) + dz = similar(u,axes(u)) + tmp = similar(u); b = similar(u,axes(u)); + atmp = similar(u,uEltypeNoUnits,axes(u)) + fsalfirst = zero(rate_prototype) + k = zero(rate_prototype) + k1 = zero(rate_prototype) + k2 = zero(rate_prototype) + du₁ = zero(rate_prototype) + du1 = zero(rate_prototype) if typeof(f) <: SplitFunction uf = DiffEqDiffTools.UJacobianWrapper(f.f1,t,p) diff --git a/src/caches/basic_caches.jl b/src/caches/basic_caches.jl index 6804007105..18d3524e75 100644 --- a/src/caches/basic_caches.jl +++ b/src/caches/basic_caches.jl @@ -1,4 +1,4 @@ -abstract type OrdinaryDiffEqCache <: DECache end +abstract type OrdinaryDiffEqCache <: DiffEqBase.DECache end abstract type OrdinaryDiffEqConstantCache <: OrdinaryDiffEqCache end abstract type OrdinaryDiffEqMutableCache <: OrdinaryDiffEqCache end struct ODEEmptyCache <: OrdinaryDiffEqConstantCache end @@ -10,12 +10,12 @@ mutable struct CompositeCache{T,F} <: OrdinaryDiffEqCache current::Int end -function alg_cache{T}(alg::CompositeAlgorithm,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{T}}) +function alg_cache(alg::CompositeAlgorithm,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{T}}) where T caches = map((x)->alg_cache(x,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,Val{T}),alg.algs) CompositeCache(caches,alg.choice_function,1) end -alg_cache{F}(alg::OrdinaryDiffEqAlgorithm,prob,callback::F) = ODEEmptyCache() +alg_cache(alg::OrdinaryDiffEqAlgorithm,prob,callback::F) where {F} = ODEEmptyCache() struct FunctionMapCache{uType,rateType} <: OrdinaryDiffEqMutableCache u::uType @@ -47,22 +47,22 @@ struct ExplicitRKCache{uType,rateType,uEltypeNoUnits,ksEltype,TabType} <: Ordina end u_cache(c::ExplicitRKCache) = (c.utilde,c.atmp,c.update) -du_cache(c::ExplicitRKCache) = (c.kk...) +du_cache(c::ExplicitRKCache) = (c.kk...,) function alg_cache(alg::ExplicitRK,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - kk = Vector{typeof(rate_prototype)}(0) + kk = Vector{typeof(rate_prototype)}(undef, 0) for i = 1:alg.tableau.stages - push!(kk,zeros(rate_prototype)) + push!(kk,zero(rate_prototype)) end fsalfirst = kk[1] if isfsal(alg.tableau) fsallast = kk[end] else - fsallast = zeros(rate_prototype) + fsallast = zero(rate_prototype) end - utilde = zeros(rate_prototype) + utilde = zero(rate_prototype) tmp = similar(u) - atmp = similar(u,uEltypeNoUnits,indices(u)) + atmp = similar(u,uEltypeNoUnits,axes(u)) tab = ExplicitRKConstantCache(alg.tableau,rate_prototype) ExplicitRKCache(u,uprev,tmp,utilde,atmp,fsalfirst,fsallast,kk,tab) end @@ -85,5 +85,5 @@ end alg_cache(alg::ExplicitRK,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{false}}) = ExplicitRKConstantCache(alg.tableau,rate_prototype) -get_chunksize(cache::DECache) = error("This cache does not have a chunksize.") -get_chunksize{CS}(cache::ODEChunkCache{CS}) = CS +get_chunksize(cache::DiffEqBase.DECache) = error("This cache does not have a chunksize.") +get_chunksize(cache::ODEChunkCache{CS}) where {CS} = CS diff --git a/src/caches/bdf_caches.jl b/src/caches/bdf_caches.jl index 637ef1c88d..d875aef18b 100644 --- a/src/caches/bdf_caches.jl +++ b/src/caches/bdf_caches.jl @@ -66,17 +66,17 @@ du_cache(c::ABDF2Cache) = (c.k,c.fsalfirst) function alg_cache(alg::ABDF2,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du1 = zeros(rate_prototype) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du1 = zero(rate_prototype) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J) - zprev = similar(u,indices(u)) - zₙ₋₁ = similar(u,indices(u)); z = similar(u,indices(u)) - dz = similar(u,indices(u)) - fsalfirst = zeros(rate_prototype) - fsalfirstprev = zeros(rate_prototype) - k = zeros(rate_prototype) - tmp = similar(u); b = similar(u,indices(u)) - atmp = similar(u,uEltypeNoUnits,indices(u)) + zprev = similar(u,axes(u)) + zₙ₋₁ = similar(u,axes(u)); z = similar(u,axes(u)) + dz = similar(u,axes(u)) + fsalfirst = zero(rate_prototype) + fsalfirstprev = zero(rate_prototype) + k = zero(rate_prototype) + tmp = similar(u); b = similar(u,axes(u)) + atmp = similar(u,uEltypeNoUnits,axes(u)) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) linsolve = alg.linsolve(Val{:init},uf,u) @@ -167,11 +167,11 @@ function alg_cache(alg::QNDF1,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUni tprev2 = t dtₙ₋₁ = t - D = zeros(typeof(t), 1, 1) - temp_D = zeros(typeof(t), 1, 1) - D2 = zeros(typeof(t), 1, 1) - R = zeros(typeof(t), 1, 1) - U = zeros(typeof(t), 1, 1) + D = fill(zero(typeof(t)), 1, 1) + temp_D = fill(zero(typeof(t)), 1, 1) + D2 = fill(zero(typeof(t)), 1, 1) + R = fill(zero(typeof(t)), 1, 1) + U = fill(zero(typeof(t)), 1, 1) if alg.κ != nothing κ = uToltype(alg.κ) @@ -190,21 +190,21 @@ function alg_cache(alg::QNDF1,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUni end function alg_cache(alg::QNDF1,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du1 = zeros(rate_prototype) - J = zeros(uEltypeNoUnits,length(u),length(u)) + du1 = zero(rate_prototype) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) W = similar(J) zprev = similar(u,indices(u)) zₙ₋₁ = similar(u,indices(u)); z = similar(u,indices(u)) dz = similar(u,indices(u)) - fsalfirst = zeros(rate_prototype) - fsalfirstprev = zeros(rate_prototype) - k = zeros(rate_prototype) - - D = Vector{typeof(u)}(1) - R = Vector{typeof(u)}(1) - U = Vector{typeof(u)}(1) - D2 = Vector{typeof(u)}(1) - temp_D = Vector{typeof(u)}(1) + fsalfirst = zero(rate_prototype) + fsalfirstprev = zero(rate_prototype) + k = zero(rate_prototype) + + D = Vector{typeof(u)}(undef, 1) + R = Vector{typeof(u)}(undef, 1) + U = Vector{typeof(u)}(undef, 1) + D2 = Vector{typeof(u)}(undef, 1) + temp_D = Vector{typeof(u)}(undef, 1) D[1,1] = similar(u) R[1,1] = similar(u) diff --git a/src/caches/euler_imex_caches.jl b/src/caches/euler_imex_caches.jl index 667f0ab38a..57ce0b09c4 100644 --- a/src/caches/euler_imex_caches.jl +++ b/src/caches/euler_imex_caches.jl @@ -55,14 +55,14 @@ function alg_cache(alg::IMEXEuler,u,rate_prototype,uEltypeNoUnits,uBottomEltypeN end function alg_cache(alg::IMEXEuler,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - J = zeros(uEltypeNoUnits,length(u),length(u)) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) W = similar(J) z = similar(u,indices(u)) dz = similar(u,indices(u)); tmp = similar(u,indices(u)); b = similar(u,indices(u)) - fsalfirst = zeros(rate_prototype) - k = zeros(rate_prototype) - du₁ = zeros(rate_prototype) - du1 = zeros(rate_prototype) + fsalfirst = zero(rate_prototype) + k = zero(rate_prototype) + du₁ = zero(rate_prototype) + du1 = zero(rate_prototype) atmp = similar(u,uEltypeNoUnits,indices(u)) uf = DiffEqDiffTools.UJacobianWrapper(f.f1,t,p) diff --git a/src/caches/feagin_caches.jl b/src/caches/feagin_caches.jl index 985dbe071d..432842bbf1 100644 --- a/src/caches/feagin_caches.jl +++ b/src/caches/feagin_caches.jl @@ -29,11 +29,11 @@ du_cache(c::Feagin10Cache) = (c.fsalfirst,c.k2,c.k3,c.k4,c.k5,c.k6,c.k7,c.k8,c.k function alg_cache(alg::Feagin10,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tab = Feagin10ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype); k2 = zeros(rate_prototype); k3 = zeros(rate_prototype); k4 = zeros(rate_prototype); k5 = zeros(rate_prototype) - k6 = zeros(rate_prototype); k7 = zeros(rate_prototype); k8 = zeros(rate_prototype); k9 = zeros(rate_prototype); k10 = zeros(rate_prototype) - k11 = zeros(rate_prototype); k12 = zeros(rate_prototype); k13 = zeros(rate_prototype); k14 = zeros(rate_prototype) - k15 = zeros(rate_prototype); k16 = zeros(rate_prototype); k17 = zeros(rate_prototype) - tmp = similar(u); atmp = similar(u,uEltypeNoUnits,indices(u)); k = zeros(rate_prototype) + k1 = zero(rate_prototype); k2 = zero(rate_prototype); k3 = zero(rate_prototype); k4 = zero(rate_prototype); k5 = zero(rate_prototype) + k6 = zero(rate_prototype); k7 = zero(rate_prototype); k8 = zero(rate_prototype); k9 = zero(rate_prototype); k10 = zero(rate_prototype) + k11 = zero(rate_prototype); k12 = zero(rate_prototype); k13 = zero(rate_prototype); k14 = zero(rate_prototype) + k15 = zero(rate_prototype); k16 = zero(rate_prototype); k17 = zero(rate_prototype) + tmp = similar(u); atmp = similar(u,uEltypeNoUnits,axes(u)); k = zero(rate_prototype) Feagin10Cache(u,uprev,k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,k11,k12,k13,k14,k15,k16,k17,tmp,atmp,k,tab) end @@ -79,13 +79,13 @@ du_cache(c::Feagin12Cache) = (c.fsalfirst,c.k2,c.k3,c.k4,c.k5,c.k6,c.k7,c.k8,c.k function alg_cache(alg::Feagin12,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tab = Feagin12ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype); k2 = zeros(rate_prototype); k3 = zeros(rate_prototype); k4 = zeros(rate_prototype); k5 = zeros(rate_prototype) - k6 = zeros(rate_prototype); k7 = zeros(rate_prototype); k8 = zeros(rate_prototype); k9 = zeros(rate_prototype); k10 = zeros(rate_prototype) - k11 = zeros(rate_prototype); k12 = zeros(rate_prototype); k13 = zeros(rate_prototype); k14 = zeros(rate_prototype) - k15 = zeros(rate_prototype); k16 = zeros(rate_prototype); k17 = zeros(rate_prototype); k18 = zeros(rate_prototype) - k19 = zeros(rate_prototype); k20 = zeros(rate_prototype); k21 = zeros(rate_prototype); k22 = zeros(rate_prototype) - k23 = zeros(rate_prototype); k24 = zeros(rate_prototype); k25 = zeros(rate_prototype) - tmp = similar(u); atmp = similar(u,uEltypeNoUnits,indices(u)); k = zeros(rate_prototype) + k1 = zero(rate_prototype); k2 = zero(rate_prototype); k3 = zero(rate_prototype); k4 = zero(rate_prototype); k5 = zero(rate_prototype) + k6 = zero(rate_prototype); k7 = zero(rate_prototype); k8 = zero(rate_prototype); k9 = zero(rate_prototype); k10 = zero(rate_prototype) + k11 = zero(rate_prototype); k12 = zero(rate_prototype); k13 = zero(rate_prototype); k14 = zero(rate_prototype) + k15 = zero(rate_prototype); k16 = zero(rate_prototype); k17 = zero(rate_prototype); k18 = zero(rate_prototype) + k19 = zero(rate_prototype); k20 = zero(rate_prototype); k21 = zero(rate_prototype); k22 = zero(rate_prototype) + k23 = zero(rate_prototype); k24 = zero(rate_prototype); k25 = zero(rate_prototype) + tmp = similar(u); atmp = similar(u,uEltypeNoUnits,axes(u)); k = zero(rate_prototype) Feagin12Cache(u,uprev,k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,k11,k12,k13,k14,k15,k16,k17,k18,k19,k20,k21,k22,k23,k24,k25,tmp,atmp,k,tab) end @@ -143,16 +143,16 @@ du_cache(c::Feagin14Cache) = (c.fsalfirst,c.k2,c.k3,c.k4,c.k5,c.k6,c.k7,c.k8,c.k function alg_cache(alg::Feagin14,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tab = Feagin14ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype); k2 = zeros(rate_prototype); k3 = zeros(rate_prototype); k4 = zeros(rate_prototype); k5 = zeros(rate_prototype) - k6 = zeros(rate_prototype); k7 = zeros(rate_prototype); k8 = zeros(rate_prototype); k9 = zeros(rate_prototype); k10 = zeros(rate_prototype) - k11 = zeros(rate_prototype); k12 = zeros(rate_prototype); k13 = zeros(rate_prototype); k14 = zeros(rate_prototype) - k15 = zeros(rate_prototype); k16 = zeros(rate_prototype); k17 = zeros(rate_prototype); k18 = zeros(rate_prototype) - k19 = zeros(rate_prototype); k20 = zeros(rate_prototype); k21 = zeros(rate_prototype); k22 = zeros(rate_prototype) - k23 = zeros(rate_prototype); k24 = zeros(rate_prototype); k25 = zeros(rate_prototype) - k26 = zeros(rate_prototype); k27 = zeros(rate_prototype); k28 = zeros(rate_prototype) - k29 = zeros(rate_prototype); k30 = zeros(rate_prototype); k31 = zeros(rate_prototype); k32 = zeros(rate_prototype) - k33 = zeros(rate_prototype); k34 = zeros(rate_prototype); k35 = zeros(rate_prototype) - tmp = similar(u); atmp = similar(u,uEltypeNoUnits,indices(u)); k = zeros(rate_prototype) + k1 = zero(rate_prototype); k2 = zero(rate_prototype); k3 = zero(rate_prototype); k4 = zero(rate_prototype); k5 = zero(rate_prototype) + k6 = zero(rate_prototype); k7 = zero(rate_prototype); k8 = zero(rate_prototype); k9 = zero(rate_prototype); k10 = zero(rate_prototype) + k11 = zero(rate_prototype); k12 = zero(rate_prototype); k13 = zero(rate_prototype); k14 = zero(rate_prototype) + k15 = zero(rate_prototype); k16 = zero(rate_prototype); k17 = zero(rate_prototype); k18 = zero(rate_prototype) + k19 = zero(rate_prototype); k20 = zero(rate_prototype); k21 = zero(rate_prototype); k22 = zero(rate_prototype) + k23 = zero(rate_prototype); k24 = zero(rate_prototype); k25 = zero(rate_prototype) + k26 = zero(rate_prototype); k27 = zero(rate_prototype); k28 = zero(rate_prototype) + k29 = zero(rate_prototype); k30 = zero(rate_prototype); k31 = zero(rate_prototype); k32 = zero(rate_prototype) + k33 = zero(rate_prototype); k34 = zero(rate_prototype); k35 = zero(rate_prototype) + tmp = similar(u); atmp = similar(u,uEltypeNoUnits,axes(u)); k = zero(rate_prototype) Feagin14Cache(u,uprev,k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,k11,k12,k13,k14,k15,k16, k17,k18,k19,k20,k21,k22,k23,k24,k25,k26,k27,k28,k29,k30, diff --git a/src/caches/generic_implicit_caches.jl b/src/caches/generic_implicit_caches.jl index b66fe2cc4e..79667b537e 100644 --- a/src/caches/generic_implicit_caches.jl +++ b/src/caches/generic_implicit_caches.jl @@ -16,11 +16,11 @@ du_cache(c::GenericImplicitEulerCache) = (c.k,c.fsalfirst) dual_cache(c::GenericImplicitEulerCache) = (c.dual_cache,) function alg_cache(alg::GenericImplicitEuler,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - tmp = similar(u); atmp = similar(u,uEltypeNoUnits,indices(u)) - k = zeros(rate_prototype) + tmp = similar(u); atmp = similar(u,uEltypeNoUnits,axes(u)) + k = zero(rate_prototype) dual_cache = DiffCache(u,Val{determine_chunksize(u,get_chunksize(alg.nlsolve))}) rhs = ImplicitRHS(f,tmp,t,t,t,dual_cache,p) - fsalfirst = zeros(rate_prototype) + fsalfirst = zero(rate_prototype) nl_rhs = alg.nlsolve(Val{:init},rhs,u) GenericImplicitEulerCache{typeof(u),typeof(dual_cache), @@ -36,7 +36,7 @@ end function alg_cache(alg::GenericImplicitEuler,u,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uBottomEltypeNoUnits, uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{false}}) - uhold = Vector{typeof(u)}(1) + uhold = Vector{typeof(u)}(undef, 1) rhs = ImplicitRHS_Scalar(f,zero(u),t,t,t,p) nl_rhs = alg.nlsolve(Val{:init},rhs,uhold) GenericImplicitEulerConstantCache{typeof(uhold),typeof(rhs),typeof(nl_rhs)}(uhold,rhs,nl_rhs) @@ -62,9 +62,9 @@ du_cache(c::GenericTrapezoidCache) = (c.k,c.fsalfirst) dual_cache(c::GenericTrapezoidCache) = (c.dual_cache,) function alg_cache(alg::GenericTrapezoid,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - tmp = similar(u); atmp = similar(u,uEltypeNoUnits,indices(u)) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + tmp = similar(u); atmp = similar(u,uEltypeNoUnits,axes(u)) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) dual_cache = DiffCache(u,Val{determine_chunksize(u,get_chunksize(alg.nlsolve))}) rhs = ImplicitRHS(f,tmp,t,t,t,dual_cache,p) nl_rhs = alg.nlsolve(Val{:init},rhs,u) @@ -86,7 +86,7 @@ mutable struct GenericTrapezoidConstantCache{vecuType,rhsType,nl_rhsType,uType,t end function alg_cache(alg::GenericTrapezoid,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{false}}) - uhold = Vector{typeof(u)}(1) + uhold = Vector{typeof(u)}(undef, 1) rhs = ImplicitRHS_Scalar(f,zero(u),t,t,t,p) nl_rhs = alg.nlsolve(Val{:init},rhs,uhold) uprev3 = u @@ -94,5 +94,5 @@ function alg_cache(alg::GenericTrapezoid,u,rate_prototype,uEltypeNoUnits,uBottom GenericTrapezoidConstantCache(uhold,rhs,nl_rhs,uprev3,tprev2) end -get_chunksize{uType,DiffCacheType,rateType,CS}(cache::GenericImplicitEulerCache{uType,DiffCacheType,rateType,CS}) = CS -get_chunksize{uType,DiffCacheType,rateType,CS}(cache::GenericTrapezoidCache{uType,DiffCacheType,rateType,CS}) = CS +get_chunksize(cache::GenericImplicitEulerCache{uType,DiffCacheType,rateType,CS}) where {uType,DiffCacheType,rateType,CS} = CS +get_chunksize(cache::GenericTrapezoidCache{uType,DiffCacheType,rateType,CS}) where {uType,DiffCacheType,rateType,CS} = CS diff --git a/src/caches/high_order_rk_caches.jl b/src/caches/high_order_rk_caches.jl index 3939833888..cf8e231529 100644 --- a/src/caches/high_order_rk_caches.jl +++ b/src/caches/high_order_rk_caches.jl @@ -24,10 +24,10 @@ du_cache(c::TanYam7Cache) = (c.fsalfirst,c.k2,c.k3,c.k4,c.k5,c.k6,c.k7,c.k8,c.k9 function alg_cache(alg::TanYam7,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tab = TanYam7ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype); k2 = zeros(rate_prototype) ; k3 = zeros(rate_prototype); k4 = zeros(rate_prototype) - k5 = zeros(rate_prototype); k6 = zeros(rate_prototype) ; k7 = zeros(rate_prototype); k8 = zeros(rate_prototype) - k9 = zeros(rate_prototype); k10= zeros(rate_prototype) ; - utilde = similar(u,indices(u)); tmp = similar(u); atmp = similar(u,uEltypeNoUnits,indices(u)); k = zeros(rate_prototype) + k1 = zero(rate_prototype); k2 = zero(rate_prototype) ; k3 = zero(rate_prototype); k4 = zero(rate_prototype) + k5 = zero(rate_prototype); k6 = zero(rate_prototype) ; k7 = zero(rate_prototype); k8 = zero(rate_prototype) + k9 = zero(rate_prototype); k10= zero(rate_prototype) ; + utilde = similar(u,axes(u)); tmp = similar(u); atmp = similar(u,uEltypeNoUnits,axes(u)); k = zero(rate_prototype) TanYam7Cache(u,uprev,k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,utilde,tmp,atmp,k,tab) end @@ -70,24 +70,24 @@ u_cache(c::DP8Cache) = (c.utilde,c.atmp) du_cache(c::DP8Cache) = (c.k1,c.k2,c.k3,c.k4,c.k5,c.k6,c.k7,c.k8,c.k9,c.k10,c.k11,c.k12,c.k13,c.k14,c.k15,c.k16,c.kupdate,c.udiff,c.bspl,c.dense_tmp3,c.dense_tmp4,c.dense_tmp5,c.dense_tmp6,c.dense_tmp7) function alg_cache(alg::DP8,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - k1 = zeros(rate_prototype); k2 = zeros(rate_prototype); k3 = zeros(rate_prototype); k4 = zeros(rate_prototype) - k5 = zeros(rate_prototype); k6 = zeros(rate_prototype); k7 = zeros(rate_prototype); k8 = zeros(rate_prototype) - k9 = zeros(rate_prototype); k10 = zeros(rate_prototype); k11 = zeros(rate_prototype); k12 = zeros(rate_prototype) - kupdate = zeros(rate_prototype); utilde = similar(u,indices(u)); - tmp = similar(u); atmp = similar(u,uEltypeNoUnits,indices(u)) - k13 = zeros(rate_prototype) - k14 = zeros(rate_prototype) - k15 = zeros(rate_prototype) - k16 = zeros(rate_prototype) - udiff = zeros(rate_prototype) - bspl = zeros(rate_prototype) + k1 = zero(rate_prototype); k2 = zero(rate_prototype); k3 = zero(rate_prototype); k4 = zero(rate_prototype) + k5 = zero(rate_prototype); k6 = zero(rate_prototype); k7 = zero(rate_prototype); k8 = zero(rate_prototype) + k9 = zero(rate_prototype); k10 = zero(rate_prototype); k11 = zero(rate_prototype); k12 = zero(rate_prototype) + kupdate = zero(rate_prototype); utilde = similar(u,axes(u)); + tmp = similar(u); atmp = similar(u,uEltypeNoUnits,axes(u)) + k13 = zero(rate_prototype) + k14 = zero(rate_prototype) + k15 = zero(rate_prototype) + k16 = zero(rate_prototype) + udiff = zero(rate_prototype) + bspl = zero(rate_prototype) # dense_tmp1 = udiff # dense_tmp2 = bspl - dense_tmp3 = zeros(rate_prototype) - dense_tmp4 = zeros(rate_prototype) - dense_tmp5 = zeros(rate_prototype) - dense_tmp6 = zeros(rate_prototype) - dense_tmp7 = zeros(rate_prototype) + dense_tmp3 = zero(rate_prototype) + dense_tmp4 = zero(rate_prototype) + dense_tmp5 = zero(rate_prototype) + dense_tmp6 = zero(rate_prototype) + dense_tmp7 = zero(rate_prototype) tab = DP8ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) DP8Cache(u,uprev,k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,k11,k12,k13,k14,k15,k16,kupdate, udiff,bspl,dense_tmp3,dense_tmp4,dense_tmp5,dense_tmp6,dense_tmp7, @@ -124,11 +124,11 @@ du_cache(c::TsitPap8Cache) = (c.fsalfirst,c.k2,c.k3,c.k4,c.k5,c.k6,c.k7,c.k8,c.k function alg_cache(alg::TsitPap8,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tab = TsitPap8ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype); k2 = zeros(rate_prototype); k3 = zeros(rate_prototype); k4 = zeros(rate_prototype) - k5 = zeros(rate_prototype); k6 = zeros(rate_prototype); k7 = zeros(rate_prototype); k8 = zeros(rate_prototype) - k9 = zeros(rate_prototype); k10 = zeros(rate_prototype); k11 = zeros(rate_prototype); k12 = zeros(rate_prototype) - k13 = zeros(rate_prototype); utilde = similar(u,indices(u)); k = zeros(rate_prototype) - tmp = similar(u); atmp = similar(u,uEltypeNoUnits,indices(u)); + k1 = zero(rate_prototype); k2 = zero(rate_prototype); k3 = zero(rate_prototype); k4 = zero(rate_prototype) + k5 = zero(rate_prototype); k6 = zero(rate_prototype); k7 = zero(rate_prototype); k8 = zero(rate_prototype) + k9 = zero(rate_prototype); k10 = zero(rate_prototype); k11 = zero(rate_prototype); k12 = zero(rate_prototype) + k13 = zero(rate_prototype); utilde = similar(u,axes(u)); k = zero(rate_prototype) + tmp = similar(u); atmp = similar(u,uEltypeNoUnits,axes(u)); TsitPap8Cache(u,uprev,k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,k11,k12,k13,utilde,tmp,atmp,k,tab) end diff --git a/src/caches/kencarp_kvaerno_caches.jl b/src/caches/kencarp_kvaerno_caches.jl index 5632468cc6..f8a395f2cc 100644 --- a/src/caches/kencarp_kvaerno_caches.jl +++ b/src/caches/kencarp_kvaerno_caches.jl @@ -69,20 +69,20 @@ du_cache(c::KenCarp3Cache) = (c.k,c.fsalfirst) function alg_cache(alg::KenCarp3,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du1 = zeros(rate_prototype) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du1 = zero(rate_prototype) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J) - z₁ = similar(u,indices(u)); z₂ = similar(u,indices(u)) - z₃ = similar(u,indices(u)); z₄ = similar(u,indices(u)) - dz = similar(u,indices(u)) - fsalfirst = zeros(rate_prototype) - k = zeros(rate_prototype) - tmp = similar(u); b = similar(u,indices(u)); - atmp = similar(u,uEltypeNoUnits,indices(u)) + z₁ = similar(u,axes(u)); z₂ = similar(u,axes(u)) + z₃ = similar(u,axes(u)); z₄ = similar(u,axes(u)) + dz = similar(u,axes(u)) + fsalfirst = zero(rate_prototype) + k = zero(rate_prototype) + tmp = similar(u); b = similar(u,axes(u)); + atmp = similar(u,uEltypeNoUnits,axes(u)) if typeof(f) <: SplitFunction - k1 = similar(u,indices(u)); k2 = similar(u,indices(u)) - k3 = similar(u,indices(u)); k4 = similar(u,indices(u)) + k1 = similar(u,axes(u)); k2 = similar(u,axes(u)) + k3 = similar(u,axes(u)); k4 = similar(u,axes(u)) uf = DiffEqDiffTools.UJacobianWrapper(f.f1,t,p) else k1 = nothing; k2 = nothing @@ -180,17 +180,17 @@ du_cache(c::Kvaerno4Cache) = (c.k,c.fsalfirst) function alg_cache(alg::Kvaerno4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du1 = zeros(rate_prototype) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du1 = zero(rate_prototype) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J) - z₁ = similar(u,indices(u)); z₂ = similar(u,indices(u)); - z₃ = similar(u,indices(u)); z₄ = similar(u,indices(u)) - z₅ = similar(u,indices(u)) - dz = similar(u,indices(u)) - fsalfirst = zeros(rate_prototype) - k = zeros(rate_prototype) - tmp = similar(u); b = similar(u,indices(u)); - atmp = similar(u,uEltypeNoUnits,indices(u)) + z₁ = similar(u,axes(u)); z₂ = similar(u,axes(u)); + z₃ = similar(u,axes(u)); z₄ = similar(u,axes(u)) + z₅ = similar(u,axes(u)) + dz = similar(u,axes(u)) + fsalfirst = zero(rate_prototype) + k = zero(rate_prototype) + tmp = similar(u); b = similar(u,axes(u)); + atmp = similar(u,uEltypeNoUnits,axes(u)) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) linsolve = alg.linsolve(Val{:init},uf,u) @@ -295,22 +295,22 @@ du_cache(c::KenCarp4Cache) = (c.k,c.fsalfirst) function alg_cache(alg::KenCarp4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du1 = zeros(rate_prototype) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du1 = zero(rate_prototype) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J) - z₁ = similar(u,indices(u)); z₂ = similar(u,indices(u)) - z₃ = similar(u,indices(u)); z₄ = similar(u,indices(u)) - z₅ = similar(u,indices(u)); z₆ = similar(u,indices(u)) - dz = similar(u,indices(u)) - fsalfirst = zeros(rate_prototype) - k = zeros(rate_prototype) - tmp = similar(u); b = similar(u,indices(u)); - atmp = similar(u,uEltypeNoUnits,indices(u)) + z₁ = similar(u,axes(u)); z₂ = similar(u,axes(u)) + z₃ = similar(u,axes(u)); z₄ = similar(u,axes(u)) + z₅ = similar(u,axes(u)); z₆ = similar(u,axes(u)) + dz = similar(u,axes(u)) + fsalfirst = zero(rate_prototype) + k = zero(rate_prototype) + tmp = similar(u); b = similar(u,axes(u)); + atmp = similar(u,uEltypeNoUnits,axes(u)) if typeof(f) <: SplitFunction - k1 = similar(u,indices(u)); k2 = similar(u,indices(u)) - k3 = similar(u,indices(u)); k4 = similar(u,indices(u)) - k5 = similar(u,indices(u)); k6 = similar(u,indices(u)) + k1 = similar(u,axes(u)); k2 = similar(u,axes(u)) + k3 = similar(u,axes(u)); k4 = similar(u,axes(u)) + k5 = similar(u,axes(u)); k6 = similar(u,axes(u)) uf = DiffEqDiffTools.UJacobianWrapper(f.f1,t,p) else k1 = nothing; k2 = nothing @@ -410,18 +410,18 @@ du_cache(c::Kvaerno5Cache) = (c.k,c.fsalfirst) function alg_cache(alg::Kvaerno5,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du1 = zeros(rate_prototype) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du1 = zero(rate_prototype) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J) - z₁ = similar(u,indices(u)); z₂ = similar(u,indices(u)); - z₃ = similar(u,indices(u)); z₄ = similar(u,indices(u)) - z₅ = similar(u,indices(u)); z₆ = similar(u,indices(u)); - z₇ = similar(u,indices(u)) - dz = similar(u,indices(u)) - fsalfirst = zeros(rate_prototype) - k = zeros(rate_prototype) - tmp = similar(u); b = similar(u,indices(u)); - atmp = similar(u,uEltypeNoUnits,indices(u)) + z₁ = similar(u,axes(u)); z₂ = similar(u,axes(u)); + z₃ = similar(u,axes(u)); z₄ = similar(u,axes(u)) + z₅ = similar(u,axes(u)); z₆ = similar(u,axes(u)); + z₇ = similar(u,axes(u)) + dz = similar(u,axes(u)) + fsalfirst = zero(rate_prototype) + k = zero(rate_prototype) + tmp = similar(u); b = similar(u,axes(u)); + atmp = similar(u,uEltypeNoUnits,axes(u)) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) linsolve = alg.linsolve(Val{:init},uf,u) @@ -528,24 +528,24 @@ du_cache(c::KenCarp5Cache) = (c.k,c.fsalfirst) function alg_cache(alg::KenCarp5,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du1 = zeros(rate_prototype) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du1 = zero(rate_prototype) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J) - z₁ = similar(u,indices(u)); z₂ = similar(u,indices(u)); - z₃ = similar(u,indices(u)); z₄ = similar(u,indices(u)) - z₅ = similar(u,indices(u)); z₆ = similar(u,indices(u)); - z₇ = similar(u,indices(u)); z₈ = similar(u,indices(u)) - dz = similar(u,indices(u)) - fsalfirst = zeros(rate_prototype) - k = zeros(rate_prototype) - tmp = similar(u); b = similar(u,indices(u)); - atmp = similar(u,uEltypeNoUnits,indices(u)) + z₁ = similar(u,axes(u)); z₂ = similar(u,axes(u)); + z₃ = similar(u,axes(u)); z₄ = similar(u,axes(u)) + z₅ = similar(u,axes(u)); z₆ = similar(u,axes(u)); + z₇ = similar(u,axes(u)); z₈ = similar(u,axes(u)) + dz = similar(u,axes(u)) + fsalfirst = zero(rate_prototype) + k = zero(rate_prototype) + tmp = similar(u); b = similar(u,axes(u)); + atmp = similar(u,uEltypeNoUnits,axes(u)) if typeof(f) <: SplitFunction - k1 = similar(u,indices(u)); k2 = similar(u,indices(u)) - k3 = similar(u,indices(u)); k4 = similar(u,indices(u)) - k5 = similar(u,indices(u)); k6 = similar(u,indices(u)) - k7 = similar(u,indices(u)); k8 = similar(u,indices(u)) + k1 = similar(u,axes(u)); k2 = similar(u,axes(u)) + k3 = similar(u,axes(u)); k4 = similar(u,axes(u)) + k5 = similar(u,axes(u)); k6 = similar(u,axes(u)) + k7 = similar(u,axes(u)); k8 = similar(u,axes(u)) uf = DiffEqDiffTools.UJacobianWrapper(f.f1,t,p) else k1 = nothing; k2 = nothing diff --git a/src/caches/linear_caches.jl b/src/caches/linear_caches.jl index d102eb4221..47ae73decc 100644 --- a/src/caches/linear_caches.jl +++ b/src/caches/linear_caches.jl @@ -14,9 +14,9 @@ du_cache(c::LinearImplicitEulerCache) = (c.k,c.fsalfirst) function alg_cache(alg::LinearImplicitEuler,u,rate_prototype,uEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - W = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? - k = zeros(rate_prototype); fsalfirst = zeros(rate_prototype) - tmp = similar(u); atmp = similar(u,uEltypeNoUnits,indices(u)) + W = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? + k = zero(rate_prototype); fsalfirst = zero(rate_prototype) + tmp = similar(u); atmp = similar(u,uEltypeNoUnits,axes(u)) LinearImplicitEulerCache(u,uprev,uprev2,fsalfirst,W,k,tmp,atmp) end @@ -43,8 +43,8 @@ du_cache(c::MidpointSplittingCache) = (c.k,c.fsalfirst) function alg_cache(alg::MidpointSplitting,u,rate_prototype,uEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - W = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? - k = zeros(rate_prototype); fsalfirst = zeros(rate_prototype) + W = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? + k = zero(rate_prototype); fsalfirst = zero(rate_prototype) MidpointSplittingCache(u,uprev,uprev2,similar(u),fsalfirst,W,k) end diff --git a/src/caches/linear_nonlinear_caches.jl b/src/caches/linear_nonlinear_caches.jl index f37c77204c..5a6939d78e 100644 --- a/src/caches/linear_nonlinear_caches.jl +++ b/src/caches/linear_nonlinear_caches.jl @@ -25,17 +25,17 @@ du_cache(c::GenericIIF1Cache) = (c.rtmp1,c.fsalfirst,c.k) dual_cache(c::GenericIIF1Cache) = (c.dual_cache,) function alg_cache(alg::GenericIIF1,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{false}}) - uhold = Vector{typeof(u)}(1) + uhold = Vector{typeof(u)}(undef, 1) rhs = RHS_IIF_Scalar(f,zero(u),t,t,one(uEltypeNoUnits),p) nl_rhs = alg.nlsolve(Val{:init},rhs,uhold) GenericIIF1ConstantCache(uhold,rhs,nl_rhs) end function alg_cache(alg::GenericIIF1,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - tmp = similar(u,indices(u)); rtmp1 = zeros(rate_prototype) + tmp = similar(u,axes(u)); rtmp1 = zero(rate_prototype) dual_cache = DiffCache(u,Val{determine_chunksize(u,get_chunksize(alg.nlsolve))}) A = f.f1 - expA = expm(A*dt) + expA = exp(A*dt) rhs = RHS_IIF(f,tmp,t,t,uEltypeNoUnits(1//1),dual_cache,p) k = similar(rate_prototype); fsalfirst = similar(rate_prototype) nl_rhs = alg.nlsolve(Val{:init},rhs,u) @@ -66,7 +66,7 @@ du_cache(c::GenericIIF2Cache) = (c.rtmp1,c.fsalfirst,c.k) dual_cache(c::GenericIIF2Cache) = (c.dual_cache,) function alg_cache(alg::GenericIIF2,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{false}}) - uhold = Vector{typeof(u)}(1) + uhold = Vector{typeof(u)}(undef, 1) tmp = zero(u) rhs = RHS_IIF_Scalar(f,tmp,t,t,uEltypeNoUnits(1//2),p) nl_rhs = alg.nlsolve(Val{:init},rhs,uhold) @@ -74,10 +74,10 @@ function alg_cache(alg::GenericIIF2,u,rate_prototype,uEltypeNoUnits,uBottomEltyp end function alg_cache(alg::GenericIIF2,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - tmp = similar(u,indices(u)); rtmp1 = zeros(rate_prototype) + tmp = similar(u,axes(u)); rtmp1 = zero(rate_prototype) dual_cache = DiffCache(u,Val{determine_chunksize(u,get_chunksize(alg.nlsolve))}) A = f.f1 - expA = expm(A*dt) + expA = exp(A*dt) k = similar(rate_prototype); fsalfirst = similar(rate_prototype) rhs = RHS_IIF(f,tmp,t,t,uEltypeNoUnits(1//2),dual_cache,p) nl_rhs = alg.nlsolve(Val{:init},rhs,u) @@ -90,7 +90,7 @@ abstract type ExpRKCache <: OrdinaryDiffEqMutableCache end abstract type ExpRKConstantCache <: OrdinaryDiffEqConstantCache end # Precomputation of exponential-like operators -expRK_operators(::LawsonEuler, dt, A) = expm(dt * A) +expRK_operators(::LawsonEuler, dt, A) = exp(dt * A) expRK_operators(::NorsettEuler, dt, A) = phi(dt * A, 1)[2] function expRK_operators(::ETDRK2, dt, A) P = phi(dt * A, 2) @@ -136,7 +136,7 @@ function expRK_operators(::HochOst4, dt, A) end # Unified constructor for constant caches -for (Alg, Cache) in [(:LawsonEuler, :LawsonEulerConstantCache), +for (Alg, Cache) in [(:LawsonEuler, :LawsonEulerConstantCache), (:NorsettEuler, :NorsettEulerConstantCache), (:ETDRK2, :ETDRK2ConstantCache), (:ETDRK3, :ETDRK3ConstantCache), @@ -164,21 +164,21 @@ end Construct the non-standard caches (not uType or rateType) for ExpRK integrators. -`plist` is a list of integers each corresponding to the order of a `phiv(!)` +`plist` is a list of integers each corresponding to the order of a `phiv(!)` call in `perform_step!`. """ function alg_cache_expRK(alg::OrdinaryDiffEqExponentialAlgorithm, u, f, dt, plist) n = length(u); T = eltype(u) # Allocate cache for the Jacobian # TODO: sparse Jacobian support - Jcache = isa(f, SplitFunction) ? nothing : Matrix{T}(n, n) + Jcache = isa(f, SplitFunction) ? nothing : Matrix{T}(undef, n, n) if alg.krylov ops = nothing # no caching # Build up caches used by Krylov phiv m = min(alg.m, n) Ks = KrylovSubspace{T}(n, m) phiv_cache = PhivCache{T}(m, maximum(plist)) - ws = [Matrix{T}(n, plist[i] + 1) for i = 1:length(plist)] + ws = [Matrix{T}(undef, n, plist[i] + 1) for i = 1:length(plist)] KsCache = (Ks, phiv_cache, ws) # should use named tuple in v0.6 else KsCache = nothing @@ -202,12 +202,12 @@ end function alg_cache(alg::LawsonEuler,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) # uType caches - rtmp, G = (zeros(rate_prototype) for i = 1:2) # rateType caches + rtmp, G = (zero(rate_prototype) for i = 1:2) # rateType caches # other caches - # This is different from other ExpRK integrators because LawsonEuler only + # This is different from other ExpRK integrators because LawsonEuler only # needs expv. n = length(u); T = eltype(u) - Jcache = isa(f, SplitFunction) ? nothing : Matrix{T}(n, n) # TODO: sparse Jacobian support + Jcache = isa(f, SplitFunction) ? nothing : Matrix{T}(undef, n, n) # TODO: sparse Jacobian support if alg.krylov exphA = nothing # no caching m = min(alg.m, n) @@ -238,7 +238,7 @@ end function alg_cache(alg::NorsettEuler,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) # uType caches - rtmp, G = (zeros(rate_prototype) for i = 1:2) # rateType caches + rtmp, G = (zero(rate_prototype) for i = 1:2) # rateType caches Jcache, phihA, KsCache = alg_cache_expRK(alg, u, f, dt, (1,)) # other caches NorsettEulerCache(u,uprev,tmp,rtmp,G,Jcache,phihA,KsCache) end @@ -259,7 +259,7 @@ end function alg_cache(alg::ETDRK2,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) # uType caches - rtmp, F2 = (zeros(rate_prototype) for i = 1:2) # rateType caches + rtmp, F2 = (zero(rate_prototype) for i = 1:2) # rateType caches Jcache, ops, KsCache = alg_cache_expRK(alg, u, f, dt, (2, 2)) # other caches ETDRK2Cache(u,uprev,tmp,rtmp,F2,Jcache,ops,KsCache) end @@ -279,7 +279,7 @@ end function alg_cache(alg::ETDRK3,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) # uType caches - rtmp, Au, F2, F3 = (zeros(rate_prototype) for i = 1:4) # rateType caches + rtmp, Au, F2, F3 = (zero(rate_prototype) for i = 1:4) # rateType caches Jcache, ops, KsCache = alg_cache_expRK(alg, u, f, dt, (1,3,3,3)) # other caches ETDRK3Cache(u,uprev,tmp,rtmp,Au,F2,F3,Jcache,ops,KsCache) end @@ -300,7 +300,7 @@ end function alg_cache(alg::ETDRK4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) # uType caches - rtmp, Au, F2, F3, F4 = (zeros(rate_prototype) for i = 1:5) # rateType caches + rtmp, Au, F2, F3, F4 = (zero(rate_prototype) for i = 1:5) # rateType caches Jcache, ops, KsCache = alg_cache_expRK(alg, u, f, dt, (1,1,3,3,3,3)) # other caches ETDRK4Cache(u,uprev,tmp,rtmp,Au,F2,F3,F4,Jcache,ops,KsCache) end @@ -326,7 +326,7 @@ end function alg_cache(alg::HochOst4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) # uType caches - rtmp, rtmp2, Au, F2, F3, F4, F5 = (zeros(rate_prototype) for i = 1:7) # rateType caches + rtmp, rtmp2, Au, F2, F3, F4, F5 = (zero(rate_prototype) for i = 1:7) # rateType caches Jcache, ops, KsCache = alg_cache_expRK(alg, u, f, dt, (3,3,3,3,3,3,3,3,3)) # other caches HochOst4Cache(u,uprev,tmp,rtmp,rtmp2,Au,F2,F3,F4,F5,Jcache,ops,KsCache) end @@ -351,13 +351,13 @@ end function alg_cache(alg::Exp4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) # uType caches - rtmp, rtmp2 = (zeros(rate_prototype) for i = 1:2) # rateType caches + rtmp, rtmp2 = (zero(rate_prototype) for i = 1:2) # rateType caches # Allocate matrices # TODO: units n = length(u); T = eltype(u) - K = Matrix{T}(n, 3) - A = Matrix{T}(n, n) # TODO: sparse Jacobian support - B = zeros(T, n, 2) + K = Matrix{T}(undef, n, 3) + A = Matrix{T}(undef, n, n) # TODO: sparse Jacobian support + B = fill(zero(T), n, 2) # Allocate caches for phiv_timestep maxiter = min(alg.m, n) KsCache = _phiv_timestep_caches(u, maxiter, 1) @@ -382,12 +382,12 @@ end function alg_cache(alg::EPIRK4s3A,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) # uType caches - rtmp, rtmp2 = (zeros(rate_prototype) for i = 1:2) # rateType caches + rtmp, rtmp2 = (zero(rate_prototype) for i = 1:2) # rateType caches # Allocate matrices n = length(u); T = eltype(u) - K = Matrix{T}(n, 2) - A = Matrix{T}(n, n) # TODO: sparse Jacobian support - B = zeros(T, n, 5) + K = Matrix{T}(undef, n, 2) + A = Matrix{T}(undef, n, n) # TODO: sparse Jacobian support + B = fill(zero(T), n, 5) # Allocate caches for phiv_timestep maxiter = min(alg.m, n) KsCache = _phiv_timestep_caches(u, maxiter, 4) @@ -412,12 +412,12 @@ end function alg_cache(alg::EPIRK4s3B,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) # uType caches - rtmp, rtmp2 = (zeros(rate_prototype) for i = 1:2) # rateType caches + rtmp, rtmp2 = (zero(rate_prototype) for i = 1:2) # rateType caches # Allocate matrices n = length(u); T = eltype(u) - K = Matrix{T}(n, 2) - A = Matrix{T}(n, n) # TODO: sparse Jacobian support - B = zeros(T, n, 5) + K = Matrix{T}(undef, n, 2) + A = Matrix{T}(undef, n, n) # TODO: sparse Jacobian support + B = fill(zero(T), n, 5) # Allocate caches for phiv_timestep maxiter = min(alg.m, n) KsCache = _phiv_timestep_caches(u, maxiter, 4) @@ -442,11 +442,11 @@ end function alg_cache(alg::EPIRK5s3,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp, k = (similar(u) for i = 1:2) # uType caches - rtmp, rtmp2 = (zeros(rate_prototype) for i = 1:2) # rateType caches + rtmp, rtmp2 = (zero(rate_prototype) for i = 1:2) # rateType caches # Allocate matrices n = length(u); T = eltype(u) - A = Matrix{T}(n, n) # TODO: sparse Jacobian support - B = zeros(T, n, 5) + A = Matrix{T}(undef, n, n) # TODO: sparse Jacobian support + B = fill(zero(T), n, 5) # Allocate caches for phiv_timestep maxiter = min(alg.m, n) KsCache = _phiv_timestep_caches(u, maxiter, 4) @@ -471,12 +471,12 @@ end function alg_cache(alg::EXPRB53s3,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) # uType caches - rtmp, rtmp2 = (zeros(rate_prototype) for i = 1:2) # rateType caches + rtmp, rtmp2 = (zero(rate_prototype) for i = 1:2) # rateType caches # Allocate matrices n = length(u); T = eltype(u) - K = Matrix{T}(n, 2) - A = Matrix{T}(n, n) # TODO: sparse Jacobian support - B = zeros(T, n, 5) + K = Matrix{T}(undef, n, 2) + A = Matrix{T}(undef, n, n) # TODO: sparse Jacobian support + B = fill(zero(T), n, 5) # Allocate caches for phiv_timestep maxiter = min(alg.m, n) KsCache = _phiv_timestep_caches(u, maxiter, 4) @@ -501,12 +501,12 @@ end function alg_cache(alg::EPIRK5P1,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) # uType caches - rtmp, rtmp2 = (zeros(rate_prototype) for i = 1:2) # rateType caches + rtmp, rtmp2 = (zero(rate_prototype) for i = 1:2) # rateType caches # Allocate matrices n = length(u); T = eltype(u) - K = Matrix{T}(n, 3) - A = Matrix{T}(n, n) # TODO: sparse Jacobian support - B = zeros(T, n, 4) + K = Matrix{T}(undef, n, 3) + A = Matrix{T}(undef, n, n) # TODO: sparse Jacobian support + B = fill(zero(T), n, 4) # Allocate caches for phiv_timestep maxiter = min(alg.m, n) KsCache = _phiv_timestep_caches(u, maxiter, 3) @@ -532,12 +532,12 @@ end function alg_cache(alg::EPIRK5P2,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) # uType caches - rtmp, rtmp2, dR = (zeros(rate_prototype) for i = 1:3) # rateType caches + rtmp, rtmp2, dR = (zero(rate_prototype) for i = 1:3) # rateType caches # Allocate matrices n = length(u); T = eltype(u) - K = Matrix{T}(n, 3) - A = Matrix{T}(n, n) # TODO: sparse Jacobian support - B = zeros(T, n, 4) + K = Matrix{T}(undef, n, 3) + A = Matrix{T}(undef, n, n) # TODO: sparse Jacobian support + B = fill(zero(T), n, 4) # Allocate caches for phiv_timestep maxiter = min(alg.m, n) KsCache = _phiv_timestep_caches(u, maxiter, 3) @@ -548,7 +548,7 @@ end # Multistep exponential method caches #= - Fsal separately the linear and nonlinear part, as well as the nonlinear + Fsal separately the linear and nonlinear part, as well as the nonlinear part in the previous time step. =# mutable struct ETD2Fsal{rateType} diff --git a/src/caches/low_order_rk_caches.jl b/src/caches/low_order_rk_caches.jl index f45b376132..d9f575a51c 100644 --- a/src/caches/low_order_rk_caches.jl +++ b/src/caches/low_order_rk_caches.jl @@ -15,7 +15,7 @@ struct SplitEulerCache{uType,rateType} <: OrdinaryDiffEqMutableCache end function alg_cache(alg::SplitEuler,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - SplitEulerCache(u,uprev,similar(u),zeros(rate_prototype),zeros(rate_prototype)) + SplitEulerCache(u,uprev,similar(u),zero(rate_prototype),zero(rate_prototype)) end u_cache(c::SplitEulerCache) = () @@ -26,7 +26,7 @@ struct SplitEulerConstantCache <: OrdinaryDiffEqConstantCache end alg_cache(alg::SplitEuler,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{false}}) = SplitEulerConstantCache() function alg_cache(alg::Euler,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - EulerCache(u,uprev,similar(u),zeros(rate_prototype),zeros(rate_prototype)) + EulerCache(u,uprev,similar(u),zero(rate_prototype),zero(rate_prototype)) end u_cache(c::EulerCache) = () @@ -58,11 +58,11 @@ u_cache(c::Union{HeunCache,RalstonCache}) = () du_cache(c::Union{HeunCache,RalstonCache}) = (c.k,c.fsalfirst,c.utilde) function alg_cache(alg::Heun,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - HeunCache(u,uprev,similar(u),zeros(rate_prototype),zeros(rate_prototype),zeros(rate_prototype)) + HeunCache(u,uprev,similar(u),zero(rate_prototype),zero(rate_prototype),zero(rate_prototype)) end function alg_cache(alg::Ralston,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - RalstonCache(u,uprev,similar(u),zeros(rate_prototype),zeros(rate_prototype),zeros(rate_prototype)) + RalstonCache(u,uprev,similar(u),zero(rate_prototype),zero(rate_prototype),zero(rate_prototype)) end struct HeunConstantCache <: OrdinaryDiffEqConstantCache end @@ -89,8 +89,8 @@ struct MidpointConstantCache <: OrdinaryDiffEqConstantCache end function alg_cache(alg::Midpoint,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u); atmp = similar(u, uEltypeNoUnits) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) MidpointCache(u,uprev,k,tmp,atmp,fsalfirst) end @@ -114,11 +114,11 @@ du_cache(c::RK4Cache) = (c.fsalfirst,c.k₂,c.k₃,c.k₄,c.k) struct RK4ConstantCache <: OrdinaryDiffEqConstantCache end function alg_cache(alg::RK4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - k₁ = zeros(rate_prototype) - k₂ = zeros(rate_prototype) - k₃ = zeros(rate_prototype) - k₄ = zeros(rate_prototype) - k = zeros(rate_prototype) + k₁ = zero(rate_prototype) + k₂ = zero(rate_prototype) + k₃ = zero(rate_prototype) + k₄ = zero(rate_prototype) + k = zero(rate_prototype) tmp = similar(u); atmp = similar(u, uEltypeNoUnits) RK4Cache(u,uprev,k₁,k₂,k₃,k₄,k,tmp,atmp) end @@ -168,8 +168,8 @@ end function alg_cache(alg::CarpenterKennedy2N54,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) A2 = -567301805773/1357537059087 A3 = -2404267990393/2016746695238 A4 = -3550918686646/2091501179385 @@ -223,11 +223,11 @@ du_cache(c::BS3Cache) = (c.fsalfirst,c.k2,c.k3,c.k4) function alg_cache(alg::BS3,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tab = BS3ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype) - k2 = zeros(rate_prototype) - k3 = zeros(rate_prototype) - k4 = zeros(rate_prototype) - utilde = similar(u,indices(u)) + k1 = zero(rate_prototype) + k2 = zero(rate_prototype) + k3 = zero(rate_prototype) + k4 = zero(rate_prototype) + utilde = similar(u,axes(u)) atmp = similar(u,uEltypeNoUnits) tmp = similar(u) BS3Cache(u,uprev,k1,k2,k3,k4,utilde,tmp,atmp,tab) @@ -253,11 +253,11 @@ du_cache(c::OwrenZen3Cache) = (c.k1,c.k2,c.k3,c.k4) function alg_cache(alg::OwrenZen3,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tab = OwrenZen3ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype) - k2 = zeros(rate_prototype) - k3 = zeros(rate_prototype) - k4 = zeros(rate_prototype) - utilde = similar(u,indices(u)) + k1 = zero(rate_prototype) + k2 = zero(rate_prototype) + k3 = zero(rate_prototype) + k4 = zero(rate_prototype) + utilde = similar(u,axes(u)) atmp = similar(u,uEltypeNoUnits) tmp = similar(u) OwrenZen3Cache(u,uprev,k1,k2,k3,k4,utilde,tmp,atmp,tab) @@ -285,13 +285,13 @@ du_cache(c::OwrenZen4Cache) = (c.k1,c.k2,c.k3,c.k4,c.k5,c.k6) function alg_cache(alg::OwrenZen4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tab = OwrenZen4ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype) - k2 = zeros(rate_prototype) - k3 = zeros(rate_prototype) - k4 = zeros(rate_prototype) - k5 = zeros(rate_prototype) - k6 = zeros(rate_prototype) - utilde = similar(u,indices(u)) + k1 = zero(rate_prototype) + k2 = zero(rate_prototype) + k3 = zero(rate_prototype) + k4 = zero(rate_prototype) + k5 = zero(rate_prototype) + k6 = zero(rate_prototype) + utilde = similar(u,axes(u)) atmp = similar(u,uEltypeNoUnits) tmp = similar(u) OwrenZen4Cache(u,uprev,k1,k2,k3,k4,k5,k6,utilde,tmp,atmp,tab) @@ -321,15 +321,15 @@ du_cache(c::OwrenZen5Cache) = (c.k1,c.k2,c.k3,c.k4,c.k5,c.k6,c.k7,c.k8) function alg_cache(alg::OwrenZen5,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tab = OwrenZen5ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype) - k2 = zeros(rate_prototype) - k3 = zeros(rate_prototype) - k4 = zeros(rate_prototype) - k5 = zeros(rate_prototype) - k6 = zeros(rate_prototype) - k7 = zeros(rate_prototype) - k8 = zeros(rate_prototype) - utilde = similar(u,indices(u)) + k1 = zero(rate_prototype) + k2 = zero(rate_prototype) + k3 = zero(rate_prototype) + k4 = zero(rate_prototype) + k5 = zero(rate_prototype) + k6 = zero(rate_prototype) + k7 = zero(rate_prototype) + k8 = zero(rate_prototype) + utilde = similar(u,axes(u)) atmp = similar(u,uEltypeNoUnits) tmp = similar(u) OwrenZen5Cache(u,uprev,k1,k2,k3,k4,k5,k6,k7,k8,utilde,tmp,atmp,tab) @@ -359,16 +359,16 @@ du_cache(c::BS5Cache) = (c.k1,c.k2,c.k3,c.k4,c.k5,c.k6,c.k7,c.k8) function alg_cache(alg::BS5,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tab = BS5ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype) - k2 = zeros(rate_prototype) - k3 = zeros(rate_prototype) - k4 = zeros(rate_prototype) - k5 = zeros(rate_prototype) - k6 = zeros(rate_prototype) - k7 = zeros(rate_prototype) - k8 = zeros(rate_prototype) - utilde = similar(u,indices(u)) - atmp = similar(u,uEltypeNoUnits,indices(u)) + k1 = zero(rate_prototype) + k2 = zero(rate_prototype) + k3 = zero(rate_prototype) + k4 = zero(rate_prototype) + k5 = zero(rate_prototype) + k6 = zero(rate_prototype) + k7 = zero(rate_prototype) + k8 = zero(rate_prototype) + utilde = similar(u,axes(u)) + atmp = similar(u,uEltypeNoUnits,axes(u)) tmp = similar(u) BS5Cache(u,uprev,k1,k2,k3,k4,k5,k6,k7,k8,utilde,tmp,atmp,tab) end @@ -396,15 +396,15 @@ du_cache(c::Tsit5Cache) = (c.k1,c.k2,c.k3,c.k4,c.k5,c.k6,c.k7) function alg_cache(alg::Tsit5,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tab = Tsit5ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype) - k2 = zeros(rate_prototype) - k3 = zeros(rate_prototype) - k4 = zeros(rate_prototype) - k5 = zeros(rate_prototype) - k6 = zeros(rate_prototype) - k7 = zeros(rate_prototype) - utilde = similar(u,indices(u)) - atmp = similar(u,uEltypeNoUnits,indices(u)) + k1 = zero(rate_prototype) + k2 = zero(rate_prototype) + k3 = zero(rate_prototype) + k4 = zero(rate_prototype) + k5 = zero(rate_prototype) + k6 = zero(rate_prototype) + k7 = zero(rate_prototype) + utilde = similar(u,axes(u)) + atmp = similar(u,uEltypeNoUnits,axes(u)) tmp = similar(u) Tsit5Cache(u,uprev,k1,k2,k3,k4,k5,k6,k7,utilde,tmp,atmp,tab) end @@ -435,13 +435,13 @@ u_cache(c::DP5Cache) = (c.utilde,c.atmp) du_cache(c::DP5Cache) = (c.k1,c.k2,c.k3,c.k4,c.k5,c.k6,c.k7,c.dense_tmp3,c.dense_tmp4,c.update,c.bspl) function alg_cache(alg::DP5,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - k1 = zeros(rate_prototype) - k2 = zeros(rate_prototype) - k3 = zeros(rate_prototype) - k4 = zeros(rate_prototype) - k5 = zeros(rate_prototype) + k1 = zero(rate_prototype) + k2 = zero(rate_prototype) + k3 = zero(rate_prototype) + k4 = zero(rate_prototype) + k5 = zero(rate_prototype) k6 = k2 - k7 = zeros(rate_prototype) # This is FSAL'd to k1 + k7 = zero(rate_prototype) # This is FSAL'd to k1 dense_tmp3 = k2 dense_tmp4 = k5 bspl = k3 @@ -450,8 +450,8 @@ function alg_cache(alg::DP5,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits utilde = tmp if eltype(u) != uEltypeNoUnits || calck - update = zeros(rate_prototype) - atmp = similar(u,uEltypeNoUnits,indices(u)) + update = zero(rate_prototype) + atmp = similar(u,uEltypeNoUnits,axes(u)) else update = k7 atmp = k3 @@ -488,19 +488,19 @@ u_cache(c::DP5ThreadedCache) = (c.utilde,c.atmp) du_cache(c::DP5ThreadedCache) = (c.k1,c.k2,c.k3,c.k4,c.k5,c.k6,c.k7,c.dense_tmp3,c.dense_tmp4,c.update,c.bspl) function alg_cache(alg::DP5Threaded,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - k1 = zeros(rate_prototype) - k2 = zeros(rate_prototype) - k3 = zeros(rate_prototype) - k4 = zeros(rate_prototype) - k5 = zeros(rate_prototype) - k6 = zeros(rate_prototype) - k7 = zeros(rate_prototype) - dense_tmp3 = zeros(rate_prototype) - dense_tmp4 = zeros(rate_prototype) - update = zeros(rate_prototype) - bspl = zeros(rate_prototype) - utilde = similar(u,indices(u)) - tmp = similar(u); atmp = similar(u,uEltypeNoUnits,indices(u)) + k1 = zero(rate_prototype) + k2 = zero(rate_prototype) + k3 = zero(rate_prototype) + k4 = zero(rate_prototype) + k5 = zero(rate_prototype) + k6 = zero(rate_prototype) + k7 = zero(rate_prototype) + dense_tmp3 = zero(rate_prototype) + dense_tmp4 = zero(rate_prototype) + update = zero(rate_prototype) + bspl = zero(rate_prototype) + utilde = similar(u,axes(u)) + tmp = similar(u); atmp = similar(u,uEltypeNoUnits,axes(u)) tab = DP5ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) DP5ThreadedCache(u,uprev,k1,k2,k3,k4,k5,k6,k7,dense_tmp3,dense_tmp4,update,bspl,utilde,tmp,atmp,tab) end diff --git a/src/caches/nordsieck_caches.jl b/src/caches/nordsieck_caches.jl index 255ae345a4..763bd212e6 100644 --- a/src/caches/nordsieck_caches.jl +++ b/src/caches/nordsieck_caches.jl @@ -22,9 +22,9 @@ function alg_cache(alg::AN5,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits N = 5 z = [zero(rate_prototype) for i in 1:N+1] Δ = u - l = zeros(tTypeNoUnits,N+1); m = zeros(l) + l = fill(zero(tTypeNoUnits),N+1); m = zero(l) c_LTE = c_conv = zero(tTypeNoUnits) - dts = zeros(typeof(dt), 6) + dts = fill(zero(typeof(dt)), 6) tsit5tab = Tsit5ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) AN5ConstantCache(z,l,m,c_LTE,c_conv,dts,Δ,tsit5tab,1) end @@ -62,25 +62,25 @@ function alg_cache(alg::AN5,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits # Tsit5 tab = Tsit5ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) # Cannot alias pointers, since we have to use `k`s to start the Nordsieck vector - k1 = zeros(rate_prototype); k2 = zeros(rate_prototype) - k3 = zeros(rate_prototype); k4 = zeros(rate_prototype) - k5 = zeros(rate_prototype) - k6 = zeros(rate_prototype); k7 = zeros(rate_prototype) - utilde = similar(u,indices(u)) - atmp = similar(u,uEltypeNoUnits,indices(u)); tmp = similar(u) + k1 = zero(rate_prototype); k2 = zero(rate_prototype) + k3 = zero(rate_prototype); k4 = zero(rate_prototype) + k5 = zero(rate_prototype) + k6 = zero(rate_prototype); k7 = zero(rate_prototype) + utilde = similar(u,axes(u)) + atmp = similar(u,uEltypeNoUnits,axes(u)); tmp = similar(u) tsit5cache = Tsit5Cache(u,uprev,k1,k2,k3,k4,k5,k6,k7,utilde,tmp,atmp,tab) ################################################# N = 5 Δ = similar(atmp) - l = zeros(tTypeNoUnits,N+1); m = zeros(l) + l = fill(zero(tTypeNoUnits),N+1); m = zero(l) c_LTE = c_conv = zero(tTypeNoUnits) - dts = zeros(typeof(dt), 6) - fsalfirst = zeros(rate_prototype) - z = [zeros(rate_prototype) for i in 1:N+1] + dts = fill(zero(typeof(dt)), 6) + fsalfirst = zero(rate_prototype) + z = [zero(rate_prototype) for i in 1:N+1] for i in 1:N+1 - z[i] = zeros(rate_prototype) + z[i] = zero(rate_prototype) end - ratetmp = zeros(rate_prototype) + ratetmp = zero(rate_prototype) AN5Cache(u,uprev,tmp,Δ,atmp,fsalfirst,ratetmp, z,l,m,c_LTE,c_conv,dts, @@ -129,9 +129,9 @@ function alg_cache(alg::JVODE,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUni N = 12 z = [rate_prototype for i in 1:N+1] Δ = u - l = zeros(tTypeNoUnits, N+1); m = zeros(l) + l = fill(zero(tTypeNoUnits), N+1); m = zero(l) c_LTE₊₁ = c_LTE = c_LTE₋₁ = c_conv = c_𝒟 = prev_𝒟 = zero(tTypeNoUnits) - dts = zeros(typeof(dt),N+1) + dts = fill(zero(typeof(dt)),N+1) tsit5tab = Tsit5ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) η = zero(dt/dt) JVODEConstantCache(z,l,m, @@ -192,28 +192,28 @@ function alg_cache(alg::JVODE,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUni # Tsit5 # Cannot alias pointers, since we have to use `k`s to start the Nordsieck vector tab = Tsit5ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype); k2 = zeros(rate_prototype); k3 = zeros(rate_prototype); k4 = zeros(rate_prototype) - k5 = zeros(rate_prototype); k6 = zeros(rate_prototype); k7 = zeros(rate_prototype) - utilde = similar(u,indices(u)) - atmp = similar(u,uEltypeNoUnits,indices(u)); tmp = similar(u) + k1 = zero(rate_prototype); k2 = zero(rate_prototype); k3 = zero(rate_prototype); k4 = zero(rate_prototype) + k5 = zero(rate_prototype); k6 = zero(rate_prototype); k7 = zero(rate_prototype) + utilde = similar(u,axes(u)) + atmp = similar(u,uEltypeNoUnits,axes(u)); tmp = similar(u) tsit5cache = Tsit5Cache(u,uprev,k1,k2,k3,k4,k5,k6,k7,utilde,tmp,atmp,tab) ################################################# - fsalfirst = zeros(rate_prototype) + fsalfirst = zero(rate_prototype) N = 12 - z = [zeros(rate_prototype) for i in 1:N+1] - Δ = similar(u,uEltypeNoUnits,indices(u)) - l = zeros(tTypeNoUnits, N+1); m = zeros(l) + z = [zero(rate_prototype) for i in 1:N+1] + Δ = similar(u,uEltypeNoUnits,axes(u)) + l = fill(zero(tTypeNoUnits), N+1); m = zero(l) c_LTE₊₁ = c_LTE = c_LTE₋₁ = c_conv = c_𝒟 = prev_𝒟 = zero(tTypeNoUnits) - dts = zeros(typeof(dt),N+1) + dts = fill(zero(typeof(dt)),N+1) η = zero(dt/dt) ################################################# # Nordsieck Vector - z[1] = zeros(rate_prototype); z[2] = zeros(rate_prototype); z[3] = zeros(rate_prototype); - z[4] = zeros(rate_prototype); z[5] = zeros(rate_prototype); z[6] = zeros(rate_prototype); - z[7] = zeros(rate_prototype); z[8] = zeros(rate_prototype); z[9] = zeros(rate_prototype); - z[10] = zeros(rate_prototype); z[11] = zeros(rate_prototype); z[12] = zeros(rate_prototype); - z[13] = zeros(rate_prototype) - ratetmp = zeros(rate_prototype) + z[1] = zero(rate_prototype); z[2] = zero(rate_prototype); z[3] = zero(rate_prototype); + z[4] = zero(rate_prototype); z[5] = zero(rate_prototype); z[6] = zero(rate_prototype); + z[7] = zero(rate_prototype); z[8] = zero(rate_prototype); z[9] = zero(rate_prototype); + z[10] = zero(rate_prototype); z[11] = zero(rate_prototype); z[12] = zero(rate_prototype); + z[13] = zero(rate_prototype) + ratetmp = zero(rate_prototype) ################################################# JVODECache(u,uprev,tmp,fsalfirst,ratetmp, z, l, m, diff --git a/src/caches/rkn_caches.jl b/src/caches/rkn_caches.jl index b25f9c8ba7..c6780ed937 100644 --- a/src/caches/rkn_caches.jl +++ b/src/caches/rkn_caches.jl @@ -16,11 +16,11 @@ du_cache(c::Nystrom4Cache) = (c.fsalfirst,c.k₂,c.k₃,c.k₄,c.k) function alg_cache(alg::Nystrom4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) reduced_rate_prototype = rate_prototype.x[2] - k₁ = zeros(rate_prototype) - k₂ = zeros(reduced_rate_prototype) - k₃ = zeros(reduced_rate_prototype) - k₄ = zeros(reduced_rate_prototype) - k = zeros(rate_prototype) + k₁ = zero(rate_prototype) + k₂ = zero(reduced_rate_prototype) + k₃ = zero(reduced_rate_prototype) + k₄ = zero(reduced_rate_prototype) + k = zero(rate_prototype) tmp = similar(u) Nystrom4Cache(u,uprev,k₁,k₂,k₃,k₄,k,tmp) end @@ -46,10 +46,10 @@ du_cache(c::Nystrom4VelocityIndependentCache) = (c.fsalfirst,c.k₂,c.k₃,c.k) function alg_cache(alg::Nystrom4VelocityIndependent,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) reduced_rate_prototype = rate_prototype.x[2] - k₁ = zeros(rate_prototype) - k₂ = zeros(reduced_rate_prototype) - k₃ = zeros(reduced_rate_prototype) - k = zeros(rate_prototype) + k₁ = zero(rate_prototype) + k₂ = zero(reduced_rate_prototype) + k₃ = zero(reduced_rate_prototype) + k = zero(rate_prototype) tmp = similar(u) Nystrom4VelocityIndependentCache(u,uprev,k₁,k₂,k₃,k,tmp) end @@ -75,10 +75,10 @@ u_cache(c::IRKN3Cache) = () du_cache(c::IRKN3Cache) = (c.fsalfirst,c.k₂,c.k) function alg_cache(alg::IRKN3,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - k₁ = zeros(rate_prototype) - k₂ = zeros(rate_prototype) - k₃ = zeros(rate_prototype) - k = zeros(rate_prototype) + k₁ = zero(rate_prototype) + k₂ = zero(rate_prototype) + k₃ = zero(rate_prototype) + k = zero(rate_prototype) tmp = similar(u) tab = IRKN3ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) IRKN3Cache(u,uprev,uprev2,k₁,k₂,k,tmp,k₃,Nystrom4VelocityIndependentCache(u,uprev,k₁,k₂.x[2],k₃.x[2],k,tmp),tab) @@ -104,10 +104,10 @@ u_cache(c::IRKN4Cache) = () du_cache(c::IRKN4Cache) = (c.fsalfirst,c.k₂,c.k₃,c.k) function alg_cache(alg::IRKN4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - k₁ = zeros(rate_prototype) - k₂ = zeros(rate_prototype) - k₃ = zeros(rate_prototype) - k = zeros(rate_prototype) + k₁ = zero(rate_prototype) + k₂ = zero(rate_prototype) + k₃ = zero(rate_prototype) + k = zero(rate_prototype) tmp = similar(u) tmp2 = similar(rate_prototype) tab = IRKN4ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) @@ -133,11 +133,11 @@ du_cache(c::Nystrom5VelocityIndependentCache) = (c.fsalfirst,c.k₂,c.k₃,c.k function alg_cache(alg::Nystrom5VelocityIndependent,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) reduced_rate_prototype = rate_prototype.x[2] - k₁ = zeros(rate_prototype) - k₂ = zeros(reduced_rate_prototype) - k₃ = zeros(reduced_rate_prototype) - k₄ = zeros(reduced_rate_prototype) - k = zeros(rate_prototype) + k₁ = zero(rate_prototype) + k₂ = zero(reduced_rate_prototype) + k₃ = zero(reduced_rate_prototype) + k₄ = zero(reduced_rate_prototype) + k = zero(rate_prototype) tmp = similar(u) tab = Nystrom5VelocityIndependentConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) Nystrom5VelocityIndependentCache(u,uprev,k₁,k₂,k₃,k₄,k,tmp,tab) @@ -167,14 +167,14 @@ du_cache(c::DPRKN6Cache) = (c.fsalfirst,c.k2,c.k3,c.k4,c.k5,c.k6) function alg_cache(alg::DPRKN6,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) reduced_rate_prototype = rate_prototype.x[2] tab = DPRKN6ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype) - k2 = zeros(reduced_rate_prototype) - k3 = zeros(reduced_rate_prototype) - k4 = zeros(reduced_rate_prototype) - k5 = zeros(reduced_rate_prototype) - k6 = zeros(reduced_rate_prototype) - k = zeros(rate_prototype) - utilde = similar(u,indices(u)) + k1 = zero(rate_prototype) + k2 = zero(reduced_rate_prototype) + k3 = zero(reduced_rate_prototype) + k4 = zero(reduced_rate_prototype) + k5 = zero(reduced_rate_prototype) + k6 = zero(reduced_rate_prototype) + k = zero(rate_prototype) + utilde = similar(u,axes(u)) atmp = similar(u,uEltypeNoUnits) tmp = similar(u) DPRKN6Cache(u,uprev,k1,k2,k3,k4,k5,k6,k,utilde,tmp,atmp,tab) @@ -208,17 +208,17 @@ du_cache(c::DPRKN8Cache) = (c.fsalfirst,c.k2,c.k3,c.k4,c.k5,c.k6,c.k7,c.k8,c.k9) function alg_cache(alg::DPRKN8,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) reduced_rate_prototype = rate_prototype.x[2] tab = DPRKN8ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype) - k2 = zeros(reduced_rate_prototype) - k3 = zeros(reduced_rate_prototype) - k4 = zeros(reduced_rate_prototype) - k5 = zeros(reduced_rate_prototype) - k6 = zeros(reduced_rate_prototype) - k7 = zeros(reduced_rate_prototype) - k8 = zeros(reduced_rate_prototype) - k9 = zeros(reduced_rate_prototype) - k = zeros(rate_prototype) - utilde = similar(u,indices(u)) + k1 = zero(rate_prototype) + k2 = zero(reduced_rate_prototype) + k3 = zero(reduced_rate_prototype) + k4 = zero(reduced_rate_prototype) + k5 = zero(reduced_rate_prototype) + k6 = zero(reduced_rate_prototype) + k7 = zero(reduced_rate_prototype) + k8 = zero(reduced_rate_prototype) + k9 = zero(reduced_rate_prototype) + k = zero(rate_prototype) + utilde = similar(u,axes(u)) atmp = similar(u,uEltypeNoUnits) tmp = similar(u) DPRKN8Cache(u,uprev,k1,k2,k3,k4,k5,k6,k7,k8,k9,k,utilde,tmp,atmp,tab) @@ -259,25 +259,25 @@ du_cache(c::DPRKN12Cache) = (c.fsalfirst,c.k2,c.k3,c.k4,c.k5,c.k6,c.k7,c.k8,c.k9 function alg_cache(alg::DPRKN12,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) reduced_rate_prototype = rate_prototype.x[2] tab = DPRKN12ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype) - k2 = zeros(reduced_rate_prototype) - k3 = zeros(reduced_rate_prototype) - k4 = zeros(reduced_rate_prototype) - k5 = zeros(reduced_rate_prototype) - k6 = zeros(reduced_rate_prototype) - k7 = zeros(reduced_rate_prototype) - k8 = zeros(reduced_rate_prototype) - k9 = zeros(reduced_rate_prototype) - k10 = zeros(reduced_rate_prototype) - k11 = zeros(reduced_rate_prototype) - k12 = zeros(reduced_rate_prototype) - k13 = zeros(reduced_rate_prototype) - k14 = zeros(reduced_rate_prototype) - k15 = zeros(reduced_rate_prototype) - k16 = zeros(reduced_rate_prototype) - k17 = zeros(reduced_rate_prototype) - k = zeros(rate_prototype) - utilde = similar(u,indices(u)) + k1 = zero(rate_prototype) + k2 = zero(reduced_rate_prototype) + k3 = zero(reduced_rate_prototype) + k4 = zero(reduced_rate_prototype) + k5 = zero(reduced_rate_prototype) + k6 = zero(reduced_rate_prototype) + k7 = zero(reduced_rate_prototype) + k8 = zero(reduced_rate_prototype) + k9 = zero(reduced_rate_prototype) + k10 = zero(reduced_rate_prototype) + k11 = zero(reduced_rate_prototype) + k12 = zero(reduced_rate_prototype) + k13 = zero(reduced_rate_prototype) + k14 = zero(reduced_rate_prototype) + k15 = zero(reduced_rate_prototype) + k16 = zero(reduced_rate_prototype) + k17 = zero(reduced_rate_prototype) + k = zero(rate_prototype) + utilde = similar(u,axes(u)) atmp = similar(u,uEltypeNoUnits) tmp = similar(u) DPRKN12Cache(u,uprev,k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,k11,k12,k13,k14,k15,k16,k17,k,utilde,tmp,atmp,tab) @@ -305,12 +305,12 @@ du_cache(c::ERKN4Cache) = (c.fsalfirst,c.k2,c.k3,c.k4,c.k) function alg_cache(alg::ERKN4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) reduced_rate_prototype = rate_prototype.x[2] tab = ERKN4ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype) - k2 = zeros(reduced_rate_prototype) - k3 = zeros(reduced_rate_prototype) - k4 = zeros(reduced_rate_prototype) - k = zeros(rate_prototype) - utilde = similar(u,indices(u)) + k1 = zero(rate_prototype) + k2 = zero(reduced_rate_prototype) + k3 = zero(reduced_rate_prototype) + k4 = zero(reduced_rate_prototype) + k = zero(rate_prototype) + utilde = similar(u,axes(u)) atmp = similar(u,uEltypeNoUnits) tmp = similar(u) ERKN4Cache(u,uprev,k1,k2,k3,k4,k,utilde,tmp,atmp,tab) @@ -338,12 +338,12 @@ du_cache(c::ERKN5Cache) = (c.fsalfirst,c.k2,c.k3,c.k4,c.k) function alg_cache(alg::ERKN5,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) reduced_rate_prototype = rate_prototype.x[2] tab = ERKN5ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype) - k2 = zeros(reduced_rate_prototype) - k3 = zeros(reduced_rate_prototype) - k4 = zeros(reduced_rate_prototype) - k = zeros(rate_prototype) - utilde = similar(u,indices(u)) + k1 = zero(rate_prototype) + k2 = zero(reduced_rate_prototype) + k3 = zero(reduced_rate_prototype) + k4 = zero(reduced_rate_prototype) + k = zero(rate_prototype) + utilde = similar(u,axes(u)) atmp = similar(u,uEltypeNoUnits) tmp = similar(u) ERKN5Cache(u,uprev,k1,k2,k3,k4,k,utilde,tmp,atmp,tab) diff --git a/src/caches/rosenbrock_caches.jl b/src/caches/rosenbrock_caches.jl index 7d95007bd9..da3eb89150 100644 --- a/src/caches/rosenbrock_caches.jl +++ b/src/caches/rosenbrock_caches.jl @@ -70,26 +70,26 @@ jac_cache(c::Rosenbrock32Cache) = (c.J,c.W) vecu_cache(c::Rosenbrock32Cache) = (c.vectmp,c.vectmp2,c.vectmp3) function alg_cache(alg::Rosenbrock23,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - k₁ = zeros(rate_prototype) - k₂ = zeros(rate_prototype) - k₃ = zeros(rate_prototype) - du1 = zeros(rate_prototype) - du2 = zeros(rate_prototype) + k₁ = zero(rate_prototype) + k₂ = zero(rate_prototype) + k₃ = zero(rate_prototype) + du1 = zero(rate_prototype) + du2 = zero(rate_prototype) # f₀ = similar(u) fsalfirst - f₁ = zeros(rate_prototype) - vectmp = vec(similar(u,indices(u))) - vectmp2 = vec(similar(u,indices(u))) - vectmp3 = vec(similar(u,indices(u))) - fsalfirst = zeros(rate_prototype) - fsallast = zeros(rate_prototype) - dT = similar(u,indices(u)) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + f₁ = zero(rate_prototype) + vectmp = vec(similar(u,axes(u))) + vectmp2 = vec(similar(u,axes(u))) + vectmp3 = vec(similar(u,axes(u))) + fsalfirst = zero(rate_prototype) + fsallast = zero(rate_prototype) + dT = similar(u,axes(u)) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J); - tmp = similar(u,indices(u)) + tmp = similar(u,axes(u)) tab = Rosenbrock23ConstantCache(uEltypeNoUnits,identity,identity) tf = DiffEqDiffTools.TimeGradientWrapper(f,uprev,p) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) - linsolve_tmp = similar(u,indices(u)) + linsolve_tmp = similar(u,axes(u)) linsolve_tmp_vec = vec(linsolve_tmp) linsolve = alg.linsolve(Val{:init},uf,u) @@ -102,26 +102,26 @@ function alg_cache(alg::Rosenbrock23,u,rate_prototype,uEltypeNoUnits,uBottomElty end function alg_cache(alg::Rosenbrock32,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - k₁ = zeros(rate_prototype) - k₂ = zeros(rate_prototype) - k₃ = zeros(rate_prototype) - du1 = zeros(rate_prototype) - du2 = zeros(rate_prototype) + k₁ = zero(rate_prototype) + k₂ = zero(rate_prototype) + k₃ = zero(rate_prototype) + du1 = zero(rate_prototype) + du2 = zero(rate_prototype) # f₀ = similar(u) fsalfirst - f₁ = zeros(rate_prototype) - vectmp = vec(similar(u,indices(u))) - vectmp2 = vec(similar(u,indices(u))) - vectmp3 = vec(similar(u,indices(u))) - fsalfirst = zeros(rate_prototype) - fsallast = zeros(rate_prototype) - dT = similar(u,indices(u)) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? - W = similar(J); tmp = similar(u,indices(u)) + f₁ = zero(rate_prototype) + vectmp = vec(similar(u,axes(u))) + vectmp2 = vec(similar(u,axes(u))) + vectmp3 = vec(similar(u,axes(u))) + fsalfirst = zero(rate_prototype) + fsallast = zero(rate_prototype) + dT = similar(u,axes(u)) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? + W = similar(J); tmp = similar(u,axes(u)) tab = Rosenbrock32ConstantCache(uEltypeNoUnits,identity,identity) tf = DiffEqDiffTools.TimeGradientWrapper(f,uprev,p) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) - linsolve_tmp = similar(u,indices(u)) + linsolve_tmp = similar(u,axes(u)) linsolve_tmp_vec = vec(linsolve_tmp) linsolve = alg.linsolve(Val{:init},uf,u) grad_config = build_grad_config(alg,f,tf,du1,t) @@ -209,23 +209,23 @@ jac_cache(c::Rosenbrock33Cache) = (c.J,c.W) vecu_cache(c::Rosenbrock33Cache) = (c.vectmp,c.vectmp2,c.vectmp3) function alg_cache(alg::ROS3P,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du = zeros(rate_prototype) - du1 = zeros(rate_prototype) - du2 = zeros(rate_prototype) - vectmp = vec(similar(u,indices(u))) - vectmp2 = vec(similar(u,indices(u))) - vectmp3 = vec(similar(u,indices(u))) - vectmp4 = vec(similar(u,indices(u))) - fsalfirst = zeros(rate_prototype) - fsallast = zeros(rate_prototype) - dT = similar(u,indices(u)) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du = zero(rate_prototype) + du1 = zero(rate_prototype) + du2 = zero(rate_prototype) + vectmp = vec(similar(u,axes(u))) + vectmp2 = vec(similar(u,axes(u))) + vectmp3 = vec(similar(u,axes(u))) + vectmp4 = vec(similar(u,axes(u))) + fsalfirst = zero(rate_prototype) + fsallast = zero(rate_prototype) + dT = similar(u,axes(u)) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J); - tmp = similar(u,indices(u)) + tmp = similar(u,axes(u)) tab = ROS3PConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) tf = DiffEqDiffTools.TimeGradientWrapper(f,uprev,p) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) - linsolve_tmp = similar(u,indices(u)) + linsolve_tmp = similar(u,axes(u)) linsolve_tmp_vec = vec(linsolve_tmp) linsolve = alg.linsolve(Val{:init},uf,u) grad_config = build_grad_config(alg,f,tf,du1,t) @@ -273,24 +273,24 @@ jac_cache(c::Rosenbrock34Cache) = (c.J,c.W) vecu_cache(c::Rosenbrock34Cache) = (c.vectmp,c.vectmp2,c.vectmp3) function alg_cache(alg::Rodas3,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du = zeros(rate_prototype) - du1 = zeros(rate_prototype) - du2 = zeros(rate_prototype) - vectmp = vec(similar(u,indices(u))) - vectmp2 = vec(similar(u,indices(u))) - vectmp3 = vec(similar(u,indices(u))) - vectmp4 = vec(similar(u,indices(u))) - fsalfirst = zeros(rate_prototype) - fsallast = zeros(rate_prototype) - dT = similar(u,indices(u)) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du = zero(rate_prototype) + du1 = zero(rate_prototype) + du2 = zero(rate_prototype) + vectmp = vec(similar(u,axes(u))) + vectmp2 = vec(similar(u,axes(u))) + vectmp3 = vec(similar(u,axes(u))) + vectmp4 = vec(similar(u,axes(u))) + fsalfirst = zero(rate_prototype) + fsallast = zero(rate_prototype) + dT = similar(u,axes(u)) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J); - tmp = similar(u,indices(u)) + tmp = similar(u,axes(u)) tab = Rodas3ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) tf = DiffEqDiffTools.TimeGradientWrapper(f,uprev,p) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) - linsolve_tmp = similar(u,indices(u)) + linsolve_tmp = similar(u,axes(u)) linsolve_tmp_vec = vec(linsolve_tmp) linsolve = alg.linsolve(Val{:init},uf,u) grad_config = build_grad_config(alg,f,tf,du1,t) @@ -353,24 +353,24 @@ jac_cache(c::Rosenbrock4Cache) = (c.J,c.W) vecu_cache(c::Rosenbrock4Cache) = (c.vectmp,c.vectmp2,c.vectmp3) function alg_cache(alg::RosShamp4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du = zeros(rate_prototype) - du1 = zeros(rate_prototype) - du2 = zeros(rate_prototype) - vectmp = vec(similar(u,indices(u))) - vectmp2 = vec(similar(u,indices(u))) - vectmp3 = vec(similar(u,indices(u))) - vectmp4 = vec(similar(u,indices(u))) - fsalfirst = zeros(rate_prototype) - fsallast = zeros(rate_prototype) - dT = similar(u,indices(u)) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du = zero(rate_prototype) + du1 = zero(rate_prototype) + du2 = zero(rate_prototype) + vectmp = vec(similar(u,axes(u))) + vectmp2 = vec(similar(u,axes(u))) + vectmp3 = vec(similar(u,axes(u))) + vectmp4 = vec(similar(u,axes(u))) + fsalfirst = zero(rate_prototype) + fsallast = zero(rate_prototype) + dT = similar(u,axes(u)) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J); - tmp = similar(u,indices(u)) + tmp = similar(u,axes(u)) tab = RosShamp4ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) tf = DiffEqDiffTools.TimeGradientWrapper(f,uprev,p) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) - linsolve_tmp = similar(u,indices(u)) + linsolve_tmp = similar(u,axes(u)) linsolve_tmp_vec = vec(linsolve_tmp) linsolve = alg.linsolve(Val{:init},uf,u) grad_config = build_grad_config(alg,f,tf,du1,t) @@ -387,24 +387,24 @@ function alg_cache(alg::RosShamp4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeN end function alg_cache(alg::Veldd4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du = zeros(rate_prototype) - du1 = zeros(rate_prototype) - du2 = zeros(rate_prototype) - vectmp = vec(similar(u,indices(u))) - vectmp2 = vec(similar(u,indices(u))) - vectmp3 = vec(similar(u,indices(u))) - vectmp4 = vec(similar(u,indices(u))) - fsalfirst = zeros(rate_prototype) - fsallast = zeros(rate_prototype) - dT = similar(u,indices(u)) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du = zero(rate_prototype) + du1 = zero(rate_prototype) + du2 = zero(rate_prototype) + vectmp = vec(similar(u,axes(u))) + vectmp2 = vec(similar(u,axes(u))) + vectmp3 = vec(similar(u,axes(u))) + vectmp4 = vec(similar(u,axes(u))) + fsalfirst = zero(rate_prototype) + fsallast = zero(rate_prototype) + dT = similar(u,axes(u)) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J); - tmp = similar(u,indices(u)) + tmp = similar(u,axes(u)) tab = Veldd4ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) tf = DiffEqDiffTools.TimeGradientWrapper(f,uprev,p) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) - linsolve_tmp = similar(u,indices(u)) + linsolve_tmp = similar(u,axes(u)) linsolve_tmp_vec = vec(linsolve_tmp) linsolve = alg.linsolve(Val{:init},uf,u) grad_config = build_grad_config(alg,f,tf,du1,t) @@ -421,24 +421,24 @@ function alg_cache(alg::Veldd4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUn end function alg_cache(alg::Velds4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du = zeros(rate_prototype) - du1 = zeros(rate_prototype) - du2 = zeros(rate_prototype) - vectmp = vec(similar(u,indices(u))) - vectmp2 = vec(similar(u,indices(u))) - vectmp3 = vec(similar(u,indices(u))) - vectmp4 = vec(similar(u,indices(u))) - fsalfirst = zeros(rate_prototype) - fsallast = zeros(rate_prototype) - dT = similar(u,indices(u)) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du = zero(rate_prototype) + du1 = zero(rate_prototype) + du2 = zero(rate_prototype) + vectmp = vec(similar(u,axes(u))) + vectmp2 = vec(similar(u,axes(u))) + vectmp3 = vec(similar(u,axes(u))) + vectmp4 = vec(similar(u,axes(u))) + fsalfirst = zero(rate_prototype) + fsallast = zero(rate_prototype) + dT = similar(u,axes(u)) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J); - tmp = similar(u,indices(u)) + tmp = similar(u,axes(u)) tab = Velds4ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) tf = DiffEqDiffTools.TimeGradientWrapper(f,uprev,p) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) - linsolve_tmp = similar(u,indices(u)) + linsolve_tmp = similar(u,axes(u)) linsolve_tmp_vec = vec(linsolve_tmp) linsolve = alg.linsolve(Val{:init},uf,u) grad_config = build_grad_config(alg,f,tf,du1,t) @@ -455,24 +455,24 @@ function alg_cache(alg::Velds4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUn end function alg_cache(alg::GRK4T,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du = zeros(rate_prototype) - du1 = zeros(rate_prototype) - du2 = zeros(rate_prototype) - vectmp = vec(similar(u,indices(u))) - vectmp2 = vec(similar(u,indices(u))) - vectmp3 = vec(similar(u,indices(u))) - vectmp4 = vec(similar(u,indices(u))) - fsalfirst = zeros(rate_prototype) - fsallast = zeros(rate_prototype) - dT = similar(u,indices(u)) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du = zero(rate_prototype) + du1 = zero(rate_prototype) + du2 = zero(rate_prototype) + vectmp = vec(similar(u,axes(u))) + vectmp2 = vec(similar(u,axes(u))) + vectmp3 = vec(similar(u,axes(u))) + vectmp4 = vec(similar(u,axes(u))) + fsalfirst = zero(rate_prototype) + fsallast = zero(rate_prototype) + dT = similar(u,axes(u)) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J); - tmp = similar(u,indices(u)) + tmp = similar(u,axes(u)) tab = GRK4TConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) tf = DiffEqDiffTools.TimeGradientWrapper(f,uprev,p) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) - linsolve_tmp = similar(u,indices(u)) + linsolve_tmp = similar(u,axes(u)) linsolve_tmp_vec = vec(linsolve_tmp) linsolve = alg.linsolve(Val{:init},uf,u) grad_config = build_grad_config(alg,f,tf,du1,t) @@ -489,24 +489,24 @@ function alg_cache(alg::GRK4T,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUni end function alg_cache(alg::GRK4A,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du = zeros(rate_prototype) - du1 = zeros(rate_prototype) - du2 = zeros(rate_prototype) - vectmp = vec(similar(u,indices(u))) - vectmp2 = vec(similar(u,indices(u))) - vectmp3 = vec(similar(u,indices(u))) - vectmp4 = vec(similar(u,indices(u))) - fsalfirst = zeros(rate_prototype) - fsallast = zeros(rate_prototype) - dT = similar(u,indices(u)) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du = zero(rate_prototype) + du1 = zero(rate_prototype) + du2 = zero(rate_prototype) + vectmp = vec(similar(u,axes(u))) + vectmp2 = vec(similar(u,axes(u))) + vectmp3 = vec(similar(u,axes(u))) + vectmp4 = vec(similar(u,axes(u))) + fsalfirst = zero(rate_prototype) + fsallast = zero(rate_prototype) + dT = similar(u,axes(u)) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J); - tmp = similar(u,indices(u)) + tmp = similar(u,axes(u)) tab = GRK4AConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) tf = DiffEqDiffTools.TimeGradientWrapper(f,uprev,p) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) - linsolve_tmp = similar(u,indices(u)) + linsolve_tmp = similar(u,axes(u)) linsolve_tmp_vec = vec(linsolve_tmp) linsolve = alg.linsolve(Val{:init},uf,u) grad_config = build_grad_config(alg,f,tf,du1,t) @@ -523,24 +523,24 @@ function alg_cache(alg::GRK4A,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUni end function alg_cache(alg::Ros4LStab,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du = zeros(rate_prototype) - du1 = zeros(rate_prototype) - du2 = zeros(rate_prototype) - vectmp = vec(similar(u,indices(u))) - vectmp2 = vec(similar(u,indices(u))) - vectmp3 = vec(similar(u,indices(u))) - vectmp4 = vec(similar(u,indices(u))) - fsalfirst = zeros(rate_prototype) - fsallast = zeros(rate_prototype) - dT = similar(u,indices(u)) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du = zero(rate_prototype) + du1 = zero(rate_prototype) + du2 = zero(rate_prototype) + vectmp = vec(similar(u,axes(u))) + vectmp2 = vec(similar(u,axes(u))) + vectmp3 = vec(similar(u,axes(u))) + vectmp4 = vec(similar(u,axes(u))) + fsalfirst = zero(rate_prototype) + fsallast = zero(rate_prototype) + dT = similar(u,axes(u)) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J); - tmp = similar(u,indices(u)) + tmp = similar(u,axes(u)) tab = Ros4LStabConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) tf = DiffEqDiffTools.TimeGradientWrapper(f,uprev,p) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) - linsolve_tmp = similar(u,indices(u)) + linsolve_tmp = similar(u,axes(u)) linsolve_tmp_vec = vec(linsolve_tmp) linsolve = alg.linsolve(Val{:init},uf,u) grad_config = build_grad_config(alg,f,tf,du1,t) @@ -602,28 +602,28 @@ jac_cache(c::Rodas4Cache) = (c.J,c.W) vecu_cache(c::Rodas4Cache) = (c.vectmp,c.vectmp2,c.vectmp3) function alg_cache(alg::Rodas4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - dense1 = zeros(rate_prototype) - dense2 = zeros(rate_prototype) - du = zeros(rate_prototype) - du1 = zeros(rate_prototype) - du2 = zeros(rate_prototype) - vectmp = vec(similar(u,indices(u))) - vectmp2 = vec(similar(u,indices(u))) - vectmp3 = vec(similar(u,indices(u))) - vectmp4 = vec(similar(u,indices(u))) - vectmp5 = vec(similar(u,indices(u))) - vectmp6 = vec(similar(u,indices(u))) - fsalfirst = zeros(rate_prototype) - fsallast = zeros(rate_prototype) - dT = similar(u,indices(u)) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + dense1 = zero(rate_prototype) + dense2 = zero(rate_prototype) + du = zero(rate_prototype) + du1 = zero(rate_prototype) + du2 = zero(rate_prototype) + vectmp = vec(similar(u,axes(u))) + vectmp2 = vec(similar(u,axes(u))) + vectmp3 = vec(similar(u,axes(u))) + vectmp4 = vec(similar(u,axes(u))) + vectmp5 = vec(similar(u,axes(u))) + vectmp6 = vec(similar(u,axes(u))) + fsalfirst = zero(rate_prototype) + fsallast = zero(rate_prototype) + dT = similar(u,axes(u)) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J); - tmp = similar(u,indices(u)) + tmp = similar(u,axes(u)) tab = Rodas4ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) tf = DiffEqDiffTools.TimeGradientWrapper(f,uprev,p) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) - linsolve_tmp = similar(u,indices(u)) + linsolve_tmp = similar(u,axes(u)) linsolve_tmp_vec = vec(linsolve_tmp) linsolve = alg.linsolve(Val{:init},uf,u) grad_config = build_grad_config(alg,f,tf,du1,t) @@ -641,28 +641,28 @@ function alg_cache(alg::Rodas4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUn end function alg_cache(alg::Rodas42,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - dense1 = zeros(rate_prototype) - dense2 = zeros(rate_prototype) - du = zeros(rate_prototype) - du1 = zeros(rate_prototype) - du2 = zeros(rate_prototype) - vectmp = vec(similar(u,indices(u))) - vectmp2 = vec(similar(u,indices(u))) - vectmp3 = vec(similar(u,indices(u))) - vectmp4 = vec(similar(u,indices(u))) - vectmp5 = vec(similar(u,indices(u))) - vectmp6 = vec(similar(u,indices(u))) - fsalfirst = zeros(rate_prototype) - fsallast = zeros(rate_prototype) - dT = similar(u,indices(u)) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + dense1 = zero(rate_prototype) + dense2 = zero(rate_prototype) + du = zero(rate_prototype) + du1 = zero(rate_prototype) + du2 = zero(rate_prototype) + vectmp = vec(similar(u,axes(u))) + vectmp2 = vec(similar(u,axes(u))) + vectmp3 = vec(similar(u,axes(u))) + vectmp4 = vec(similar(u,axes(u))) + vectmp5 = vec(similar(u,axes(u))) + vectmp6 = vec(similar(u,axes(u))) + fsalfirst = zero(rate_prototype) + fsallast = zero(rate_prototype) + dT = similar(u,axes(u)) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J); - tmp = similar(u,indices(u)) + tmp = similar(u,axes(u)) tab = Rodas42ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) tf = DiffEqDiffTools.TimeGradientWrapper(f,uprev,p) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) - linsolve_tmp = similar(u,indices(u)) + linsolve_tmp = similar(u,axes(u)) linsolve_tmp_vec = vec(linsolve_tmp) linsolve = alg.linsolve(Val{:init},uf,u) grad_config = build_grad_config(alg,f,tf,du1,t) @@ -680,28 +680,28 @@ function alg_cache(alg::Rodas42,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoU end function alg_cache(alg::Rodas4P,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - dense1 = zeros(rate_prototype) - dense2 = zeros(rate_prototype) - du = zeros(rate_prototype) - du1 = zeros(rate_prototype) - du2 = zeros(rate_prototype) - vectmp = vec(similar(u,indices(u))) - vectmp2 = vec(similar(u,indices(u))) - vectmp3 = vec(similar(u,indices(u))) - vectmp4 = vec(similar(u,indices(u))) - vectmp5 = vec(similar(u,indices(u))) - vectmp6 = vec(similar(u,indices(u))) - fsalfirst = zeros(rate_prototype) - fsallast = zeros(rate_prototype) - dT = similar(u,indices(u)) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + dense1 = zero(rate_prototype) + dense2 = zero(rate_prototype) + du = zero(rate_prototype) + du1 = zero(rate_prototype) + du2 = zero(rate_prototype) + vectmp = vec(similar(u,axes(u))) + vectmp2 = vec(similar(u,axes(u))) + vectmp3 = vec(similar(u,axes(u))) + vectmp4 = vec(similar(u,axes(u))) + vectmp5 = vec(similar(u,axes(u))) + vectmp6 = vec(similar(u,axes(u))) + fsalfirst = zero(rate_prototype) + fsallast = zero(rate_prototype) + dT = similar(u,axes(u)) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J); - tmp = similar(u,indices(u)) + tmp = similar(u,axes(u)) tab = Rodas4PConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) tf = DiffEqDiffTools.TimeGradientWrapper(f,uprev,p) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) - linsolve_tmp = similar(u,indices(u)) + linsolve_tmp = similar(u,axes(u)) linsolve_tmp_vec = vec(linsolve_tmp) linsolve = alg.linsolve(Val{:init},uf,u) grad_config = build_grad_config(alg,f,tf,du1,t) @@ -766,30 +766,30 @@ jac_cache(c::Rosenbrock5Cache) = (c.J,c.W) vecu_cache(c::Rosenbrock5Cache) = (c.vectmp,c.vectmp2,c.vectmp3) function alg_cache(alg::Rodas5,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - dense1 = zeros(rate_prototype) - dense2 = zeros(rate_prototype) - du = zeros(rate_prototype) - du1 = zeros(rate_prototype) - du2 = zeros(rate_prototype) - vectmp = vec(similar(u,indices(u))) - vectmp2 = vec(similar(u,indices(u))) - vectmp3 = vec(similar(u,indices(u))) - vectmp4 = vec(similar(u,indices(u))) - vectmp5 = vec(similar(u,indices(u))) - vectmp6 = vec(similar(u,indices(u))) - vectmp7 = vec(similar(u,indices(u))) - vectmp8 = vec(similar(u,indices(u))) - fsalfirst = zeros(rate_prototype) - fsallast = zeros(rate_prototype) - dT = similar(u,indices(u)) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + dense1 = zero(rate_prototype) + dense2 = zero(rate_prototype) + du = zero(rate_prototype) + du1 = zero(rate_prototype) + du2 = zero(rate_prototype) + vectmp = vec(similar(u,axes(u))) + vectmp2 = vec(similar(u,axes(u))) + vectmp3 = vec(similar(u,axes(u))) + vectmp4 = vec(similar(u,axes(u))) + vectmp5 = vec(similar(u,axes(u))) + vectmp6 = vec(similar(u,axes(u))) + vectmp7 = vec(similar(u,axes(u))) + vectmp8 = vec(similar(u,axes(u))) + fsalfirst = zero(rate_prototype) + fsallast = zero(rate_prototype) + dT = similar(u,axes(u)) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J); - tmp = similar(u,indices(u)) + tmp = similar(u,axes(u)) tab = Rodas5ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) tf = DiffEqDiffTools.TimeGradientWrapper(f,uprev,p) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) - linsolve_tmp = similar(u,indices(u)) + linsolve_tmp = similar(u,axes(u)) linsolve_tmp_vec = vec(linsolve_tmp) linsolve = alg.linsolve(Val{:init},uf,u) grad_config = build_grad_config(alg,f,tf,du1,t) diff --git a/src/caches/sdirk_caches.jl b/src/caches/sdirk_caches.jl index 542565cd9d..1b102b1215 100644 --- a/src/caches/sdirk_caches.jl +++ b/src/caches/sdirk_caches.jl @@ -27,14 +27,14 @@ du_cache(c::ImplicitEulerCache) = (c.k,c.fsalfirst) function alg_cache(alg::ImplicitEuler,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du1 = zeros(rate_prototype) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du1 = zero(rate_prototype) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J) - z = similar(u,indices(u)) - dz = similar(u,indices(u)); tmp = similar(u,indices(u)); b = similar(u,indices(u)) - fsalfirst = zeros(rate_prototype) - k = zeros(rate_prototype) - atmp = similar(u,uEltypeNoUnits,indices(u)) + z = similar(u,axes(u)) + dz = similar(u,axes(u)); tmp = similar(u,axes(u)); b = similar(u,axes(u)) + fsalfirst = zero(rate_prototype) + k = zero(rate_prototype) + atmp = similar(u,uEltypeNoUnits,axes(u)) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) linsolve = alg.linsolve(Val{:init},uf,u) @@ -137,14 +137,14 @@ du_cache(c::ImplicitMidpointCache) = (c.k,c.fsalfirst) function alg_cache(alg::ImplicitMidpoint,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du1 = zeros(rate_prototype) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du1 = zero(rate_prototype) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J) - z = similar(u,indices(u)) - dz = similar(u,indices(u)) - tmp = similar(u); b = similar(u,indices(u)) - fsalfirst = zeros(rate_prototype) - k = zeros(rate_prototype) + z = similar(u,axes(u)) + dz = similar(u,axes(u)) + tmp = similar(u); b = similar(u,axes(u)) + fsalfirst = zero(rate_prototype) + k = zero(rate_prototype) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) linsolve = alg.linsolve(Val{:init},uf,u) @@ -230,15 +230,15 @@ du_cache(c::TrapezoidCache) = (c.k,c.fsalfirst) function alg_cache(alg::Trapezoid,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du1 = zeros(rate_prototype) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du1 = zero(rate_prototype) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J) - z = similar(u,indices(u)) - dz = similar(u,indices(u)) - tmp = similar(u); b = similar(u,indices(u)); - atmp = similar(u,uEltypeNoUnits,indices(u)) - fsalfirst = zeros(rate_prototype) - k = zeros(rate_prototype) + z = similar(u,axes(u)) + dz = similar(u,axes(u)) + tmp = similar(u); b = similar(u,axes(u)); + atmp = similar(u,uEltypeNoUnits,axes(u)) + fsalfirst = zero(rate_prototype) + k = zero(rate_prototype) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) linsolve = alg.linsolve(Val{:init},uf,u) @@ -326,16 +326,16 @@ du_cache(c::TRBDF2Cache) = (c.k,c.fsalfirst) function alg_cache(alg::TRBDF2,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du1 = zeros(rate_prototype) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du1 = zero(rate_prototype) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J) - zprev = similar(u,indices(u)); - zᵧ = similar(u,indices(u)); z = similar(u,indices(u)) - dz = similar(u,indices(u)) - fsalfirst = zeros(rate_prototype) - k = zeros(rate_prototype) - tmp = similar(u); b = similar(u,indices(u)); - atmp = similar(u,uEltypeNoUnits,indices(u)) + zprev = similar(u,axes(u)); + zᵧ = similar(u,axes(u)); z = similar(u,axes(u)) + dz = similar(u,axes(u)) + fsalfirst = zero(rate_prototype) + k = zero(rate_prototype) + tmp = similar(u); b = similar(u,axes(u)); + atmp = similar(u,uEltypeNoUnits,axes(u)) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) linsolve = alg.linsolve(Val{:init},uf,u) @@ -420,16 +420,16 @@ du_cache(c::SDIRK2Cache) = (c.k,c.fsalfirst) function alg_cache(alg::SDIRK2,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du1 = zeros(rate_prototype) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du1 = zero(rate_prototype) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J) - z₁ = similar(u,indices(u)); - z₂ = similar(u,indices(u)) - dz = similar(u,indices(u)) - fsalfirst = zeros(rate_prototype) - k = zeros(rate_prototype) - tmp = similar(u); b = similar(u,indices(u)); - atmp = similar(u,uEltypeNoUnits,indices(u)) + z₁ = similar(u,axes(u)); + z₂ = similar(u,axes(u)) + dz = similar(u,axes(u)) + fsalfirst = zero(rate_prototype) + k = zero(rate_prototype) + tmp = similar(u); b = similar(u,axes(u)); + atmp = similar(u,uEltypeNoUnits,axes(u)) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) linsolve = alg.linsolve(Val{:init},uf,u) @@ -513,16 +513,16 @@ du_cache(c::SSPSDIRK2Cache) = (c.k,c.fsalfirst) function alg_cache(alg::SSPSDIRK2,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du1 = zeros(rate_prototype) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du1 = zero(rate_prototype) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J) - z₁ = similar(u,indices(u)); - z₂ = similar(u,indices(u)) - dz = similar(u,indices(u)) - fsalfirst = zeros(rate_prototype) - k = zeros(rate_prototype) - tmp = similar(u); b = similar(u,indices(u)); - atmp = similar(u,uEltypeNoUnits,indices(u)) + z₁ = similar(u,axes(u)); + z₂ = similar(u,axes(u)) + dz = similar(u,axes(u)) + fsalfirst = zero(rate_prototype) + k = zero(rate_prototype) + tmp = similar(u); b = similar(u,axes(u)); + atmp = similar(u,uEltypeNoUnits,axes(u)) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) linsolve = alg.linsolve(Val{:init},uf,u) @@ -611,16 +611,16 @@ du_cache(c::Kvaerno3Cache) = (c.k,c.fsalfirst) function alg_cache(alg::Kvaerno3,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du1 = zeros(rate_prototype) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du1 = zero(rate_prototype) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J) - z₁ = similar(u,indices(u)); z₂ = similar(u,indices(u)); - z₃ = similar(u,indices(u)); z₄ = similar(u,indices(u)) - dz = similar(u,indices(u)) - fsalfirst = zeros(rate_prototype) - k = zeros(rate_prototype) - tmp = similar(u); b = similar(u,indices(u)); - atmp = similar(u,uEltypeNoUnits,indices(u)) + z₁ = similar(u,axes(u)); z₂ = similar(u,axes(u)); + z₃ = similar(u,axes(u)); z₄ = similar(u,axes(u)) + dz = similar(u,axes(u)) + fsalfirst = zero(rate_prototype) + k = zero(rate_prototype) + tmp = similar(u); b = similar(u,axes(u)); + atmp = similar(u,uEltypeNoUnits,axes(u)) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) linsolve = alg.linsolve(Val{:init},uf,u) @@ -712,17 +712,17 @@ du_cache(c::Cash4Cache) = (c.k,c.fsalfirst) function alg_cache(alg::Cash4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du1 = zeros(rate_prototype) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du1 = zero(rate_prototype) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J) - z₁ = similar(u,indices(u)); z₂ = similar(u,indices(u)); - z₃ = similar(u,indices(u)); z₄ = similar(u,indices(u)) - z₅ = similar(u,indices(u)) - dz = similar(u,indices(u)) - fsalfirst = zeros(rate_prototype) - k = zeros(rate_prototype) - tmp = similar(u); b = similar(u,indices(u)); - atmp = similar(u,uEltypeNoUnits,indices(u)) + z₁ = similar(u,axes(u)); z₂ = similar(u,axes(u)); + z₃ = similar(u,axes(u)); z₄ = similar(u,axes(u)) + z₅ = similar(u,axes(u)) + dz = similar(u,axes(u)) + fsalfirst = zero(rate_prototype) + k = zero(rate_prototype) + tmp = similar(u); b = similar(u,axes(u)); + atmp = similar(u,uEltypeNoUnits,axes(u)) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) linsolve = alg.linsolve(Val{:init},uf,u) @@ -818,17 +818,17 @@ du_cache(c::Hairer4Cache) = (c.k,c.fsalfirst) function alg_cache(alg::Union{Hairer4,Hairer42},u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits, tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - du1 = zeros(rate_prototype) - J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype? + du1 = zero(rate_prototype) + J = fill(zero(uEltypeNoUnits),length(u),length(u)) # uEltype? W = similar(J) - z₁ = similar(u,indices(u)); z₂ = similar(u,indices(u)); - z₃ = similar(u,indices(u)); z₄ = similar(u,indices(u)) - z₅ = similar(u,indices(u)) - dz = similar(u,indices(u)) - fsalfirst = zeros(rate_prototype) - k = zeros(rate_prototype) - tmp = similar(u); b = similar(u,indices(u)); - atmp = similar(u,uEltypeNoUnits,indices(u)) + z₁ = similar(u,axes(u)); z₂ = similar(u,axes(u)); + z₃ = similar(u,axes(u)); z₄ = similar(u,axes(u)) + z₅ = similar(u,axes(u)) + dz = similar(u,axes(u)) + fsalfirst = zero(rate_prototype) + k = zero(rate_prototype) + tmp = similar(u); b = similar(u,axes(u)); + atmp = similar(u,uEltypeNoUnits,axes(u)) uf = DiffEqDiffTools.UJacobianWrapper(f,t,p) linsolve = alg.linsolve(Val{:init},uf,u) diff --git a/src/caches/ssprk_caches.jl b/src/caches/ssprk_caches.jl index 23ecfe4d9e..1876109cbb 100644 --- a/src/caches/ssprk_caches.jl +++ b/src/caches/ssprk_caches.jl @@ -15,8 +15,8 @@ struct SSPRK22ConstantCache <: OrdinaryDiffEqConstantCache end function alg_cache(alg::SSPRK22,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) SSPRK22Cache(u,uprev,k,tmp,fsalfirst,alg.stage_limiter!,alg.step_limiter!) end @@ -40,8 +40,8 @@ struct SSPRK33ConstantCache <: OrdinaryDiffEqConstantCache end function alg_cache(alg::SSPRK33,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) SSPRK33Cache(u,uprev,k,tmp,fsalfirst,alg.stage_limiter!,alg.step_limiter!) end @@ -96,8 +96,8 @@ end function alg_cache(alg::SSPRK53,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) α30 = 0.355909775063327 α32 = 0.644090224936674 α40 = 0.367933791638137 @@ -189,8 +189,8 @@ end function alg_cache(alg::SSPRK63,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) u₂ = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) α40 = 0.476769811285196 α41 = 0.098511733286064 α43 = 0.424718455428740 @@ -292,8 +292,8 @@ end function alg_cache(alg::SSPRK73,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) u₁ = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) α40 = 0.184962588071072 α43 = 0.815037411928928 α50 = 0.180718656570380 @@ -411,8 +411,8 @@ function alg_cache(alg::SSPRK83,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoU tmp = similar(u) u₂ = similar(u) u₃ = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) α50 = 0.421366967085359 α51 = 0.005949401107575 α54 = 0.572683631807067 @@ -487,10 +487,10 @@ struct SSPRK432ConstantCache <: OrdinaryDiffEqConstantCache end function alg_cache(alg::SSPRK432,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) - utilde = similar(u,indices(u)) - atmp = similar(u,uEltypeNoUnits,indices(u)) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) + utilde = similar(u,axes(u)) + atmp = similar(u,uEltypeNoUnits,axes(u)) SSPRK432Cache(u,uprev,k,tmp,fsalfirst,utilde,atmp,alg.stage_limiter!,alg.step_limiter!) end @@ -516,10 +516,10 @@ struct SSPRK932ConstantCache <: OrdinaryDiffEqConstantCache end function alg_cache(alg::SSPRK932,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) - utilde = similar(u,indices(u)) - atmp = similar(u,uEltypeNoUnits,indices(u)) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) + utilde = similar(u,axes(u)) + atmp = similar(u,uEltypeNoUnits,axes(u)) SSPRK932Cache(u,uprev,k,tmp,fsalfirst,utilde,atmp,alg.stage_limiter!,alg.step_limiter!) end @@ -587,9 +587,9 @@ function alg_cache(alg::SSPRK54,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoU u₂ = similar(u) u₃ = similar(u) tmp = similar(u) - k = zeros(rate_prototype) - k₃ = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + k₃ = zero(rate_prototype) + fsalfirst = zero(rate_prototype) β10 = 0.391752226571890 α20 = 0.444370493651235 α21 = 0.555629506348765 @@ -655,9 +655,9 @@ struct SSPRK104ConstantCache <: OrdinaryDiffEqConstantCache end function alg_cache(alg::SSPRK104,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - k₄ = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + k₄ = zero(rate_prototype) + fsalfirst = zero(rate_prototype) SSPRK104Cache(u,uprev,k,k₄,tmp,fsalfirst,alg.stage_limiter!,alg.step_limiter!) end diff --git a/src/caches/symplectic_caches.jl b/src/caches/symplectic_caches.jl index 16d16c6e17..b0cbc71556 100644 --- a/src/caches/symplectic_caches.jl +++ b/src/caches/symplectic_caches.jl @@ -7,7 +7,7 @@ struct SymplecticEulerCache{uType,rateType} <: OrdinaryDiffEqMutableCache end function alg_cache(alg::SymplecticEuler,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - SymplecticEulerCache(u,uprev,similar(u),zeros(rate_prototype),zeros(rate_prototype)) + SymplecticEulerCache(u,uprev,similar(u),zero(rate_prototype),zero(rate_prototype)) end u_cache(c::SymplecticEulerCache) = () @@ -34,9 +34,9 @@ struct VelocityVerletConstantCache{uEltypeNoUnits} <: OrdinaryDiffEqConstantCach end function alg_cache(alg::VelocityVerlet,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) - tmp = zeros(rate_prototype) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + tmp = zero(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) half = uEltypeNoUnits(1//2) VelocityVerletCache(u,uprev,k,tmp,fsalfirst,half) end @@ -57,8 +57,8 @@ du_cache(c::Symplectic2Cache) = (c.k,c.fsalfirst) function alg_cache(alg::VerletLeapfrog,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) tab = VerletLeapfrogConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) Symplectic2Cache(u,uprev,k,tmp,fsalfirst,tab) end @@ -68,8 +68,8 @@ alg_cache(alg::VerletLeapfrog,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUni function alg_cache(alg::PseudoVerletLeapfrog,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) tab = PseudoVerletLeapfrogConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) Symplectic2Cache(u,uprev,k,tmp,fsalfirst,tab) end @@ -79,8 +79,8 @@ PseudoVerletLeapfrogConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) function alg_cache(alg::McAte2,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) tab = McAte2ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) Symplectic2Cache(u,uprev,k,tmp,fsalfirst,tab) end @@ -102,8 +102,8 @@ du_cache(c::Symplectic3Cache) = (c.k,c.fsalfirst) function alg_cache(alg::Ruth3,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) tab = Ruth3ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) Symplectic3Cache(u,uprev,k,tmp,fsalfirst,tab) end @@ -113,8 +113,8 @@ Ruth3ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) function alg_cache(alg::McAte3,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) tab = McAte3ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) Symplectic3Cache(u,uprev,k,tmp,fsalfirst,tab) end @@ -136,8 +136,8 @@ du_cache(c::Symplectic4Cache) = (c.k,c.fsalfirst) function alg_cache(alg::McAte4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) tab = McAte4ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) Symplectic4Cache(u,uprev,k,tmp,fsalfirst,tab) end @@ -146,8 +146,8 @@ alg_cache(alg::McAte4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tType function alg_cache(alg::CandyRoz4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) tab = CandyRoz4ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) Symplectic4Cache(u,uprev,k,tmp,fsalfirst,tab) end @@ -168,8 +168,8 @@ du_cache(c::Symplectic45Cache) = (c.k,c.fsalfirst) function alg_cache(alg::CalvoSanz4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) tab = CalvoSanz4ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) Symplectic45Cache(u,uprev,k,tmp,fsalfirst,tab) end @@ -178,8 +178,8 @@ alg_cache(alg::CalvoSanz4,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,t function alg_cache(alg::McAte42,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) tab = McAte42ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) Symplectic45Cache(u,uprev,k,tmp,fsalfirst,tab) end @@ -200,8 +200,8 @@ du_cache(c::Symplectic5Cache) = (c.k,c.fsalfirst) function alg_cache(alg::McAte5,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) tab = McAte5ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) Symplectic5Cache(u,uprev,k,tmp,fsalfirst,tab) end @@ -222,8 +222,8 @@ du_cache(c::Symplectic6Cache) = (c.k,c.fsalfirst) function alg_cache(alg::Yoshida6,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) tab = Yoshida6ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) Symplectic6Cache(u,uprev,k,tmp,fsalfirst,tab) end @@ -244,8 +244,8 @@ du_cache(c::Symplectic62Cache) = (c.k,c.fsalfirst) function alg_cache(alg::KahanLi6,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) tab = KahanLi6ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) Symplectic62Cache(u,uprev,k,tmp,fsalfirst,tab) end @@ -266,8 +266,8 @@ du_cache(c::McAte8Cache) = (c.k,c.fsalfirst) function alg_cache(alg::McAte8,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) tab = McAte8ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) McAte8Cache(u,uprev,k,tmp,fsalfirst,tab) end @@ -288,8 +288,8 @@ du_cache(c::KahanLi8Cache) = (c.k,c.fsalfirst) function alg_cache(alg::KahanLi8,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) tab = KahanLi8ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) KahanLi8Cache(u,uprev,k,tmp,fsalfirst,tab) end @@ -310,8 +310,8 @@ du_cache(c::SofSpa10Cache) = (c.k,c.fsalfirst) function alg_cache(alg::SofSpa10,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tmp = similar(u) - k = zeros(rate_prototype) - fsalfirst = zeros(rate_prototype) + k = zero(rate_prototype) + fsalfirst = zero(rate_prototype) tab = SofSpa10ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) SofSpa10Cache(u,uprev,k,tmp,fsalfirst,tab) end diff --git a/src/caches/verner_caches.jl b/src/caches/verner_caches.jl index d172c14192..c4fc43bdcf 100644 --- a/src/caches/verner_caches.jl +++ b/src/caches/verner_caches.jl @@ -21,11 +21,11 @@ du_cache(c::Vern6Cache) = (c.k1,c.k2,c.k3,c.k4,c.k5,c.k6,c.k7,c.k8,c.k9) function alg_cache(alg::Vern6,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tab = Vern6ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype) - k2 = zeros(rate_prototype); k3 = zeros(rate_prototype); k4 = zeros(rate_prototype); - k5 = zeros(rate_prototype); k6 = zeros(rate_prototype); k7 = zeros(rate_prototype); - k8 = zeros(rate_prototype); k9 = zeros(rate_prototype); - utilde = similar(u,indices(u)); tmp = similar(u); atmp = similar(u,uEltypeNoUnits,indices(u)); + k1 = zero(rate_prototype) + k2 = zero(rate_prototype); k3 = zero(rate_prototype); k4 = zero(rate_prototype); + k5 = zero(rate_prototype); k6 = zero(rate_prototype); k7 = zero(rate_prototype); + k8 = zero(rate_prototype); k9 = zero(rate_prototype); + utilde = similar(u,axes(u)); tmp = similar(u); atmp = similar(u,uEltypeNoUnits,axes(u)); Vern6Cache(u,uprev,k1,k2,k3,k4,k5,k6,k7,k8,k9,utilde,tmp,atmp,tab) end @@ -55,10 +55,10 @@ du_cache(c::Vern7Cache) = (c.k1,c.k2,c.k3,c.k4,c.k5,c.k6,c.k7,c.k8,c.k9,c.k10) function alg_cache(alg::Vern7,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tab = Vern7ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype); k2 = zeros(rate_prototype); k3 = zeros(rate_prototype); k4 = zeros(rate_prototype); - k5 = zeros(rate_prototype); k6 = zeros(rate_prototype); k7 = zeros(rate_prototype); k8 = zeros(rate_prototype); - k9 = zeros(rate_prototype); k10 = zeros(rate_prototype); utilde = similar(u,indices(u)) - tmp = similar(u); atmp = similar(u,uEltypeNoUnits,indices(u)) + k1 = zero(rate_prototype); k2 = zero(rate_prototype); k3 = zero(rate_prototype); k4 = zero(rate_prototype); + k5 = zero(rate_prototype); k6 = zero(rate_prototype); k7 = zero(rate_prototype); k8 = zero(rate_prototype); + k9 = zero(rate_prototype); k10 = zero(rate_prototype); utilde = similar(u,axes(u)) + tmp = similar(u); atmp = similar(u,uEltypeNoUnits,axes(u)) Vern7Cache(u,uprev,k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,utilde,tmp,atmp,tab) end @@ -92,14 +92,14 @@ du_cache(c::Vern8Cache) = (c.k1,c.k2,c.k3,c.k4,c.k5,c.k6,c.k7,c.k8,c.k9,c.k10,c. function alg_cache(alg::Vern8,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tab = Vern8ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype); k2 = zeros(rate_prototype); k3 = zeros(rate_prototype); - k4 = zeros(rate_prototype); - k5 = zeros(rate_prototype); k6 = zeros(rate_prototype); k7 = zeros(rate_prototype); - k8 = zeros(rate_prototype); tmp = similar(u) - k9 = zeros(rate_prototype); k10 = zeros(rate_prototype); k11 = zeros(rate_prototype); - k12 = zeros(rate_prototype); k13 = zeros(rate_prototype) - utilde = similar(u,indices(u)) - atmp = similar(u,uEltypeNoUnits,indices(u)) + k1 = zero(rate_prototype); k2 = zero(rate_prototype); k3 = zero(rate_prototype); + k4 = zero(rate_prototype); + k5 = zero(rate_prototype); k6 = zero(rate_prototype); k7 = zero(rate_prototype); + k8 = zero(rate_prototype); tmp = similar(u) + k9 = zero(rate_prototype); k10 = zero(rate_prototype); k11 = zero(rate_prototype); + k12 = zero(rate_prototype); k13 = zero(rate_prototype) + utilde = similar(u,axes(u)) + atmp = similar(u,uEltypeNoUnits,axes(u)) Vern8Cache(u,uprev,k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,k11,k12,k13,utilde,tmp,atmp,tab) end @@ -135,15 +135,15 @@ du_cache(c::Vern9Cache) = (c.k1,c.k2,c.k3,c.k4,c.k5,c.k6,c.k7,c.k8,c.k9,c.k10,c. function alg_cache(alg::Vern9,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,p,calck,::Type{Val{true}}) tab = Vern9ConstantCache(real(uBottomEltypeNoUnits),real(tTypeNoUnits)) - k1 = zeros(rate_prototype); k2 = zeros(rate_prototype);k3 = zeros(rate_prototype); - k4 = zeros(rate_prototype); - k5 = zeros(rate_prototype); k6 = zeros(rate_prototype);k7 = zeros(rate_prototype); - k8 = zeros(rate_prototype); - k9 = zeros(rate_prototype); k10 = zeros(rate_prototype); k11 = zeros(rate_prototype); - k12 = zeros(rate_prototype); - k13 = zeros(rate_prototype); k14 = zeros(rate_prototype); k15 = zeros(rate_prototype); - k16 =zeros(rate_prototype); - utilde = similar(u,indices(u)); tmp = similar(u); atmp = similar(u,uEltypeNoUnits,indices(u)); + k1 = zero(rate_prototype); k2 = zero(rate_prototype);k3 = zero(rate_prototype); + k4 = zero(rate_prototype); + k5 = zero(rate_prototype); k6 = zero(rate_prototype);k7 = zero(rate_prototype); + k8 = zero(rate_prototype); + k9 = zero(rate_prototype); k10 = zero(rate_prototype); k11 = zero(rate_prototype); + k12 = zero(rate_prototype); + k13 = zero(rate_prototype); k14 = zero(rate_prototype); k15 = zero(rate_prototype); + k16 =zero(rate_prototype); + utilde = similar(u,axes(u)); tmp = similar(u); atmp = similar(u,uEltypeNoUnits,axes(u)); Vern9Cache(u,uprev,k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,k11,k12,k13,k14,k15,k16,utilde,tmp,atmp,tab) end diff --git a/src/callbacks.jl b/src/callbacks.jl index dc88da2387..6ffaa3c537 100644 --- a/src/callbacks.jl +++ b/src/callbacks.jl @@ -1,12 +1,12 @@ # Use Recursion to find the first callback for type-stability # Base Case: Only one callback -function find_first_continuous_callback(integrator, callback::AbstractContinuousCallback) +function find_first_continuous_callback(integrator, callback::DiffEqBase.AbstractContinuousCallback) (find_callback_time(integrator,callback)...,1,1) end # Starting Case: Compute on the first callback -function find_first_continuous_callback(integrator, callback::AbstractContinuousCallback, args...) +function find_first_continuous_callback(integrator, callback::DiffEqBase.AbstractContinuousCallback, args...) find_first_continuous_callback(integrator,find_callback_time(integrator,callback)...,1,1,args...) end @@ -32,10 +32,10 @@ end if callback.interp_points!=0 ode_addsteps!(integrator) end - Θs = linspace(typeof(integrator.t)(0),typeof(integrator.t)(1),callback.interp_points) + Θs = range(typeof(integrator.t)(0), stop=typeof(integrator.t)(1), length=callback.interp_points) interp_index = 0 # Check if the event occured - if typeof(callback.idxs) <: Void + if typeof(callback.idxs) <: Nothing previous_condition = callback.condition(integrator.uprev,integrator.tprev,integrator) elseif typeof(callback.idxs) <: Number previous_condition = callback.condition(integrator.uprev[callback.idxs],integrator.tprev,integrator) @@ -59,7 +59,7 @@ end end if typeof(integrator.cache) <: OrdinaryDiffEqMutableCache - if typeof(callback.idxs) <: Void + if typeof(callback.idxs) <: Nothing tmp = integrator.cache.tmp else !(typeof(callback.idxs) <: Number) tmp = @view integrator.cache.tmp[callback.idxs] @@ -85,7 +85,7 @@ end end prev_sign_index = 1 - if typeof(callback.idxs) <: Void + if typeof(callback.idxs) <: Nothing next_sign = sign(callback.condition(integrator.u,integrator.t,integrator)) elseif typeof(callback.idxs) <: Number next_sign = sign(callback.condition(integrator.u[callback.idxs],integrator.t,integrator)) @@ -93,12 +93,12 @@ end next_sign = sign(callback.condition(@view(integrator.u[callback.idxs]),integrator.t,integrator)) end - if ((prev_sign<0 && !(typeof(callback.affect!)<:Void)) || (prev_sign>0 && !(typeof(callback.affect_neg!)<:Void))) && prev_sign*next_sign<=0 + if ((prev_sign<0 && !(typeof(callback.affect!)<:Nothing)) || (prev_sign>0 && !(typeof(callback.affect_neg!)<:Nothing))) && prev_sign*next_sign<=0 event_occurred = true interp_index = callback.interp_points elseif callback.interp_points!=0 && !(typeof(integrator.alg) <: FunctionMap)# Use the interpolants for safety checking if typeof(integrator.cache) <: OrdinaryDiffEqMutableCache - if typeof(callback.idxs) <: Void + if typeof(callback.idxs) <: Nothing tmp = integrator.cache.tmp else !(typeof(callback.idxs) <: Number) tmp = @view integrator.cache.tmp[callback.idxs] @@ -111,8 +111,7 @@ end tmp = ode_interpolant(Θs[i],integrator,callback.idxs,Val{0}) end new_sign = callback.condition(tmp,integrator.tprev+integrator.dt*Θs[i],integrator) - - if ((prev_sign<0 && !(typeof(callback.affect!)<:Void)) || (prev_sign>0 && !(typeof(callback.affect_neg!)<:Void))) && prev_sign*new_sign<0 +if ((prev_sign<0 && !(typeof(callback.affect!)<:Nothing)) || (prev_sign>0 && !(typeof(callback.affect_neg!)<:Nothing))) && prev_sign*new_sign<0 event_occurred = true interp_index = i break @@ -128,7 +127,7 @@ end function find_callback_time(integrator,callback) event_occurred,interp_index,Θs,prev_sign,prev_sign_index = determine_event_occurance(integrator,callback) if event_occurred - if typeof(callback.condition) <: Void + if typeof(callback.condition) <: Nothing new_t = zero(typeof(integrator.t)) else if callback.interp_points!=0 @@ -141,7 +140,7 @@ function find_callback_time(integrator,callback) if callback.rootfind && !(typeof(integrator.alg) <: FunctionMap) if typeof(integrator.cache) <: OrdinaryDiffEqMutableCache _cache = first(get_tmp_cache(integrator)) - if typeof(callback.idxs) <: Void + if typeof(callback.idxs) <: Nothing tmp = _cache elseif !(typeof(callback.idxs) <: Number) tmp = @view _cache[callback.idxs] @@ -193,13 +192,13 @@ function apply_callback!(integrator,callback::ContinuousCallback,cb_time,prev_si integrator.u_modified = true if prev_sign < 0 - if typeof(callback.affect!) <: Void + if typeof(callback.affect!) <: Nothing integrator.u_modified = false else callback.affect!(integrator) end elseif prev_sign > 0 - if typeof(callback.affect_neg!) <: Void + if typeof(callback.affect_neg!) <: Nothing integrator.u_modified = false else callback.affect_neg!(integrator) diff --git a/src/composite_solution.jl b/src/composite_solution.jl index 915ad56564..b44142fd15 100644 --- a/src/composite_solution.jl +++ b/src/composite_solution.jl @@ -1,4 +1,4 @@ -struct ODECompositeSolution{T,N,uType,uType2,EType,tType,rateType,P,A,IType} <: AbstractODESolution{T,N} +struct ODECompositeSolution{T,N,uType,uType2,EType,tType,rateType,P,A,IType} <: DiffEqBase.AbstractODESolution{T,N} u::uType u_analytic::uType2 errors::EType @@ -15,8 +15,8 @@ end (sol::ODECompositeSolution)(t,deriv::Type=Val{0};idxs=nothing) = sol.interp(t,idxs,deriv,sol.prob.p) (sol::ODECompositeSolution)(v,t,deriv::Type=Val{0};idxs=nothing) = sol.interp(v,t,idxs,deriv,sol.prob.p) -function build_solution( - prob::Union{AbstractODEProblem,AbstractDDEProblem}, +function DiffEqBase.build_solution( + prob::Union{DiffEqBase.AbstractODEProblem,DiffEqBase.AbstractDDEProblem}, alg::OrdinaryDiffEqCompositeAlgorithm,t,u; timeseries_errors=length(u)>2, dense=false,dense_errors=dense, @@ -39,19 +39,19 @@ function build_solution( f = prob.f end - if has_analytic(f) + if DiffEqBase.has_analytic(f) if !(typeof(prob.u0) <: Tuple) - u_analytic = Vector{typeof(prob.u0)}(0) + u_analytic = Vector{typeof(prob.u0)}(undef, 0) errors = Dict{Symbol,real(eltype(prob.u0))}() else - u_analytic = Vector{typeof(ArrayPartition(prob.u0))}(0) + u_analytic = Vector{typeof(ArrayPartition(prob.u0))}(undef, 0) errors = Dict{Symbol,real(eltype(prob.u0[1]))}() end sol = ODECompositeSolution{T,N,typeof(u),typeof(u_analytic),typeof(errors),typeof(t),typeof(k), typeof(prob),typeof(alg),typeof(interp)}(u,u_analytic,errors,t,k,prob,alg,interp,alg_choice,dense,0,retcode) if calculate_error - calculate_solution_errors!(sol;timeseries_errors=timeseries_errors,dense_errors=dense_errors) + DiffEqBase.calculate_solution_errors!(sol;timeseries_errors=timeseries_errors,dense_errors=dense_errors) end return sol else diff --git a/src/constants.jl b/src/constants.jl index f2a5d3b2b2..d94ab23f1f 100644 --- a/src/constants.jl +++ b/src/constants.jl @@ -18,7 +18,7 @@ function constructDormandPrince(T::Type = Float64) α = map(T,α) αEEst = map(T,αEEst) c = map(T,c) - return(ExplicitRKTableau(A,c,α,5,αEEst=αEEst,adaptiveorder=4,fsal=true)) + return(DiffEqBase.ExplicitRKTableau(A,c,α,5,αEEst=αEEst,adaptiveorder=4,fsal=true)) end """ diff --git a/src/dense/generic_dense.jl b/src/dense/generic_dense.jl index cee2b563d5..8b88cc7d4d 100644 --- a/src/dense/generic_dense.jl +++ b/src/dense/generic_dense.jl @@ -17,7 +17,7 @@ end end -@inline function ode_interpolant(Θ,integrator::DEIntegrator,idxs,deriv) +@inline function ode_interpolant(Θ,integrator::DiffEqBase.DEIntegrator,idxs,deriv) ode_addsteps!(integrator) if !(typeof(integrator.cache) <: CompositeCache) val = ode_interpolant(Θ,integrator.dt,integrator.uprev,integrator.u,integrator.k,integrator.cache,idxs,deriv) @@ -27,7 +27,7 @@ end val end -@inline function ode_interpolant!(val,Θ,integrator::DEIntegrator,idxs,deriv) +@inline function ode_interpolant!(val,Θ,integrator::DiffEqBase.DEIntegrator,idxs,deriv) ode_addsteps!(integrator) if !(typeof(integrator.cache) <: CompositeCache) ode_interpolant!(val,Θ,integrator.dt,integrator.uprev,integrator.u,integrator.k,integrator.cache,idxs,deriv) @@ -36,47 +36,47 @@ end end end -@inline function current_interpolant(t::Number,integrator::DEIntegrator,idxs,deriv) +@inline function current_interpolant(t::Number,integrator::DiffEqBase.DEIntegrator,idxs,deriv) Θ = (t-integrator.tprev)/integrator.dt ode_interpolant(Θ,integrator,idxs,deriv) end -@inline function current_interpolant(t,integrator::DEIntegrator,idxs,deriv) +@inline function current_interpolant(t,integrator::DiffEqBase.DEIntegrator,idxs,deriv) Θ = (t.-integrator.tprev)./integrator.dt [ode_interpolant(ϕ,integrator,idxs,deriv) for ϕ in Θ] end -@inline function current_interpolant!(val,t::Number,integrator::DEIntegrator,idxs,deriv) +@inline function current_interpolant!(val,t::Number,integrator::DiffEqBase.DEIntegrator,idxs,deriv) Θ = (t-integrator.tprev)/integrator.dt ode_interpolant!(val,Θ,integrator,idxs,deriv) end -@inline function current_interpolant!(val,t,integrator::DEIntegrator,idxs,deriv) +@inline function current_interpolant!(val,t,integrator::DiffEqBase.DEIntegrator,idxs,deriv) Θ = (t.-integrator.tprev)./integrator.dt [ode_interpolant!(val,ϕ,integrator,idxs,deriv) for ϕ in Θ] end -@inline function current_extrapolant(t::Number,integrator::DEIntegrator,idxs=nothing,deriv=Val{0}) +@inline function current_extrapolant(t::Number,integrator::DiffEqBase.DEIntegrator,idxs=nothing,deriv=Val{0}) Θ = (t-integrator.tprev)/(integrator.t-integrator.tprev) ode_extrapolant(Θ,integrator,idxs,deriv) end -@inline function current_extrapolant!(val,t::Number,integrator::DEIntegrator,idxs=nothing,deriv=Val{0}) +@inline function current_extrapolant!(val,t::Number,integrator::DiffEqBase.DEIntegrator,idxs=nothing,deriv=Val{0}) Θ = (t-integrator.tprev)/(integrator.t-integrator.tprev) ode_extrapolant!(val,Θ,integrator,idxs,deriv) end -@inline function current_extrapolant(t::AbstractArray,integrator::DEIntegrator,idxs=nothing,deriv=Val{0}) +@inline function current_extrapolant(t::AbstractArray,integrator::DiffEqBase.DEIntegrator,idxs=nothing,deriv=Val{0}) Θ = (t.-integrator.tprev)./(integrator.t-integrator.tprev) [ode_extrapolant(ϕ,integrator,idxs,deriv) for ϕ in Θ] end -@inline function current_extrapolant!(val,t,integrator::DEIntegrator,idxs=nothing,deriv=Val{0}) +@inline function current_extrapolant!(val,t,integrator::DiffEqBase.DEIntegrator,idxs=nothing,deriv=Val{0}) Θ = (t.-integrator.tprev)./(integrator.t-integrator.tprev) [ode_extrapolant!(val,ϕ,integrator,idxs,deriv) for ϕ in Θ] end -@inline function ode_extrapolant!(val,Θ,integrator::DEIntegrator,idxs,deriv) +@inline function ode_extrapolant!(val,Θ,integrator::DiffEqBase.DEIntegrator,idxs,deriv) ode_addsteps!(integrator) if !(typeof(integrator.cache) <: CompositeCache) ode_interpolant!(val,Θ,integrator.t-integrator.tprev,integrator.uprev2,integrator.uprev,integrator.k,integrator.cache,idxs,deriv) @@ -85,7 +85,7 @@ end end end -@inline function ode_extrapolant(Θ,integrator::DEIntegrator,idxs,deriv) +@inline function ode_extrapolant(Θ,integrator::DiffEqBase.DEIntegrator,idxs,deriv) ode_addsteps!(integrator) if !(typeof(integrator.cache) <: CompositeCache) ode_interpolant(Θ,integrator.t-integrator.tprev,integrator.uprev2,integrator.uprev,integrator.k,integrator.cache,idxs,deriv) @@ -110,11 +110,11 @@ function ode_interpolation(tvals,id,idxs,deriv,p) tdir*tvals[idx[end]] > tdir*ts[end] && error("Solution interpolation cannot extrapolate past the final timepoint. Either solve on a longer timespan or use the local extrapolation from the integrator interface.") tdir*tvals[idx[1]] < tdir*ts[1] && error("Solution interpolation cannot extrapolate before the first timepoint. Either start solving earlier or use the local extrapolation from the integrator interface.") if typeof(idxs) <: Number - vals = Vector{eltype(first(timeseries))}(length(tvals)) + vals = Vector{eltype(first(timeseries))}(undef, length(tvals)) elseif typeof(idxs) <: AbstractArray - vals = Vector{Array{eltype(first(timeseries)),ndims(idxs)}}(length(tvals)) + vals = Vector{Array{eltype(first(timeseries)),ndims(idxs)}}(undef, length(tvals)) else - vals = Vector{eltype(timeseries)}(length(tvals)) + vals = Vector{eltype(timeseries)}(undef, length(tvals)) end @inbounds for j in idx t = tvals[j] @@ -276,15 +276,15 @@ function ode_interpolation!(out,tval::Number,id,idxs,deriv,p) avoid_constant_ends && i==1 && (i+=1) if !avoid_constant_ends && ts[i] == tval if idxs == nothing - @inbounds copy!(out,timeseries[i]) + @inbounds copyto!(out,timeseries[i]) else - @inbounds copy!(out,timeseries[i][idxs]) + @inbounds copyto!(out,timeseries[i][idxs]) end elseif !avoid_constant_ends && ts[i-1] == tval # Can happen if it's the first value! if idxs == nothing - @inbounds copy!(out,timeseries[i-1]) + @inbounds copyto!(out,timeseries[i-1]) else - @inbounds copy!(out,timeseries[i-1][idxs]) + @inbounds copyto!(out,timeseries[i-1][idxs]) end else @inbounds begin @@ -324,7 +324,7 @@ By default, simpledense nothing end -function ode_interpolant{TI}(Θ,dt,y₀,y₁,k,cache::OrdinaryDiffEqMutableCache,idxs,T::Type{Val{TI}}) +function ode_interpolant(Θ,dt,y₀,y₁,k,cache::OrdinaryDiffEqMutableCache,idxs,T::Type{Val{TI}}) where TI if typeof(idxs) <: Number || typeof(y₀) <: Number return ode_interpolant!(nothing,Θ,dt,y₀,y₁,k,cache,idxs,T) else @@ -337,10 +337,10 @@ function ode_interpolant{TI}(Θ,dt,y₀,y₁,k,cache::OrdinaryDiffEqMutableCache S = promote_type(typeof(oneunit_Θ * oneunit(eltype(y₀))), # Θ*y₀ typeof(oneunit_Θ * oneunit(dt) * oneunit(eltype(k[1])))) # Θ*dt*k end - if typeof(idxs) <: Void + if typeof(idxs) <: Nothing out = similar(y₀, S) else - out = similar(y₀, S, indices(idxs)) + out = similar(y₀, S, axes(idxs)) end ode_interpolant!(out,Θ,dt,y₀,y₁,k,cache,idxs,T) return out @@ -350,11 +350,11 @@ end ##################### Hermite Interpolants # If no dispatch found, assume Hermite -function ode_interpolant{TI}(Θ,dt,y₀,y₁,k,cache,idxs,T::Type{Val{TI}}) +function ode_interpolant(Θ,dt,y₀,y₁,k,cache,idxs,T::Type{Val{TI}}) where TI hermite_interpolant(Θ,dt,y₀,y₁,k,cache,idxs,T) end -function ode_interpolant!{TI}(out,Θ,dt,y₀,y₁,k,cache,idxs,T::Type{Val{TI}}) +function ode_interpolant!(out,Θ,dt,y₀,y₁,k,cache,idxs,T::Type{Val{TI}}) where TI hermite_interpolant!(out,Θ,dt,y₀,y₁,k,cache,idxs,T) end @@ -364,11 +364,11 @@ Hairer Norsett Wanner Solving Ordinary Differential Euations I - Nonstiff Proble Herimte Interpolation, chosen if no other dispatch for ode_interpolant """ @muladd function hermite_interpolant(Θ,dt,y₀,y₁,k,cache,idxs,T::Type{Val{0}}) # Default interpolant is Hermite - if typeof(idxs) <: Void + if typeof(idxs) <: Nothing #out = @. (1-Θ)*y₀+Θ*y₁+Θ*(Θ-1)*((1-2Θ)*(y₁-y₀)+(Θ-1)*dt*k[1] + Θ*dt*k[2]) out = (1-Θ)*y₀+Θ*y₁+Θ*(Θ-1)*((1-2Θ)*(y₁-y₀)+(Θ-1)*dt*k[1] + Θ*dt*k[2]) else - #out = similar(y₀,indices(idxs)) + #out = similar(y₀,axes(idxs)) #@views @. out = (1-Θ)*y₀[idxs]+Θ*y₁[idxs]+Θ*(Θ-1)*((1-2Θ)*(y₁[idxs]-y₀[idxs])+(Θ-1)*dt*k[1][idxs] + Θ*dt*k[2][idxs]) @views out = (1-Θ)*y₀[idxs]+Θ*y₁[idxs]+Θ*(Θ-1)*((1-2Θ)*(y₁[idxs]-y₀[idxs])+(Θ-1)*dt*k[1][idxs] + Θ*dt*k[2][idxs]) end @@ -379,11 +379,11 @@ end Herimte Interpolation, chosen if no other dispatch for ode_interpolant """ @muladd function hermite_interpolant(Θ,dt,y₀,y₁,k,cache,idxs,T::Type{Val{1}}) # Default interpolant is Hermite - if typeof(idxs) <: Void + if typeof(idxs) <: Nothing #out = @. k[1] + Θ*(-4*dt*k[1] - 2*dt*k[2] - 6*y₀ + Θ*(3*dt*k[1] + 3*dt*k[2] + 6*y₀ - 6*y₁) + 6*y₁)/dt out = k[1] + Θ*(-4*dt*k[1] - 2*dt*k[2] - 6*y₀ + Θ*(3*dt*k[1] + 3*dt*k[2] + 6*y₀ - 6*y₁) + 6*y₁)/dt else - #out = similar(y₀,indices(idxs)) + #out = similar(y₀,axes(idxs)) #@views @. out = k[1][idxs] + Θ*(-4*dt*k[1][idxs] - 2*dt*k[2][idxs] - 6*y₀[idxs] + Θ*(3*dt*k[1][idxs] + 3*dt*k[2][idxs] + 6*y₀[idxs] - 6*y₁[idxs]) + 6*y₁[idxs])/dt @views out = k[1][idxs] + Θ*(-4*dt*k[1][idxs] - 2*dt*k[2][idxs] - 6*y₀[idxs] + Θ*(3*dt*k[1][idxs] + 3*dt*k[2][idxs] + 6*y₀[idxs] - 6*y₁[idxs]) + 6*y₁[idxs])/dt end @@ -394,11 +394,11 @@ end Herimte Interpolation, chosen if no other dispatch for ode_interpolant """ @muladd function hermite_interpolant(Θ,dt,y₀,y₁,k,cache,idxs,T::Type{Val{2}}) # Default interpolant is Hermite - if typeof(idxs) <: Void + if typeof(idxs) <: Nothing #out = @. (-4*dt*k[1] - 2*dt*k[2] - 6*y₀ + Θ*(6*dt*k[1] + 6*dt*k[2] + 12*y₀ - 12*y₁) + 6*y₁)/(dt*dt) out = (-4*dt*k[1] - 2*dt*k[2] - 6*y₀ + Θ*(6*dt*k[1] + 6*dt*k[2] + 12*y₀ - 12*y₁) + 6*y₁)/(dt*dt) else - #out = similar(y₀,indices(idxs)) + #out = similar(y₀,axes(idxs)) #@views @. out = (-4*dt*k[1][idxs] - 2*dt*k[2][idxs] - 6*y₀[idxs] + Θ*(6*dt*k[1][idxs] + 6*dt*k[2][idxs] + 12*y₀[idxs] - 12*y₁[idxs]) + 6*y₁[idxs])/(dt*dt) @views out = (-4*dt*k[1][idxs] - 2*dt*k[2][idxs] - 6*y₀[idxs] + Θ*(6*dt*k[1][idxs] + 6*dt*k[2][idxs] + 12*y₀[idxs] - 12*y₁[idxs]) + 6*y₁[idxs])/(dt*dt) end @@ -409,11 +409,11 @@ end Herimte Interpolation, chosen if no other dispatch for ode_interpolant """ @muladd function hermite_interpolant(Θ,dt,y₀,y₁,k,cache,idxs,T::Type{Val{3}}) # Default interpolant is Hermite - if typeof(idxs) <: Void + if typeof(idxs) <: Nothing #out = @. (6*dt*k[1] + 6*dt*k[2] + 12*y₀ - 12*y₁)/(dt*dt*dt) out = (6*dt*k[1] + 6*dt*k[2] + 12*y₀ - 12*y₁)/(dt*dt*dt) else - #out = similar(y₀,indices(idxs)) + #out = similar(y₀,axes(idxs)) #@views @. out = (6*dt*k[1][idxs] + 6*dt*k[2][idxs] + 12*y₀[idxs] - 12*y₁[idxs])/(dt*dt*dt) @views out = (6*dt*k[1][idxs] + 6*dt*k[2][idxs] + 12*y₀[idxs] - 12*y₁[idxs])/(dt*dt*dt) end @@ -524,7 +524,7 @@ end @muladd function linear_interpolant(Θ,dt,y₀,y₁,idxs,T::Type{Val{0}}) Θm1 = (1-Θ) - if typeof(idxs) <: Void + if typeof(idxs) <: Nothing out = @. Θm1*y₀ + Θ*y₁ else out = @. Θm1*y₀[idxs] + Θ*y₁[idxs] @@ -533,7 +533,7 @@ end end function linear_interpolant(Θ,dt,y₀,y₁,idxs,T::Type{Val{1}}) - if typeof(idxs) <: Void + if typeof(idxs) <: Nothing out = @. (y₁ - y₀)/dt else out = @. (y₁[idxs] - y₀[idxs])/dt diff --git a/src/dense/interpolants.jl b/src/dense/interpolants.jl index 036f1cf4d1..c3def0f289 100644 --- a/src/dense/interpolants.jl +++ b/src/dense/interpolants.jl @@ -9,7 +9,7 @@ end """ Hairer Norsett Wanner Solving Ordinary Differential Euations I - Nonstiff Problems Page 192 """ -@muladd function ode_interpolant(Θ,dt,y₀,y₁,k,cache::DP5ConstantCache,idxs::Void,T::Type{Val{0}}) +@muladd function ode_interpolant(Θ,dt,y₀,y₁,k,cache::DP5ConstantCache,idxs::Nothing,T::Type{Val{0}}) Θ1 = 1-Θ #@. y₀ + dt*Θ*(k[1]+Θ1*(k[2]+Θ*(k[3]+Θ1*k[4]))) y₀ + dt*Θ*(k[1]+Θ1*(k[2]+Θ*(k[3]+Θ1*k[4]))) @@ -21,7 +21,7 @@ end y₀[idxs] + dt*Θ*(k[1][idxs]+Θ1*(k[2][idxs]+Θ*(k[3][idxs]+Θ1*k[4][idxs]))) end -@muladd function ode_interpolant(Θ,dt,y₀,y₁,k,cache::DP5ConstantCache,idxs::Void,T::Type{Val{1}}) +@muladd function ode_interpolant(Θ,dt,y₀,y₁,k,cache::DP5ConstantCache,idxs::Nothing,T::Type{Val{1}}) #@. k[1] + k[2]*(1 - 2*Θ) + Θ*(2*k[3] + 2*k[4] + Θ*(-3*k[3] - 6*k[4] + 4*k[4]*Θ)) k[1] + k[2]*(1 - 2*Θ) + Θ*(2*k[3] + 2*k[4] + Θ*(-3*k[3] - 6*k[4] + 4*k[4]*Θ)) end @@ -76,7 +76,7 @@ Second order strong stability preserving (SSP) interpolant. Ketcheson, Lóczi, Jangabylova, Kusmanov: Dense output for SSP RK methods (2017). """ -@muladd function ode_interpolant(Θ,dt,y₀,y₁,k,cache::Union{SSPRK22ConstantCache,SSPRK33ConstantCache,SSPRK432ConstantCache},idxs::Void,T::Type{Val{0}}) +@muladd function ode_interpolant(Θ,dt,y₀,y₁,k,cache::Union{SSPRK22ConstantCache,SSPRK33ConstantCache,SSPRK432ConstantCache},idxs::Nothing,T::Type{Val{0}}) #@. (1-Θ^2)*y₀ + Θ^2*y₁ + Θ*(1-Θ)*dt*k[1] (1-Θ^2)*y₀ + Θ^2*y₁ + Θ*(1-Θ)*dt*k[1] end @@ -86,7 +86,7 @@ end (1-Θ^2)*y₀[idxs] + Θ^2*y₁[idxs] + Θ*(1-Θ)*dt*k[1][idxs] end -@muladd function ode_interpolant(Θ,dt,y₀,y₁,k,cache::Union{SSPRK22ConstantCache,SSPRK33ConstantCache,SSPRK432ConstantCache},idxs::Void,T::Type{Val{1}}) +@muladd function ode_interpolant(Θ,dt,y₀,y₁,k,cache::Union{SSPRK22ConstantCache,SSPRK33ConstantCache,SSPRK432ConstantCache},idxs::Nothing,T::Type{Val{1}}) #@. -2Θ*y₀ + 2Θ*y₁ + (1-2Θ)*dt*k[1] -2Θ/dt*y₀ + 2Θ/dt*y₁ + (1-2Θ)*k[1] end @@ -1607,7 +1607,7 @@ end """ """ -@muladd function ode_interpolant(Θ,dt,y₀,y₁,k,cache::DP8ConstantCache,idxs::Void,T::Type{Val{0}}) +@muladd function ode_interpolant(Θ,dt,y₀,y₁,k,cache::DP8ConstantCache,idxs::Nothing,T::Type{Val{0}}) Θ1 = 1-Θ conpar = k[4] + Θ*(k[5] + Θ1*(k[6]+Θ*k[7])) #@. y₀ + dt*Θ*(k[1] + Θ1*(k[2] + Θ*(k[3]+Θ1*conpar))) @@ -1621,7 +1621,7 @@ end y₀[idxs] + dt*Θ*(k[1][idxs] + Θ1*(k[2][idxs] + Θ*(k[3][idxs]+Θ1*conpar))) end -@muladd function ode_interpolant(Θ,dt,y₀,y₁,k,cache::DP8ConstantCache,idxs::Void,T::Type{Val{1}}) +@muladd function ode_interpolant(Θ,dt,y₀,y₁,k,cache::DP8ConstantCache,idxs::Nothing,T::Type{Val{1}}) b1diff = k[1] + k[2] b2diff = -2*k[2] + 2*k[3] + 2*k[4] b3diff = -3*k[3] - 6*k[4] + 3*k[5] + 3*k[6] diff --git a/src/dense/stiff_addsteps.jl b/src/dense/stiff_addsteps.jl index 55c754a454..0c0ac59602 100644 --- a/src/dense/stiff_addsteps.jl +++ b/src/dense/stiff_addsteps.jl @@ -37,9 +37,9 @@ end @inbounds linsolve_tmp[i] = @muladd fsalfirst[i] + γ*dT[i] end - if has_invW(f) + if DiffEqBase.has_invW(f) f(Val{:invW},W,u,p,γ,t) # W == inverse W - A_mul_B!(vectmp,W,linsolve_tmp_vec) + mul!(vectmp,W,linsolve_tmp_vec) else ### Jacobian does not need to be re-evaluated after an event ### Since it's unchanged @@ -57,12 +57,12 @@ end #if mass_matrix == I tmp .= k₁ #else - # A_mul_B!(tmp,mass_matrix,k₁) + # mul!(tmp,mass_matrix,k₁) #end @. linsolve_tmp = f₁ - tmp - if has_invW(f) - A_mul_B!(vectmp2, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp2, W, linsolve_tmp_vec) else cache.linsolve(vectmp2, W, linsolve_tmp_vec) end @@ -197,7 +197,7 @@ end @inbounds linsolve_tmp[i] = @muladd fsalfirst[i] + dtgamma*dT[i] end - if has_invW(f) + if DiffEqBase.has_invW(f) f(Val{:invW_t},W,u,p,dtgamma,t) # W == inverse W else ### Jacobian does not need to be re-evaluated after an event @@ -207,8 +207,8 @@ end end end - if has_invW(f) - A_mul_B!(vectmp, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp, W, linsolve_tmp_vec) else cache.linsolve(vectmp, W, linsolve_tmp_vec, true) end @@ -221,12 +221,12 @@ end @. linsolve_tmp = du + dtd2*dT + dtC21*k1 else @. du1 = dtC21*k1 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + dtd2*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp2, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp2, W, linsolve_tmp_vec) else cache.linsolve(vectmp2, W, linsolve_tmp_vec) end @@ -239,12 +239,12 @@ end @. linsolve_tmp = du + dtd3*dT + (dtC31*k1 + dtC32*k2) else @. du1 = dtC31*k1 + dtC32*k2 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + dtd3*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp3, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp3, W, linsolve_tmp_vec) else cache.linsolve(vectmp3, W, linsolve_tmp_vec) end @@ -257,12 +257,12 @@ end @. linsolve_tmp = du + dtd4*dT + (dtC41*k1 + dtC42*k2 + dtC43*k3) else @. du1 = dtC41*k1 + dtC42*k2 + dtC43*k3 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + dtd4*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp4, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp4, W, linsolve_tmp_vec) else cache.linsolve(vectmp4, W, linsolve_tmp_vec) end @@ -275,12 +275,12 @@ end @. linsolve_tmp = du + (dtC52*k2 + dtC54*k4 + dtC51*k1 + dtC53*k3) else @. du1 = dtC52*k2 + dtC54*k4 + dtC51*k1 + dtC53*k3 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + du2 end - if has_invW(f) - A_mul_B!(vectmp5, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp5, W, linsolve_tmp_vec) else cache.linsolve(vectmp5, W, linsolve_tmp_vec) end diff --git a/src/derivative_utils.jl b/src/derivative_utils.jl index 1b74a8817e..31d1e2021f 100644 --- a/src/derivative_utils.jl +++ b/src/derivative_utils.jl @@ -5,7 +5,7 @@ function calc_tderivative!(integrator, cache, dtd1, repeat_step) # Time derivative if !repeat_step # skip calculation if step is repeated - if has_tgrad(f) + if DiffEqBase.has_tgrad(f) f(Val{:tgrad}, dT, uprev, p, t) else tf.uprev = uprev @@ -22,14 +22,14 @@ end function calc_J!(integrator, cache, is_compos) @unpack t,dt,uprev,u,f,p = integrator @unpack du1,uf,J,jac_config = cache - if has_jac(f) + if DiffEqBase.has_jac(f) f(Val{:jac}, J, uprev, p, t) else uf.t = t uf.p = p jacobian!(J, uf, uprev, du1, integrator, jac_config) end - is_compos && (integrator.eigen_est = norm(J, Inf)) + is_compos && (integrator.eigen_est = opnorm(J, Inf)) end function calc_W!(integrator, cache::OrdinaryDiffEqMutableCache, dtgamma, repeat_step, W_transform=false) @@ -42,7 +42,7 @@ function calc_W!(integrator, cache::OrdinaryDiffEqMutableCache, dtgamma, repeat_ # calculate W new_W = true - if has_invW(f) + if DiffEqBase.has_invW(f) # skip calculation of inv(W) if step is repeated !repeat_step && W_transform ? f(Val{:invW_t}, W, uprev, p, dtgamma, t) : f(Val{:invW}, W, uprev, p, dtgamma, t) # W == inverse W @@ -52,7 +52,7 @@ function calc_W!(integrator, cache::OrdinaryDiffEqMutableCache, dtgamma, repeat_ # skip calculation of J if step is repeated if repeat_step || (alg_can_repeat_jac(alg) && (!integrator.last_stepfail && cache.newton_iters == 1 && - cache.ηold < integrator.alg.new_jac_conv_bound)) + cache.ηold < alg.new_jac_conv_bound)) new_jac = false else new_jac = true @@ -103,7 +103,7 @@ function calc_W!(integrator, cache::OrdinaryDiffEqConstantCache, dtgamma, repeat W = inv(dtgamma) - J end end - iscompo && (integrator.eigen_est = isarray ? norm(J, Inf) : J) + iscompo && (integrator.eigen_est = isarray ? opnorm(J, Inf) : J) W end diff --git a/src/derivative_wrappers.jl b/src/derivative_wrappers.jl index bacf0eb7fd..613e168b3d 100644 --- a/src/derivative_wrappers.jl +++ b/src/derivative_wrappers.jl @@ -7,7 +7,7 @@ function derivative!(df::AbstractArray{<:Number}, f, x::Union{Number,AbstractArr nothing end -function jacobian!(J::AbstractMatrix{<:Number}, f, x::AbstractArray{<:Number}, fx::AbstractArray{<:Number}, integrator::DEIntegrator, jac_config) +function jacobian!(J::AbstractMatrix{<:Number}, f, x::AbstractArray{<:Number}, fx::AbstractArray{<:Number}, integrator::DiffEqBase.DEIntegrator, jac_config) if get_current_alg_autodiff(integrator.alg, integrator.cache) ForwardDiff.jacobian!(J, f, fx, x, jac_config) else @@ -17,7 +17,7 @@ function jacobian!(J::AbstractMatrix{<:Number}, f, x::AbstractArray{<:Number}, f end function build_jac_config(alg,f,uf,du1,uprev,u,tmp,du2) - if !has_jac(f) + if !DiffEqBase.has_jac(f) if alg_autodiff(alg) jac_config = ForwardDiff.JacobianConfig(uf,du1,uprev,ForwardDiff.Chunk{determine_chunksize(u,alg)}()) else @@ -34,7 +34,7 @@ function build_jac_config(alg,f,uf,du1,uprev,u,tmp,du2) end function build_grad_config(alg,f,tf,du1,t) - if !has_tgrad(f) + if !DiffEqBase.has_tgrad(f) if alg_autodiff(alg) grad_config = ForwardDiff.DerivativeConfig(tf,du1,t) else diff --git a/src/exponential_utils.jl b/src/exponential_utils.jl index 16a4bbed08..4dc6c7fc23 100644 --- a/src/exponential_utils.jl +++ b/src/exponential_utils.jl @@ -1,12 +1,15 @@ +using LinearAlgebra: axpy! +using SparseArrays + # exponential_utils.jl -# Contains functions related to the evaluation of scalar/matrix phi functions +# Contains functions related to the evaluation of scalar/matrix phi functions # that are used by the exponential integrators. # -# TODO: write a version of `expm!` that is non-allocating. +# TODO: write a version of `exp!` that is non-allocating. ################################################### # Dense algorithms -const exp! = Base.LinAlg.expm! # v0.7 style +using LinearAlgebra: exp! """ phi(z,k[;cache]) -> [phi_0(z),phi_1(z),...,phi_k(z)] @@ -16,18 +19,18 @@ Compute the scalar phi functions for all orders up to k. The phi functions are defined as ```math -\\varphi_0(z) = \\exp(z),\\quad \\varphi_k(z+1) = \\frac{\\varphi_k(z) - 1}{z} +\\varphi_0(z) = \\exp(z),\\quad \\varphi_k(z+1) = \\frac{\\varphi_k(z) - 1}{z} ``` -Instead of using the recurrence relation, which is numerically unstable, a -formula given by Sidje is used (Sidje, R. B. (1998). Expokit: a software -package for computing matrix exponentials. ACM Transactions on Mathematical +Instead of using the recurrence relation, which is numerically unstable, a +formula given by Sidje is used (Sidje, R. B. (1998). Expokit: a software +package for computing matrix exponentials. ACM Transactions on Mathematical Software (TOMS), 24(1), 130-156. Theorem 1). """ function phi(z::T, k::Integer; cache=nothing) where {T <: Number} # Construct the matrix if cache == nothing - cache = zeros(T, k+1, k+1) + cache = fill(zero(T), k+1, k+1) else fill!(cache, zero(T)) end @@ -47,16 +50,16 @@ Compute the matrix-phi-vector products for small, dense `A`. `k`` >= 1. The phi functions are defined as ```math -\\varphi_0(z) = \\exp(z),\\quad \\varphi_k(z+1) = \\frac{\\varphi_k(z) - 1}{z} +\\varphi_0(z) = \\exp(z),\\quad \\varphi_k(z+1) = \\frac{\\varphi_k(z) - 1}{z} ``` -Instead of using the recurrence relation, which is numerically unstable, a -formula given by Sidje is used (Sidje, R. B. (1998). Expokit: a software -package for computing matrix exponentials. ACM Transactions on Mathematical +Instead of using the recurrence relation, which is numerically unstable, a +formula given by Sidje is used (Sidje, R. B. (1998). Expokit: a software +package for computing matrix exponentials. ACM Transactions on Mathematical Software (TOMS), 24(1), 130-156. Theorem 1). """ function phiv_dense(A, v, k; cache=nothing) - w = Matrix{eltype(A)}(length(v), k+1) + w = Matrix{eltype(A)}(undef, length(v), k+1) phiv_dense!(w, A, v, k; cache=cache) end """ @@ -64,14 +67,14 @@ end Non-allocating version of `phiv_dense`. """ -function phiv_dense!(w::AbstractMatrix{T}, A::AbstractMatrix{T}, +function phiv_dense!(w::AbstractMatrix{T}, A::AbstractMatrix{T}, v::AbstractVector{T}, k::Integer; cache=nothing) where {T <: Number} @assert size(w, 1) == size(A, 1) == size(A, 2) == length(v) "Dimension mismatch" @assert size(w, 2) == k+1 "Dimension mismatch" m = length(v) # Construct the extended matrix if cache == nothing - cache = zeros(T, m+k, m+k) + cache = fill(zero(T), m+k, m+k) else @assert size(cache) == (m+k, m+k) "Dimension mismatch" fill!(cache, zero(T)) @@ -83,7 +86,7 @@ function phiv_dense!(w::AbstractMatrix{T}, A::AbstractMatrix{T}, end P = exp!(cache) # Extract results - @views A_mul_B!(w[:, 1], P[1:m, 1:m], v) + @views mul!(w[:, 1], P[1:m, 1:m], v) @inbounds for i = 1:k @inbounds for j = 1:m w[j, i+1] = P[j, m+i] @@ -98,16 +101,16 @@ end Compute the matrix phi functions for all orders up to k. `k` >= 1. The phi functions are defined as - + ```math -\\varphi_0(z) = \\exp(z),\\quad \\varphi_k(z+1) = \\frac{\\varphi_k(z) - 1}{z} +\\varphi_0(z) = \\exp(z),\\quad \\varphi_k(z+1) = \\frac{\\varphi_k(z) - 1}{z} ``` Calls `phiv_dense` on each of the basis vectors to obtain the answer. """ function phi(A::AbstractMatrix{T}, k; caches=nothing) where {T <: Number} m = size(A, 1) - out = [Matrix{T}(m, m) for i = 1:k+1] + out = [Matrix{T}(undef, m, m) for i = 1:k+1] phi!(out, A, k; caches=caches) end """ @@ -119,9 +122,9 @@ function phi!(out::Vector{Matrix{T}}, A::AbstractMatrix{T}, k::Integer; caches=n m = size(A, 1) @assert length(out) == k + 1 && all(P -> size(P) == (m,m), out) "Dimension mismatch" if caches == nothing - e = Vector{T}(m) - W = Matrix{T}(m, k+1) - C = Matrix{T}(m+k, m+k) + e = Vector{T}(undef, m) + W = Matrix{T}(undef, m, k+1) + C = Matrix{T}(undef, m+k, m+k) else e, W, C = caches @assert size(e) == (m,) && size(W) == (m, k+1) && size(C) == (m+k, m+k) "Dimension mismatch" @@ -145,14 +148,14 @@ end Constructs an uninitialized Krylov subspace, which can be filled by `arnoldi!`. -The dimension of the subspace, `Ks.m`, can be dynamically altered but should +The dimension of the subspace, `Ks.m`, can be dynamically altered but should be smaller than `maxiter`, the maximum allowed arnoldi iterations. getV(Ks) -> V getH(Ks) -> H -Access methods for the (extended) orthonormal basis `V` and the (extended) -Gram-Schmidt coefficients `H`. Both methods return a view into the storage +Access methods for the (extended) orthonormal basis `V` and the (extended) +Gram-Schmidt coefficients `H`. Both methods return a view into the storage arrays and has the correct dimensions as indicated by `Ks.m`. resize!(Ks, maxiter) -> Ks @@ -168,15 +171,14 @@ mutable struct KrylovSubspace{B, T} V::Matrix{T} # orthonormal bases H::Matrix{T} # Gram-Schmidt coefficients KrylovSubspace{T}(n::Integer, maxiter::Integer=30) where {T} = new{real(T), T}( - maxiter, maxiter, zero(real(T)), Matrix{T}(n, maxiter + 1), - zeros(T, maxiter + 1, maxiter)) + maxiter, maxiter, zero(real(T)), Matrix{T}(undef, n, maxiter + 1), + fill(zero(T), maxiter + 1, maxiter)) end -# TODO: switch to overload `getproperty` in v0.7 getH(Ks::KrylovSubspace) = @view(Ks.H[1:Ks.m + 1, 1:Ks.m]) getV(Ks::KrylovSubspace) = @view(Ks.V[:, 1:Ks.m + 1]) function Base.resize!(Ks::KrylovSubspace{B,T}, maxiter::Integer) where {B,T} - V = Matrix{T}(size(Ks.V, 1), maxiter + 1) - H = zeros(T, maxiter + 1, maxiter) + V = Matrix{T}(undef, size(Ks.V, 1), maxiter + 1) + H = fill(zero(T), maxiter + 1, maxiter) Ks.V = V; Ks.H = H Ks.m = Ks.maxiter = maxiter return Ks @@ -191,45 +193,45 @@ function Base.show(io::IO, Ks::KrylovSubspace) end """ - arnoldi(A,b[;m,tol,norm,cache]) -> Ks + arnoldi(A,b[;m,tol,opnorm,cache]) -> Ks Performs `m` anoldi iterations to obtain the Krylov subspace K_m(A,b). -The n x (m + 1) basis vectors `getV(Ks)` and the (m + 1) x m upper Heisenberg +The n x (m + 1) basis vectors `getV(Ks)` and the (m + 1) x m upper Heisenberg matrix `getH(Ks)` are related by the recurrence formula ``` v_1=b,\\quad Av_j = \\sum_{i=1}^{j+1}h_{ij}v_i\\quad(j = 1,2,\\ldots,m) ``` -`iop` determines the length of the incomplete orthogonalization procedure [^1]. -The default value of 0 indicates full Arnoldi. For symmetric/Hermitian `A`, +`iop` determines the length of the incomplete orthogonalization procedure [^1]. +The default value of 0 indicates full Arnoldi. For symmetric/Hermitian `A`, `iop` will be ignored and the Lanczos algorithm will be used instead. Refer to `KrylovSubspace` for more information regarding the output. -Happy-breakdown occurs whenver `norm(v_j) < tol * norm(A, Inf)`, in this case +Happy-breakdown occurs whenver `norm(v_j) < tol * opnorm(A, Inf)`, in this case the dimension of `Ks` is smaller than `m`. -[^1]: Koskela, A. (2015). Approximating the matrix exponential of an -advection-diffusion operator using the incomplete orthogonalization method. In -Numerical Mathematics and Advanced Applications-ENUMATH 2013 (pp. 345-353). +[^1]: Koskela, A. (2015). Approximating the matrix exponential of an +advection-diffusion operator using the incomplete orthogonalization method. In +Numerical Mathematics and Advanced Applications-ENUMATH 2013 (pp. 345-353). Springer, Cham. """ -function arnoldi(A, b; m=min(30, size(A, 1)), tol=1e-7, norm=Base.norm, +function arnoldi(A, b; m=min(30, size(A, 1)), tol=1e-7, opnorm=LinearAlgebra.opnorm, iop=0, cache=nothing) Ks = KrylovSubspace{eltype(b)}(length(b), m) - arnoldi!(Ks, A, b; m=m, tol=tol, norm=norm, cache=cache, iop=iop) + arnoldi!(Ks, A, b; m=m, tol=tol, opnorm=opnorm, cache=cache, iop=iop) end """ - arnoldi!(Ks,A,b[;tol,m,norm,cache]) -> Ks + arnoldi!(Ks,A,b[;tol,m,opnorm,cache]) -> Ks Non-allocating version of `arnoldi`. """ -function arnoldi!(Ks::KrylovSubspace{B, T}, A, b::AbstractVector{T}; tol::Real=1e-7, - m::Int=min(Ks.maxiter, size(A, 1)), norm=Base.norm, iop::Int=0, cache=nothing) where {B, T <: Number} +function arnoldi!(Ks::KrylovSubspace{B, T}, A, b::AbstractVector{T}; tol::Real=1e-7, + m::Int=min(Ks.maxiter, size(A, 1)), opnorm=LinearAlgebra.opnorm, iop::Int=0, cache=nothing) where {B, T <: Number} if ishermitian(A) - return lanczos!(Ks, A, b; tol=tol, m=m, norm=norm, cache=cache) + return lanczos!(Ks, A, b; tol=tol, m=m, opnorm=opnorm, cache=cache) end if m > Ks.maxiter resize!(Ks, m) @@ -237,7 +239,7 @@ function arnoldi!(Ks::KrylovSubspace{B, T}, A, b::AbstractVector{T}; tol::Real=1 Ks.m = m # might change if happy-breakdown occurs end V, H = getV(Ks), getH(Ks) - vtol = tol * norm(A, Inf) + vtol = tol * opnorm(A, Inf) if iop == 0 iop = m end @@ -254,11 +256,11 @@ function arnoldi!(Ks::KrylovSubspace{B, T}, A, b::AbstractVector{T}; tol::Real=1 Ks.beta = norm(b) @. V[:, 1] = b / Ks.beta @inbounds for j = 1:m - A_mul_B!(cache, A, @view(V[:, j])) + mul!(cache, A, @view(V[:, j])) @inbounds for i = max(1, j - iop + 1):j alpha = dot(@view(V[:, i]), cache) H[i, j] = alpha - Base.axpy!(-alpha, @view(V[:, i]), cache) + axpy!(-alpha, @view(V[:, i]), cache) end beta = norm(cache) H[j+1, j] = beta @@ -273,19 +275,19 @@ function arnoldi!(Ks::KrylovSubspace{B, T}, A, b::AbstractVector{T}; tol::Real=1 return Ks end """ - lanczos!(Ks,A,b[;tol,m,norm,cache]) -> Ks + lanczos!(Ks,A,b[;tol,m,opnorm,cache]) -> Ks A variation of `arnoldi!` that uses the Lanczos algorithm for Hermitian matrices. """ function lanczos!(Ks::KrylovSubspace{B, T}, A, b::AbstractVector{T}; tol=1e-7, - m=min(Ks.maxiter, size(A, 1)), norm=Base.norm, cache=nothing) where {B, T <: Number} + m=min(Ks.maxiter, size(A, 1)), opnorm=LinearAlgebra.opnorm, cache=nothing) where {B, T <: Number} if m > Ks.maxiter resize!(Ks, m) else Ks.m = m # might change if happy-breakdown occurs end V, H = getV(Ks), getH(Ks) - vtol = tol * norm(A, Inf) + vtol = tol * opnorm(A, Inf) # Safe checks n = size(V, 1) @assert length(b) == size(A,1) == size(A,2) == n "Dimension mismatch" @@ -300,12 +302,12 @@ function lanczos!(Ks::KrylovSubspace{B, T}, A, b::AbstractVector{T}; tol=1e-7, @. V[:, 1] = b / Ks.beta @inbounds for j = 1:m vj = @view(V[:, j]) - A_mul_B!(cache, A, vj) + mul!(cache, A, vj) alpha = dot(vj, cache) H[j, j] = alpha - Base.axpy!(-alpha, vj, cache) + axpy!(-alpha, vj, cache) if j > 1 - Base.axpy!(-H[j-1, j], @view(V[:, j-1]), cache) + axpy!(-H[j-1, j], @view(V[:, j-1]), cache) end beta = norm(cache) H[j+1, j] = beta @@ -326,10 +328,10 @@ end # Cache type for expv mutable struct ExpvCache{T} mem::Vector{T} - ExpvCache{T}(maxiter::Int) where {T} = new{T}(Vector{T}(maxiter^2)) + ExpvCache{T}(maxiter::Int) where {T} = new{T}(Vector{T}(undef, maxiter^2)) end function Base.resize!(C::ExpvCache{T}, maxiter::Int) where {T} - C.mem = Vector{T}(maxiter^2 * 2) + C.mem = Vector{T}(undef, maxiter^2 * 2) return C end function get_cache(C::ExpvCache, m::Int) @@ -341,22 +343,22 @@ end Compute the matrix-exponential-vector product using Krylov. -A Krylov subspace is constructed using `arnoldi` and `expm!` is called -on the Heisenberg matrix. Consult `arnoldi` for the values of the keyword +A Krylov subspace is constructed using `arnoldi` and `exp!` is called +on the Heisenberg matrix. Consult `arnoldi` for the values of the keyword arguments. expv(t,Ks; cache) -> exp(tA)b Compute the expv product using a pre-constructed Krylov subspace. """ -function expv(t, A, b; m=min(30, size(A, 1)), tol=1e-7, norm=Base.norm, cache=nothing, iop=0) - Ks = arnoldi(A, b; m=m, tol=tol, norm=norm, iop=iop) +function expv(t, A, b; m=min(30, size(A, 1)), tol=1e-7, opnorm=LinearAlgebra.opnorm, cache=nothing, iop=0) + Ks = arnoldi(A, b; m=m, tol=tol, opnorm=opnorm, iop=iop) w = similar(b) expv!(w, t, Ks; cache=cache) end function expv(t, Ks::KrylovSubspace{B, T}; cache=nothing) where {B, T} n = size(getV(Ks), 1) - w = Vector{T}(n) + w = Vector{T}(undef, n) expv!(w, t, Ks; cache=cache) end """ @@ -364,27 +366,27 @@ end Non-allocating version of `expv` that uses precomputed Krylov subspace `Ks`. """ -function expv!(w::AbstractVector{T}, t::Number, Ks::KrylovSubspace{B, T}; +function expv!(w::AbstractVector{T}, t::Number, Ks::KrylovSubspace{B, T}; cache=nothing) where {B, T <: Number} m, beta, V, H = Ks.m, Ks.beta, getV(Ks), getH(Ks) @assert length(w) == size(V, 1) "Dimension mismatch" if cache == nothing - cache = Matrix{T}(m, m) + cache = Matrix{T}(undef, m, m) elseif isa(cache, ExpvCache) cache = get_cache(cache, m) else throw(ArgumentError("Cache must be an ExpvCache")) end - scale!(t, copy!(cache, @view(H[1:m, :]))) + lmul!(t, copyto!(cache, @view(H[1:m, :]))) if ishermitian(cache) # Optimize the case for symtridiagonal H - F = eigfact!(SymTridiagonal(cache)) # Note: eigfact! -> eigen! in v0.7 + F = eigen!(SymTridiagonal(cache)) expHe = F.vectors * (exp.(F.values) .* @view(F.vectors[1, :])) else expH = exp!(cache) expHe = @view(expH[:, 1]) end - scale!(beta, A_mul_B!(w, @view(V[:, 1:m]), expHe)) # exp(A) ≈ norm(b) * V * exp(H)e + lmul!(beta, mul!(w, @view(V[:, 1:m]), expHe)) # exp(A) ≈ norm(b) * V * exp(H)e end # Cache type for phiv @@ -392,12 +394,12 @@ mutable struct PhivCache{T} mem::Vector{T} function PhivCache{T}(maxiter::Int, p::Int) where {T} numelems = maxiter + maxiter^2 + (maxiter + p)^2 + maxiter*(p + 1) - new{T}(Vector{T}(numelems)) + new{T}(Vector{T}(undef, numelems)) end end function Base.resize!(C::PhivCache{T}, maxiter::Int, p::Int) where {T} numelems = maxiter + maxiter^2 + (maxiter + p)^2 + maxiter*(p + 1) - C.mem = Vector{T}(numelems * 2) + C.mem = Vector{T}(undef, numelems * 2) return C end function get_caches(C::PhivCache, m::Int, p::Int) @@ -417,33 +419,33 @@ Compute the matrix-phi-vector products using Krylov. `k` >= 1. The phi functions are defined as ```math -\\varphi_0(z) = \\exp(z),\\quad \\varphi_k(z+1) = \\frac{\\varphi_k(z) - 1}{z} +\\varphi_0(z) = \\exp(z),\\quad \\varphi_k(z+1) = \\frac{\\varphi_k(z) - 1}{z} ``` -A Krylov subspace is constructed using `arnoldi` and `phiv_dense` is called -on the Heisenberg matrix. If `correct=true`, then phi_0 through phi_k-1 are -updated using the last Arnoldi vector v_m+1 [^1]. If `errest=true` then an -additional error estimate for the second-to-last phi is also returned. For +A Krylov subspace is constructed using `arnoldi` and `phiv_dense` is called +on the Heisenberg matrix. If `correct=true`, then phi_0 through phi_k-1 are +updated using the last Arnoldi vector v_m+1 [^1]. If `errest=true` then an +additional error estimate for the second-to-last phi is also returned. For the additional keyword arguments, consult `arnoldi`. phiv(t,Ks,k;correct,kwargs) -> [phi_0(tA)b phi_1(tA)b ... phi_k(tA)b][, errest] Compute the matrix-phi-vector products using a pre-constructed Krylov subspace. -[^1]: Niesen, J., & Wright, W. (2009). A Krylov subspace algorithm for evaluating -the φ-functions in exponential integrators. arXiv preprint arXiv:0907.4631. +[^1]: Niesen, J., & Wright, W. (2009). A Krylov subspace algorithm for evaluating +the φ-functions in exponential integrators. arXiv preprint arXiv:0907.4631. Formula (10). """ -function phiv(t, A, b, k; m=min(30, size(A, 1)), tol=1e-7, norm=Base.norm, iop=0, +function phiv(t, A, b, k; m=min(30, size(A, 1)), tol=1e-7, opnorm=LinearAlgebra.opnorm, iop=0, cache=nothing, correct=false, errest=false) - Ks = arnoldi(A, b; m=m, tol=tol, norm=norm, iop=iop) - w = Matrix{eltype(b)}(length(b), k+1) + Ks = arnoldi(A, b; m=m, tol=tol, opnorm=opnorm, iop=iop) + w = Matrix{eltype(b)}(undef, length(b), k+1) phiv!(w, t, Ks, k; cache=cache, correct=correct, errest=errest) end -function phiv(t, Ks::KrylovSubspace{B, T}, k; cache=nothing, correct=false, +function phiv(t, Ks::KrylovSubspace{B, T}, k; cache=nothing, correct=false, errest=false) where {B, T} n = size(getV(Ks), 1) - w = Matrix{T}(n, k+1) + w = Matrix{T}(undef, n, k+1) phiv!(w, t, Ks, k; cache=cache, correct=correct, errest=errest) end """ @@ -451,7 +453,7 @@ end Non-allocating version of 'phiv' that uses precomputed Krylov subspace `Ks`. """ -function phiv!(w::AbstractMatrix{T}, t::Number, Ks::KrylovSubspace{B, T}, k::Integer; +function phiv!(w::AbstractMatrix{T}, t::Number, Ks::KrylovSubspace{B, T}, k::Integer; cache=nothing, correct=false, errest=false) where {B, T <: Number} m, beta, V, H = Ks.m, Ks.beta, getV(Ks), getH(Ks) @assert size(w, 1) == size(V, 1) "Dimension mismatch" @@ -462,17 +464,17 @@ function phiv!(w::AbstractMatrix{T}, t::Number, Ks::KrylovSubspace{B, T}, k::Int throw(ArgumentError("Cache must be a PhivCache")) end e, Hcopy, C1, C2 = get_caches(cache, m, k) - scale!(t, copy!(Hcopy, @view(H[1:m, :]))) + lmul!(t, copyto!(Hcopy, @view(H[1:m, :]))) fill!(e, zero(T)); e[1] = one(T) # e is the [1,0,...,0] basis vector phiv_dense!(C2, Hcopy, e, k; cache=C1) # C2 = [ϕ0(H)e ϕ1(H)e ... ϕk(H)e] - scale!(beta, A_mul_B!(w, @view(V[:, 1:m]), C2)) # f(A) ≈ norm(b) * V * f(H)e + lmul!(beta, mul!(w, @view(V[:, 1:m]), C2)) # f(A) ≈ norm(b) * V * f(H)e if correct # Use the last Arnoldi vector for correction with little additional cost # correct_p = beta * h_{m+1,m} * (em^T phi_p+1(H) e1) * v_m+1 betah = beta * H[end,end] * t vlast = @view(V[:,end]) @inbounds for i = 1:k - Base.axpy!(betah * C2[end, i+1], vlast, @view(w[:, i])) + axpy!(betah * C2[end, i+1], vlast, @view(w[:, i])) end end if errest @@ -491,37 +493,37 @@ end Evaluates the matrix exponentiation-vector product using time stepping ```math -u = \\exp(tA)b +u = \\exp(tA)b ``` -`ts`` is an array of time snapshots for u, with `U[:,j] ≈ u(ts[j])`. `ts` can -also be just one value, in which case only the end result is returned and `U` +`ts`` is an array of time snapshots for u, with `U[:,j] ≈ u(ts[j])`. `ts` can +also be just one value, in which case only the end result is returned and `U` is a vector. -The time stepping formula of Niesen & Wright is used [^1]. If the time step -`tau` is not specified, it is chosen according to (17) of Neisen & Wright. If -`adaptive==true`, the time step and Krylov subsapce size adaptation scheme of -Niesen & Wright is used, the relative tolerance of which can be set using the -keyword parameter `tol`. The delta and gamma parameter of the adaptation +The time stepping formula of Niesen & Wright is used [^1]. If the time step +`tau` is not specified, it is chosen according to (17) of Neisen & Wright. If +`adaptive==true`, the time step and Krylov subsapce size adaptation scheme of +Niesen & Wright is used, the relative tolerance of which can be set using the +keyword parameter `tol`. The delta and gamma parameter of the adaptation scheme can also be adjusted. -Set `verbose=true` to print out the internal steps (for debugging). For the -other keyword arguments, consult `arnoldi` and `phiv`, which are used +Set `verbose=true` to print out the internal steps (for debugging). For the +other keyword arguments, consult `arnoldi` and `phiv`, which are used internally. -Note that this function is just a special case of `phiv_timestep` with a more +Note that this function is just a special case of `phiv_timestep` with a more intuitive interface (vector `b` instead of a n-by-1 matrix `B`). -[^1]: Niesen, J., & Wright, W. (2009). A Krylov subspace algorithm for -evaluating the φ-functions in exponential integrators. arXiv preprint +[^1]: Niesen, J., & Wright, W. (2009). A Krylov subspace algorithm for +evaluating the φ-functions in exponential integrators. arXiv preprint arXiv:0907.4631. """ function expv_timestep(ts::Vector{tType}, A, b; kwargs...) where {tType <: Real} - U = Matrix{eltype(A)}(size(A, 1), length(ts)) + U = Matrix{eltype(A)}(undef, size(A, 1), length(ts)) expv_timestep!(U, ts, A, b; kwargs...) end function expv_timestep(t::tType, A, b; kwargs...) where {tType <: Real} - u = Vector{eltype(A)}(size(A, 1)) + u = Vector{eltype(A)}(undef, size(A, 1)) expv_timestep!(u, t, A, b; kwargs...) end """ @@ -529,12 +531,12 @@ end Non-allocating version of `expv_timestep`. """ -function expv_timestep!(u::AbstractVector{T}, t::tType, A, b::AbstractVector{T}; +function expv_timestep!(u::AbstractVector{T}, t::tType, A, b::AbstractVector{T}; kwargs...) where {T <: Number, tType <: Real} expv_timestep!(reshape(u, length(u), 1), [t], A, b; kwargs...) return u end -function expv_timestep!(U::AbstractMatrix{T}, ts::Vector{tType}, A, b::AbstractVector{T}; +function expv_timestep!(U::AbstractMatrix{T}, ts::Vector{tType}, A, b::AbstractVector{T}; kwargs...) where {T <: Number, tType <: Real} B = reshape(b, length(b), 1) phiv_timestep!(U, ts, A, B; kwargs...) @@ -545,34 +547,34 @@ end Evaluates the linear combination of phi-vector products using time stepping ```math -u = \\varphi_0(tA)b_0 + t\\varphi_1(tA)b_1 + \\cdots + t^p\\varphi_p(tA)b_p +u = \\varphi_0(tA)b_0 + t\\varphi_1(tA)b_1 + \\cdots + t^p\\varphi_p(tA)b_p ``` -`ts`` is an array of time snapshots for u, with `U[:,j] ≈ u(ts[j])`. `ts` can -also be just one value, in which case only the end result is returned and `U` +`ts`` is an array of time snapshots for u, with `U[:,j] ≈ u(ts[j])`. `ts` can +also be just one value, in which case only the end result is returned and `U` is a vector. -The time stepping formula of Niesen & Wright is used [^1]. If the time step -`tau` is not specified, it is chosen according to (17) of Neisen & Wright. If -`adaptive==true`, the time step and Krylov subsapce size adaptation scheme of -Niesen & Wright is used, the relative tolerance of which can be set using the -keyword parameter `tol`. The delta and gamma parameter of the adaptation +The time stepping formula of Niesen & Wright is used [^1]. If the time step +`tau` is not specified, it is chosen according to (17) of Neisen & Wright. If +`adaptive==true`, the time step and Krylov subsapce size adaptation scheme of +Niesen & Wright is used, the relative tolerance of which can be set using the +keyword parameter `tol`. The delta and gamma parameter of the adaptation scheme can also be adjusted. -Set `verbose=true` to print out the internal steps (for debugging). For the -other keyword arguments, consult `arnoldi` and `phiv`, which are used +Set `verbose=true` to print out the internal steps (for debugging). For the +other keyword arguments, consult `arnoldi` and `phiv`, which are used internally. -[^1]: Niesen, J., & Wright, W. (2009). A Krylov subspace algorithm for -evaluating the φ-functions in exponential integrators. arXiv preprint +[^1]: Niesen, J., & Wright, W. (2009). A Krylov subspace algorithm for +evaluating the φ-functions in exponential integrators. arXiv preprint arXiv:0907.4631. """ function phiv_timestep(ts::Vector{tType}, A, B; kwargs...) where {tType <: Real} - U = Matrix{eltype(A)}(size(A, 1), length(ts)) + U = Matrix{eltype(A)}(undef, size(A, 1), length(ts)) phiv_timestep!(U, ts, A, B; kwargs...) end function phiv_timestep(t::tType, A, B; kwargs...) where {tType <: Real} - u = Vector{eltype(A)}(size(A, 1)) + u = Vector{eltype(A)}(undef, size(A, 1)) phiv_timestep!(u, t, A, B; kwargs...) end """ @@ -580,22 +582,22 @@ end Non-allocating version of `phiv_timestep`. """ -function phiv_timestep!(u::AbstractVector{T}, t::tType, A, B::AbstractMatrix{T}; +function phiv_timestep!(u::AbstractVector{T}, t::tType, A, B::AbstractMatrix{T}; kwargs...) where {T <: Number, tType <: Real} phiv_timestep!(reshape(u, length(u), 1), [t], A, B; kwargs...) return u end -function phiv_timestep!(U::AbstractMatrix{T}, ts::Vector{tType}, A, B::AbstractMatrix{T}; tau::Real=0.0, - m::Int=min(10, size(A, 1)), tol::Real=1e-7, norm=Base.norm, iop::Int=0, - correct::Bool=false, caches=nothing, adaptive=false, delta::Real=1.2, +function phiv_timestep!(U::AbstractMatrix{T}, ts::Vector{tType}, A, B::AbstractMatrix{T}; tau::Real=0.0, + m::Int=min(10, size(A, 1)), tol::Real=1e-7, opnorm=LinearAlgebra.opnorm, iop::Int=0, + correct::Bool=false, caches=nothing, adaptive=false, delta::Real=1.2, gamma::Real=0.8, NA::Int=0, verbose=false) where {T <: Number, tType <: Real} # Choose initial timestep - abstol = tol * norm(A, Inf) + abstol = tol * opnorm(A, Inf) verbose && println("Absolute tolerance: $abstol") if iszero(tau) - Anorm = norm(A, Inf) + Anorm = opnorm(A, Inf) b0norm = norm(@view(B[:, 1]), Inf) - tau = 10/Anorm * (abstol * ((m+1)/e)^(m+1) * sqrt(2*pi*(m+1)) / + tau = 10/Anorm * (abstol * ((m+1)/ℯ)^(m+1) * sqrt(2*pi*(m+1)) / (4*Anorm*b0norm))^(1/m) verbose && println("Initial time step unspecified, chosen to be $tau") end @@ -606,9 +608,9 @@ function phiv_timestep!(U::AbstractMatrix{T}, ts::Vector{tType}, A, B::AbstractM @assert length(ts) == size(U, 2) "Dimension mismatch" @assert n == size(A, 1) == size(A, 2) == size(B, 1) "Dimension mismatch" if caches == nothing - u = Vector{T}(n) # stores the current state - W = Matrix{T}(n, p+1) # stores the w vectors - P = Matrix{T}(n, p+2) # stores output from phiv! + u = Vector{T}(undef, n) # stores the current state + W = Matrix{T}(undef, n, p+1) # stores the w vectors + P = Matrix{T}(undef, n, p+2) # stores output from phiv! Ks = KrylovSubspace{T}(n, m) # stores output from arnoldi! phiv_cache = nothing # cache used by phiv! else @@ -618,7 +620,7 @@ function phiv_timestep!(U::AbstractMatrix{T}, ts::Vector{tType}, A, B::AbstractM W = @view(W[:, 1:p+1]) P = @view(P[:, 1:p+2]) end - copy!(u, @view(B[:, 1])) # u(0) = b0 + copyto!(u, @view(B[:, 1])) # u(0) = b0 coeffs = ones(tType, p); if adaptive # initialization step for the adaptive scheme if ishermitian(A) @@ -628,7 +630,7 @@ function phiv_timestep!(U::AbstractMatrix{T}, ts::Vector{tType}, A, B::AbstractM if isa(A, SparseMatrixCSC) NA = nnz(A) else - NA = countnz(A) # not constant operation, should be best avoided + NA = count(!iszero, A) # not constant operation, should be best avoided end end end @@ -640,18 +642,18 @@ function phiv_timestep!(U::AbstractMatrix{T}, ts::Vector{tType}, A, B::AbstractM tau = tend - t end # Part 1: compute w0...wp using the recurrence relation (16) - copy!(@view(W[:, 1]), u) # w0 = u(t) + copyto!(@view(W[:, 1]), u) # w0 = u(t) @inbounds for l = 1:p-1 # compute cl = t^l/l! coeffs[l+1] = coeffs[l] * t / l end @views @inbounds for j = 1:p - A_mul_B!(W[:, j+1], A, W[:, j]) + mul!(W[:, j+1], A, W[:, j]) for l = 0:p-j - Base.axpy!(coeffs[l+1], B[:, j+l+1], W[:, j+1]) + axpy!(coeffs[l+1], B[:, j+l+1], W[:, j+1]) end end # Part 2: compute ϕp(tau*A)wp using Krylov, possibly with adaptation - arnoldi!(Ks, A, @view(W[:, end]); tol=tol, m=m, norm=norm, iop=iop, cache=u) + arnoldi!(Ks, A, @view(W[:, end]); tol=tol, m=m, opnorm=opnorm, iop=iop, cache=u) _, epsilon = phiv!(P, tau, Ks, p + 1; cache=phiv_cache, correct=correct, errest=true) verbose && println("t = $t, m = $m, tau = $tau, error estimate = $epsilon") if adaptive @@ -660,12 +662,12 @@ function phiv_timestep!(U::AbstractMatrix{T}, ts::Vector{tType}, A, B::AbstractM q = m/4; kappa = 2.0; maxtau = tend - t while omega > delta # inner loop of Algorithm 3 m_new, tau_new, q, kappa = _phiv_timestep_adapt( - m, tau, epsilon, m_old, tau_old, epsilon_old, q, kappa, - gamma, omega, maxtau, n, p, NA, iop, norm(getH(Ks), 1), verbose) + m, tau, epsilon, m_old, tau_old, epsilon_old, q, kappa, + gamma, omega, maxtau, n, p, NA, iop, opnorm(getH(Ks), 1), verbose) m, m_old = m_new, m tau, tau_old = tau_new, tau # Compute ϕp(tau*A)wp using the new parameters - arnoldi!(Ks, A, @view(W[:, end]); tol=tol, m=m, norm=norm, iop=iop, cache=u) + arnoldi!(Ks, A, @view(W[:, end]); tol=tol, m=m, opnorm=opnorm, iop=iop, cache=u) _, epsilon_new = phiv!(P, tau, Ks, p + 1; cache=phiv_cache, correct=correct, errest=true) epsilon, epsilon_old = epsilon_new, epsilon omega = (tend / tau) * (epsilon / abstol) @@ -673,24 +675,24 @@ function phiv_timestep!(U::AbstractMatrix{T}, ts::Vector{tType}, A, B::AbstractM end end # Part 3: update u using (15) - scale!(tau^p, copy!(u, @view(P[:, end - 1]))) + lmul!(tau^p, copyto!(u, @view(P[:, end - 1]))) @inbounds for l = 1:p-1 # compute cl = tau^l/l! coeffs[l+1] = coeffs[l] * tau / l end @views @inbounds for j = 0:p-1 - Base.axpy!(coeffs[j+1], W[:, j+1], u) + axpy!(coeffs[j+1], W[:, j+1], u) end # Fill out all snapshots in between the current step while snapshot <= length(ts) && t + tau >= ts[snapshot] tau_snapshot = ts[snapshot] - t u_snapshot = @view(U[:, snapshot]) phiv!(P, tau_snapshot, Ks, p + 1; cache=phiv_cache, correct=correct) - scale!(tau_snapshot^p, copy!(u_snapshot, @view(P[:, end - 1]))) + lmul!(tau_snapshot^p, copyto!(u_snapshot, @view(P[:, end - 1]))) @inbounds for l = 1:p-1 # compute cl = tau^l/l! coeffs[l+1] = coeffs[l] * tau_snapshot / l end @views @inbounds for j = 0:p-1 - Base.axpy!(coeffs[j+1], W[:, j+1], u_snapshot) + axpy!(coeffs[j+1], W[:, j+1], u_snapshot) end snapshot += 1 end @@ -701,7 +703,7 @@ function phiv_timestep!(U::AbstractMatrix{T}, ts::Vector{tType}, A, B::AbstractM return U end # Helper functions for phiv_timestep! -function _phiv_timestep_adapt(m, tau, epsilon, m_old, tau_old, epsilon_old, q, kappa, +function _phiv_timestep_adapt(m, tau, epsilon, m_old, tau_old, epsilon_old, q, kappa, gamma, omega, maxtau, n, p, NA, iop, Hnorm, verbose) # Compute new m and tau (Algorithm 4) if tau_old > tau @@ -749,8 +751,8 @@ end function _phiv_timestep_caches(u_prototype, maxiter::Int, p::Int) n = length(u_prototype); T = eltype(u_prototype) u = similar(u_prototype) # stores the current state - W = Matrix{T}(n, p+1) # stores the w vectors - P = Matrix{T}(n, p+2) # stores output from phiv! + W = Matrix{T}(undef, n, p+1) # stores the w vectors + P = Matrix{T}(undef, n, p+2) # stores output from phiv! Ks = KrylovSubspace{T}(n, maxiter) # stores output from arnoldi! phiv_cache = PhivCache{T}(maxiter, p+1) # cache used by phiv! (need +1 for error estimation) return u, W, P, Ks, phiv_cache diff --git a/src/initdt.jl b/src/initdt.jl index b6acc230f5..e97af332a7 100644 --- a/src/initdt.jl +++ b/src/initdt.jl @@ -1,7 +1,8 @@ -@muladd function ode_determine_initdt{tType,uType}(u0,t,tdir,dtmax,abstol,reltol,internalnorm,prob::AbstractODEProblem{uType,tType,true},integrator) +@muladd function ode_determine_initdt(u0,t,tdir,dtmax,abstol,reltol,internalnorm,prob::DiffEqBase.AbstractODEProblem{uType,tType,true},integrator) where {tType,uType} + _tType = eltype(tType) f = prob.f p = integrator.p - oneunit_tType = oneunit(tType) + oneunit_tType = oneunit(_tType) dtmax_tdir = tdir*dtmax if eltype(u0) <: Number && !(typeof(integrator.alg) <: CompositeAlgorithm) @@ -30,7 +31,7 @@ #= Try/catch around the linear solving. This will catch singular matrices defined - by DAEs and thus we use the tType(1//10^(6)) default from Hairer. Note that + by DAEs and thus we use the _tType(1//10^(6)) default from Hairer. Note that this will not always catch singular matrices, an example from Andreas: julia> A = fill(rand(), 2, 2) @@ -53,7 +54,7 @@ large like shown there, but that later gets caught in the quick estimates below which then makes it spit out the default - dt₀ = tType(1//10^(6)) + dt₀ = _tType(1//10^(6)) so that is a a cheaper way to get to the same place than an svdfact and still works for matrix-free definitions of the mass matrix. @@ -65,28 +66,28 @@ integrator.alg.linsolve(ftmp, copy(prob.mass_matrix), f₀, true) f₀ .= ftmp catch - return tType(1//10^(6)) + return _tType(1//10^(6)) end end if any(isnan,f₀) - warn("First function call produced NaNs. Exiting.") + @warn("First function call produced NaNs. Exiting.") end @. tmp = f₀/sk*oneunit_tType d₁ = internalnorm(tmp) if d₀ < 1//10^(5) || d₁ < 1//10^(5) - dt₀ = tType(1//10^(6)) + dt₀ = _tType(1//10^(6)) else - dt₀ = tType((d₀/d₁)/100) + dt₀ = _tType((d₀/d₁)/100) end dt₀ = min(dt₀,dtmax_tdir) - if typeof(one(tType)) <: AbstractFloat && dt₀ < 10eps(tType)*oneunit(tType) + if typeof(one(_tType)) <: AbstractFloat && dt₀ < 10eps(_tType)*oneunit(_tType) # This catches Andreas' non-singular example # should act like it's singular - return tdir*tType(1//10^(6)) + return tdir*_tType(1//10^(6)) end dt₀_tdir = tdir*dt₀ @@ -107,17 +108,18 @@ max_d₁d₂ = max(d₁,d₂) if max_d₁d₂ <= 1//Int64(10)^(15) - dt₁ = max(tType(1//10^(6)),dt₀*1//10^(3)) + dt₁ = max(_tType(1//10^(6)),dt₀*1//10^(3)) else - dt₁ = tType(10.0^(-(2+log10(max_d₁d₂))/get_current_alg_order(integrator.alg,integrator.cache))) + dt₁ = _tType(10.0^(-(2+log10(max_d₁d₂))/get_current_alg_order(integrator.alg,integrator.cache))) end dt = tdir*min(100dt₀,dt₁,dtmax_tdir) end -@muladd function ode_determine_initdt{uType,tType}(u0,t,tdir,dtmax,abstol,reltol,internalnorm,prob::AbstractODEProblem{uType,tType,false},integrator) +@muladd function ode_determine_initdt(u0,t,tdir,dtmax,abstol,reltol,internalnorm,prob::DiffEqBase.AbstractODEProblem{uType,tType,false},integrator) where {uType,tType} + _tType = eltype(tType) f = prob.f p = prob.p - oneunit_tType = oneunit(tType) + oneunit_tType = oneunit(_tType) dtmax_tdir = tdir*dtmax sk = abstol+internalnorm(u0)*reltol @@ -131,9 +133,9 @@ end d₁ = internalnorm(f₀/sk*oneunit_tType) if d₀ < 1//10^(5) || d₁ < 1//10^(5) - dt₀ = tType(1//10^(6)) + dt₀ = _tType(1//10^(6)) else - dt₀ = tType((d₀/d₁)/100) + dt₀ = _tType((d₀/d₁)/100) end dt₀ = min(dt₀,dtmax_tdir) dt₀_tdir = tdir*dt₀ @@ -145,9 +147,9 @@ end max_d₁d₂ = max(d₁, d₂) if max_d₁d₂ <= 1//Int64(10)^(15) - dt₁ = max(tType(1//10^(6)),dt₀*1//10^(3)) + dt₁ = max(_tType(1//10^(6)),dt₀*1//10^(3)) else - dt₁ = tType(10.0^(-(2+log10(max_d₁d₂))/get_current_alg_order(integrator.alg,integrator.cache))) + dt₁ = _tType(10.0^(-(2+log10(max_d₁d₂))/get_current_alg_order(integrator.alg,integrator.cache))) end dt = tdir*min(100dt₀,dt₁,dtmax_tdir) end diff --git a/src/integrators/integrator_interface.jl b/src/integrators/integrator_interface.jl index 0fd1fe6d44..8a21fd960d 100644 --- a/src/integrators/integrator_interface.jl +++ b/src/integrators/integrator_interface.jl @@ -1,4 +1,4 @@ -function change_t_via_interpolation!{T}(integrator,t,modify_save_endpoint::Type{Val{T}}=Val{false}) +function change_t_via_interpolation!(integrator,t,modify_save_endpoint::Type{Val{T}}=Val{false}) where T # Can get rid of an allocation here with a function # get_tmp_arr(integrator.cache) which gives a pointer to some # cache array which can be modified. diff --git a/src/integrators/integrator_utils.jl b/src/integrators/integrator_utils.jl index 89c02246ae..4285092164 100644 --- a/src/integrators/integrator_utils.jl +++ b/src/integrators/integrator_utils.jl @@ -1,4 +1,4 @@ -save_idxsinitialize{uType}(integrator,cache::OrdinaryDiffEqCache,::Type{uType}) = +save_idxsinitialize(integrator,cache::OrdinaryDiffEqCache,::Type{uType}) where {uType} = error("This algorithm does not have an initialization function") function loopheader!(integrator) @@ -28,7 +28,7 @@ end last_step_failed(integrator::ODEIntegrator) = integrator.last_stepfail && !integrator.opts.adaptive -@def ode_exit_conditions begin +DiffEqBase.@def ode_exit_conditions begin if check_error!(integrator) != :Success return integrator.sol end @@ -120,7 +120,7 @@ function postamble!(integrator::ODEIntegrator) resize!(integrator.sol.t,integrator.saveiter) resize!(integrator.sol.u,integrator.saveiter) resize!(integrator.sol.k,integrator.saveiter_dense) - !(typeof(integrator.prog)<:Void) && Juno.done(integrator.prog) + !(typeof(integrator.prog)<:Nothing) && Juno.done(integrator.prog) end function solution_endpoint_match_cur_integrator!(integrator) @@ -293,7 +293,7 @@ function loopfooter!(integrator) integrator.dtpropose = integrator.dt handle_callbacks!(integrator) end - if !(typeof(integrator.prog)<:Void) && integrator.opts.progress && integrator.iter%integrator.opts.progress_steps==0 + if !(typeof(integrator.prog)<:Nothing) && integrator.opts.progress && integrator.iter%integrator.opts.progress_steps==0 Juno.msg(integrator.prog,integrator.opts.progress_message(integrator.dt,integrator.u,integrator.p,integrator.t)) Juno.progress(integrator.prog,integrator.t/integrator.sol.prob.tspan[2]) end @@ -368,7 +368,7 @@ function apply_step!(integrator) elseif get_current_isfsal(integrator.alg, integrator.cache) if integrator.reeval_fsal || integrator.u_modified || (typeof(integrator.alg)<:DP8 && !integrator.opts.calck) || (typeof(integrator.alg)<:Union{Rosenbrock23,Rosenbrock32} && !integrator.opts.adaptive) reset_fsal!(integrator) - else # Do not reeval_fsal, instead copy! over + else # Do not reeval_fsal, instead copyto! over if isinplace(integrator.sol.prob) recursivecopy!(integrator.fsalfirst,integrator.fsallast) else diff --git a/src/integrators/type.jl b/src/integrators/type.jl index b9cac45805..feb557060e 100644 --- a/src/integrators/type.jl +++ b/src/integrators/type.jl @@ -1,4 +1,4 @@ -mutable struct DEOptions{absType,relType,QT,tType,F2,F3,F4,F5,F6,tstopsType,discType,ECType,SType,MI,tcache,savecache,disccache} +mutable struct DEOptions{absType,relType,QT,tType,F1,F2,F3,F4,F5,F6,tstopsType,discType,ECType,SType,MI,tcache,savecache,disccache} maxiters::MI timeseries_steps::Int save_everystep::Bool @@ -13,7 +13,8 @@ mutable struct DEOptions{absType,relType,QT,tType,F2,F3,F4,F5,F6,tstopsType,disc failfactor::QT dtmax::tType dtmin::tType - internalnorm::F2 + internalnorm::F1 + internalopnorm::F2 save_idxs::SType tstops::tstopsType saveat::tstopsType @@ -73,7 +74,7 @@ integrator.opts.abstol = 1e-9 ``` For more info see the linked documentation page. """ -mutable struct ODEIntegrator{algType<:OrdinaryDiffEqAlgorithm,uType,tType,pType,eigenType,QT,tdirType,ksEltype,SolType,F,ProgressType,CacheType,O,FSALType} <: AbstractODEIntegrator +mutable struct ODEIntegrator{algType<:OrdinaryDiffEqAlgorithm,uType,tType,pType,eigenType,QT,tdirType,ksEltype,SolType,F,ProgressType,CacheType,O,FSALType} <: DiffEqBase.AbstractODEIntegrator sol::SolType u::uType k::ksEltype @@ -114,15 +115,15 @@ mutable struct ODEIntegrator{algType<:OrdinaryDiffEqAlgorithm,uType,tType,pType, fsalfirst::FSALType fsallast::FSALType - function (::Type{ODEIntegrator{algType,uType,tType,pType,eigenType,tTypeNoUnits,tdirType,ksEltype,SolType, - F,ProgressType,CacheType,O,FSALType}}){algType,uType,tType,pType,eigenType,tTypeNoUnits,tdirType,ksEltype,SolType, + function ODEIntegrator{algType,uType,tType,pType,eigenType,tTypeNoUnits,tdirType,ksEltype,SolType, F,ProgressType,CacheType,O,FSALType}( sol,u,k,t,dt,f,p,uprev,uprev2,tprev, alg,dtcache,dtchangeable,dtpropose,tdir, eigen_est,EEst,qold,q11,erracc,dtacc,success_iter, iter,saveiter,saveiter_dense,prog,cache, kshortsize,force_stepfail,last_stepfail,just_hit_tstop, - event_last_time,accept_step,isout,reeval_fsal,u_modified,opts) + event_last_time,accept_step,isout,reeval_fsal,u_modified,opts) where {algType,uType,tType,pType,eigenType,tTypeNoUnits,tdirType,ksEltype,SolType, + F,ProgressType,CacheType,O,FSALType} new{algType,uType,tType,pType,eigenType,tTypeNoUnits,tdirType,ksEltype,SolType, F,ProgressType,CacheType,O,FSALType}( diff --git a/src/interp_func.jl b/src/interp_func.jl index dd61f206bd..49d9055caa 100644 --- a/src/interp_func.jl +++ b/src/interp_func.jl @@ -1,4 +1,4 @@ -abstract type OrdinaryDiffEqInterpolation{cacheType} <: AbstractDiffEqInterpolation end +abstract type OrdinaryDiffEqInterpolation{cacheType} <: DiffEqBase.AbstractDiffEqInterpolation end struct InterpolationData{F,uType,tType,kType,cacheType} <: OrdinaryDiffEqInterpolation{cacheType} f::F @@ -19,51 +19,51 @@ struct CompositeInterpolationData{F,uType,tType,kType,cacheType} <: OrdinaryDiff cache::cacheType end -DiffEqBase.interp_summary{cacheType<:FunctionMapConstantCache}(interp::OrdinaryDiffEqInterpolation{cacheType}) = "left-endpoint piecewise constant" -DiffEqBase.interp_summary{cacheType<:FunctionMapCache}(interp::OrdinaryDiffEqInterpolation{cacheType}) = "left-endpoint piecewise constant" -function DiffEqBase.interp_summary{cacheType<:Union{DP5ConstantCache,DP5Cache,DP5ThreadedCache}}(interp::OrdinaryDiffEqInterpolation{cacheType}) +DiffEqBase.interp_summary(interp::OrdinaryDiffEqInterpolation{cacheType}) where {cacheType<:FunctionMapConstantCache} = "left-endpoint piecewise constant" +DiffEqBase.interp_summary(interp::OrdinaryDiffEqInterpolation{cacheType}) where {cacheType<:FunctionMapCache} = "left-endpoint piecewise constant" +function DiffEqBase.interp_summary(interp::OrdinaryDiffEqInterpolation{cacheType}) where cacheType<:Union{DP5ConstantCache,DP5Cache,DP5ThreadedCache} interp.dense ? "specialized 4th order \"free\" interpolation" : "1st order linear" end -function DiffEqBase.interp_summary{cacheType<:Union{Rosenbrock23ConstantCache,Rosenbrock32ConstantCache,Rosenbrock23Cache,Rosenbrock32Cache}}(interp::OrdinaryDiffEqInterpolation{cacheType}) +function DiffEqBase.interp_summary(interp::OrdinaryDiffEqInterpolation{cacheType}) where cacheType<:Union{Rosenbrock23ConstantCache,Rosenbrock32ConstantCache,Rosenbrock23Cache,Rosenbrock32Cache} interp.dense ? "specialized 2nd order \"free\" stiffness-aware interpolation" : "1st order linear" end -function DiffEqBase.interp_summary{cacheType<:Union{Rodas4ConstantCache,Rodas4Cache}}(interp::OrdinaryDiffEqInterpolation{cacheType}) +function DiffEqBase.interp_summary(interp::OrdinaryDiffEqInterpolation{cacheType}) where cacheType<:Union{Rodas4ConstantCache,Rodas4Cache} interp.dense ? "specialized 3rd order \"free\" stiffness-aware interpolation" : "1st order linear" end -function DiffEqBase.interp_summary{cacheType<:Union{SSPRK22,SSPRK22ConstantCache,SSPRK33,SSPRK33ConstantCache,SSPRK432,SSPRK432ConstantCache}}(interp::OrdinaryDiffEqInterpolation{cacheType}) +function DiffEqBase.interp_summary(interp::OrdinaryDiffEqInterpolation{cacheType}) where cacheType<:Union{SSPRK22,SSPRK22ConstantCache,SSPRK33,SSPRK33ConstantCache,SSPRK432,SSPRK432ConstantCache} interp.dense ? "2nd order \"free\" SSP interpolation" : "1st order linear" end -function DiffEqBase.interp_summary{cacheType<:Union{OwrenZen3Cache,OwrenZen3ConstantCache}}(interp::OrdinaryDiffEqInterpolation{cacheType}) +function DiffEqBase.interp_summary(interp::OrdinaryDiffEqInterpolation{cacheType}) where cacheType<:Union{OwrenZen3Cache,OwrenZen3ConstantCache} interp.dense ? "specialized 3rd order \"free\" interpolation" : "1st order linear" end -function DiffEqBase.interp_summary{cacheType<:Union{OwrenZen4Cache,OwrenZen4ConstantCache}}(interp::OrdinaryDiffEqInterpolation{cacheType}) +function DiffEqBase.interp_summary(interp::OrdinaryDiffEqInterpolation{cacheType}) where cacheType<:Union{OwrenZen4Cache,OwrenZen4ConstantCache} interp.dense ? "specialized 4th order \"free\" interpolation" : "1st order linear" end -function DiffEqBase.interp_summary{cacheType<:Union{OwrenZen5Cache,OwrenZen5ConstantCache}}(interp::OrdinaryDiffEqInterpolation{cacheType}) +function DiffEqBase.interp_summary(interp::OrdinaryDiffEqInterpolation{cacheType}) where cacheType<:Union{OwrenZen5Cache,OwrenZen5ConstantCache} interp.dense ? "specialized 5th order \"free\" interpolation" : "1st order linear" end -function DiffEqBase.interp_summary{cacheType<:Union{Tsit5Cache,Tsit5ConstantCache}}(interp::OrdinaryDiffEqInterpolation{cacheType}) +function DiffEqBase.interp_summary(interp::OrdinaryDiffEqInterpolation{cacheType}) where cacheType<:Union{Tsit5Cache,Tsit5ConstantCache} interp.dense ? "specialized 4th order \"free\" interpolation" : "1st order linear" end -function DiffEqBase.interp_summary{cacheType<:Union{BS5ConstantCache,BS5Cache}}(interp::OrdinaryDiffEqInterpolation{cacheType}) +function DiffEqBase.interp_summary(interp::OrdinaryDiffEqInterpolation{cacheType}) where cacheType<:Union{BS5ConstantCache,BS5Cache} interp.dense ? "specialized 5th order lazy interpolation" : "1st order linear" end -function DiffEqBase.interp_summary{cacheType<:Union{Vern6Cache,Vern6ConstantCache}}(interp::OrdinaryDiffEqInterpolation{cacheType}) +function DiffEqBase.interp_summary(interp::OrdinaryDiffEqInterpolation{cacheType}) where cacheType<:Union{Vern6Cache,Vern6ConstantCache} interp.dense ? "specialized 6th order lazy interpolation" : "1st order linear" end -function DiffEqBase.interp_summary{cacheType<:Union{Vern7Cache,Vern7ConstantCache}}(interp::OrdinaryDiffEqInterpolation{cacheType}) +function DiffEqBase.interp_summary(interp::OrdinaryDiffEqInterpolation{cacheType}) where cacheType<:Union{Vern7Cache,Vern7ConstantCache} interp.dense ? "specialized 7th order lazy interpolation" : "1st order linear" end -function DiffEqBase.interp_summary{cacheType<:Union{Vern8Cache,Vern8ConstantCache}}(interp::OrdinaryDiffEqInterpolation{cacheType}) +function DiffEqBase.interp_summary(interp::OrdinaryDiffEqInterpolation{cacheType}) where cacheType<:Union{Vern8Cache,Vern8ConstantCache} interp.dense ? "specialized 8th order lazy interpolation" : "1st order linear" end -function DiffEqBase.interp_summary{cacheType<:Union{Vern9Cache,Vern9ConstantCache}}(interp::OrdinaryDiffEqInterpolation{cacheType}) +function DiffEqBase.interp_summary(interp::OrdinaryDiffEqInterpolation{cacheType}) where cacheType<:Union{Vern9Cache,Vern9ConstantCache} interp.dense ? "specialized 9th order lazy interpolation" : "1st order linear" end -function DiffEqBase.interp_summary{cacheType<:Union{DP8ConstantCache,DP8Cache}}(interp::OrdinaryDiffEqInterpolation{cacheType}) +function DiffEqBase.interp_summary(interp::OrdinaryDiffEqInterpolation{cacheType}) where cacheType<:Union{DP8ConstantCache,DP8Cache} interp.dense ? "specialized 7th order interpolation" : "1st order linear" end -function DiffEqBase.interp_summary{cacheType}(interp::OrdinaryDiffEqInterpolation{cacheType}) +function DiffEqBase.interp_summary(interp::OrdinaryDiffEqInterpolation{cacheType}) where cacheType interp.dense ? "3rd order Hermite" : "1st order linear" end diff --git a/src/misc_utils.jl b/src/misc_utils.jl index 067e47f30e..40c8dd2a65 100644 --- a/src/misc_utils.jl +++ b/src/misc_utils.jl @@ -1,24 +1,24 @@ struct DiffEqNLSolveTag end -immutable DiffCache{T<:AbstractArray, S<:AbstractArray} +struct DiffCache{T<:AbstractArray, S<:AbstractArray} du::T dual_du::S end -Base.@pure function DiffCache{chunk_size}(T, size, ::Type{Val{chunk_size}}) - DiffCache(zeros(T, size...), zeros(Dual{typeof(ForwardDiff.Tag(DiffEqNLSolveTag(),T)),T,chunk_size}, size...)) +Base.@pure function DiffCache(T, size, ::Type{Val{chunk_size}}) where chunk_size + DiffCache(fill(zero(T), size...), fill(zero(Dual{typeof(ForwardDiff.Tag(DiffEqNLSolveTag(),T)),T,chunk_size}), size...)) end Base.@pure DiffCache(u::AbstractArray) = DiffCache(eltype(u),size(u),Val{ForwardDiff.pickchunksize(length(u))}) Base.@pure DiffCache(u::AbstractArray,nlsolve) = DiffCache(eltype(u),size(u),Val{get_chunksize(nlsolve)}) -Base.@pure DiffCache{CS}(u::AbstractArray,T::Type{Val{CS}}) = DiffCache(eltype(u),size(u),T) +Base.@pure DiffCache(u::AbstractArray,T::Type{Val{CS}}) where {CS} = DiffCache(eltype(u),size(u),T) -get_du{T<:Dual}(dc::DiffCache, ::Type{T}) = dc.dual_du +get_du(dc::DiffCache, ::Type{T}) where {T<:Dual} = dc.dual_du get_du(dc::DiffCache, T) = dc.du # Default nlsolve behavior, should move to DiffEqDiffTools.jl -Base.@pure determine_chunksize(u,alg::DEAlgorithm) = determine_chunksize(u,get_chunksize(alg)) +Base.@pure determine_chunksize(u,alg::DiffEqBase.DEAlgorithm) = determine_chunksize(u,get_chunksize(alg)) Base.@pure function determine_chunksize(u,CS) if CS != 0 return CS @@ -30,14 +30,14 @@ end struct NLSOLVEJL_SETUP{CS,AD} end Base.@pure NLSOLVEJL_SETUP(;chunk_size=0,autodiff=true) = NLSOLVEJL_SETUP{chunk_size,autodiff}() (::NLSOLVEJL_SETUP)(f,u0; kwargs...) = (res=NLsolve.nlsolve(f,u0; kwargs...); res.zero) -function (p::NLSOLVEJL_SETUP{CS,AD}){CS,AD}(::Type{Val{:init}},f,u0_prototype) +function (p::NLSOLVEJL_SETUP{CS,AD})(::Type{Val{:init}},f,u0_prototype) where {CS,AD} AD ? autodiff = :forward : autodiff = :central OnceDifferentiable(f, u0_prototype, u0_prototype, autodiff, ForwardDiff.Chunk(determine_chunksize(u0_prototype,CS))) end get_chunksize(x) = 0 -get_chunksize{CS,AD}(x::NLSOLVEJL_SETUP{CS,AD}) = CS +get_chunksize(x::NLSOLVEJL_SETUP{CS,AD}) where {CS,AD} = CS """ calculate_residuals!(out, ũ, u₀, u₁, α, ρ) diff --git a/src/nlsolve_utils.jl b/src/nlsolve_utils.jl index d81eae4072..770135613f 100644 --- a/src/nlsolve_utils.jl +++ b/src/nlsolve_utils.jl @@ -79,11 +79,11 @@ function diffeq_nlsolve!(integrator, if mass_matrix == I @. b = dt*k - z else - A_mul_B!(vec(b),mass_matrix,vec(z)) + mul!(vec(b),mass_matrix,vec(z)) @. b = dt*k - b end - if has_invW(f) - A_mul_B!(vec(dz),W,vec(b)) # Here W is actually invW + if DiffEqBase.DiffEqBase.has_invW(f) + mul!(vec(dz),W,vec(b)) # Here W is actually invW else cache.linsolve(vec(dz),W,vec(b),new_W) end @@ -102,11 +102,11 @@ function diffeq_nlsolve!(integrator, if mass_matrix == I @. b = dt*k - z else - A_mul_B!(vec(b),mass_matrix,vec(z)) + mul!(vec(b),mass_matrix,vec(z)) @. b = dt*k - b end - if has_invW(f) - A_mul_B!(vec(dz),W,vec(b)) # Here W is actually invW + if DiffEqBase.DiffEqBase.has_invW(f) + mul!(vec(dz),W,vec(b)) # Here W is actually invW else cache.linsolve(vec(dz),W,vec(b),false) end diff --git a/src/nordsieck_utils.jl b/src/nordsieck_utils.jl index 5ceafcc0ca..ccbaea6351 100644 --- a/src/nordsieck_utils.jl +++ b/src/nordsieck_utils.jl @@ -240,7 +240,7 @@ function nlsolve_functional!(integrator, cache::T) where T # @show norm(cache.Δ - (integrator.u - z[1])) # It only makes sense to calculate convergence rate in the second iteration δ = integrator.opts.internalnorm(cache.Δ) - isconstcache ? ( cache.Δ = copy(ratetmp) ) : copy!(cache.Δ, ratetmp) + isconstcache ? ( cache.Δ = copy(ratetmp) ) : copyto!(cache.Δ, ratetmp) if k >= 1 conv_rate = max(1//10*conv_rate, δ/δ_prev) end @@ -267,7 +267,7 @@ function nordsieck_rescale!(cache::T, rewind=false) where T if isconstcache z[i] = z[i]*factor else - scale!(z[i], factor) + rmul!(z[i], factor) end factor *= eta end diff --git a/src/perform_step/adams_bashforth_moulton_perform_step.jl b/src/perform_step/adams_bashforth_moulton_perform_step.jl index 4bedad33d0..f48e421a98 100644 --- a/src/perform_step/adams_bashforth_moulton_perform_step.jl +++ b/src/perform_step/adams_bashforth_moulton_perform_step.jl @@ -1,7 +1,7 @@ function initialize!(integrator,cache::AB3ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -81,7 +81,7 @@ end function initialize!(integrator,cache::ABM32ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -161,7 +161,7 @@ end function initialize!(integrator,cache::AB4ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -253,7 +253,7 @@ end function initialize!(integrator,cache::ABM43ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -348,7 +348,7 @@ end function initialize!(integrator,cache::AB5ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -446,7 +446,7 @@ end function initialize!(integrator,cache::ABM54ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -550,7 +550,7 @@ end function initialize!(integrator,cache::VCAB3ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -671,7 +671,7 @@ end function initialize!(integrator,cache::VCAB4ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -806,7 +806,7 @@ end function initialize!(integrator,cache::VCAB5ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -955,7 +955,7 @@ end function initialize!(integrator,cache::VCABM3ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -1084,7 +1084,7 @@ end function initialize!(integrator,cache::VCABM4ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -1225,7 +1225,7 @@ end function initialize!(integrator,cache::VCABM5ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -1387,7 +1387,7 @@ end function initialize!(integrator,cache::VCABMConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -1539,7 +1539,7 @@ end function initialize!(integrator,cache::CNAB2ConstantCache) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f.f1(integrator.uprev,integrator.p,integrator.t) + integrator.f.f2(integrator.uprev,integrator.p,integrator.t) # Pre-start fsal @@ -1635,7 +1635,7 @@ end function initialize!(integrator,cache::CNLF2ConstantCache) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f.f1(integrator.uprev,integrator.p,integrator.t) + integrator.f.f2(integrator.uprev,integrator.p,integrator.t) # Pre-start fsal diff --git a/src/perform_step/bdf_perform_step.jl b/src/perform_step/bdf_perform_step.jl index 7401e5c38c..5b22c70413 100644 --- a/src/perform_step/bdf_perform_step.jl +++ b/src/perform_step/bdf_perform_step.jl @@ -1,6 +1,6 @@ function initialize!(integrator, cache::ABDF2ConstantCache) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays @@ -148,7 +148,7 @@ end function initialize!(integrator, cache::QNDF1ConstantCache) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays diff --git a/src/perform_step/euler_imex_perform_step.jl b/src/perform_step/euler_imex_perform_step.jl index 6cfdb779c3..95f5011718 100644 --- a/src/perform_step/euler_imex_perform_step.jl +++ b/src/perform_step/euler_imex_perform_step.jl @@ -1,6 +1,6 @@ function initialize!(integrator, cache::IMEXEulerConstantCache) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays diff --git a/src/perform_step/explicit_rk_perform_step.jl b/src/perform_step/explicit_rk_perform_step.jl index e1bbf80eb6..7edd07affe 100644 --- a/src/perform_step/explicit_rk_perform_step.jl +++ b/src/perform_step/explicit_rk_perform_step.jl @@ -1,6 +1,6 @@ function initialize!(integrator, cache::ExplicitRKConstantCache) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Avoid undefined entries if k is an array of arrays diff --git a/src/perform_step/exponential_rk_perform_step.jl b/src/perform_step/exponential_rk_perform_step.jl index de9a26b2d9..d02936f0c0 100644 --- a/src/perform_step/exponential_rk_perform_step.jl +++ b/src/perform_step/exponential_rk_perform_step.jl @@ -1,10 +1,12 @@ +using LinearAlgebra: axpy! + # Helper function to compute the G_nj factors for the classical ExpRK methods @inline _compute_nl(f::SplitFunction, u, p, t, A) = f.f2(u, p, t) -@inline _compute_nl(f::DiffEqFunction, u, p, t, A) = f(u, p, t) - A * u +@inline _compute_nl(f::ODEFunction, u, p, t, A) = f(u, p, t) - A * u @inline _compute_nl!(G, f::SplitFunction, u, p, t, A, Au_cache) = f.f2(G, u, p, t) -@inline function _compute_nl!(G, f::DiffEqFunction, u, p, t, A, Au_cache) +@inline function _compute_nl!(G, f::ODEFunction, u, p, t, A, Au_cache) f(G, u, p, t) - A_mul_B!(Au_cache, A, u) + mul!(Au_cache, A, u) G .-= Au_cache end @@ -17,7 +19,7 @@ function initialize!(integrator, cache::ExpRKConstantCache) # Initialize interpolation derivatives integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast end @@ -44,7 +46,7 @@ function perform_step!(integrator, cache::LawsonEulerConstantCache, repeat_step= nl = _compute_nl(f, uprev, p, t, A) @muladd v = uprev + dt * nl if alg.krylov - u = expv(dt, A, v; m=min(alg.m, size(A,1)), norm=integrator.opts.internalnorm, iop=alg.iop) + u = expv(dt, A, v; m=min(alg.m, size(A,1)), opnorm=integrator.opts.internalopnorm, iop=alg.iop) else exphA = cache.ops u = exphA * v @@ -67,11 +69,11 @@ function perform_step!(integrator, cache::LawsonEulerCache, repeat_step=false) @muladd @. tmp = uprev + dt*G if alg.krylov Ks, expv_cache = KsCache - arnoldi!(Ks, f.f1, tmp; m=min(alg.m, size(f.f1,1)), norm=integrator.opts.internalnorm, + arnoldi!(Ks, f.f1, tmp; m=min(alg.m, size(f.f1,1)), opnorm=integrator.opts.internalopnorm, cache=u, iop=alg.iop) expv!(u,dt,Ks; cache=expv_cache) else - A_mul_B!(u,exphA,tmp) + mul!(u,exphA,tmp) end # Update integrator state @@ -85,8 +87,8 @@ function perform_step!(integrator, cache::NorsettEulerConstantCache, repeat_step alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg if alg.krylov - w = phiv(dt, A, integrator.fsalfirst, 1; m=min(alg.m, size(A,1)), - norm=integrator.opts.internalnorm, iop=alg.iop) + w = phiv(dt, A, integrator.fsalfirst, 1; m=min(alg.m, size(A,1)), + opnorm=integrator.opts.internalopnorm, iop=alg.iop) u = uprev + dt * w[:,2] else phihA = cache.ops @@ -108,12 +110,12 @@ function perform_step!(integrator, cache::NorsettEulerCache, repeat_step=false) if alg.krylov Ks, phiv_cache, ws = KsCache; w = ws[1] - arnoldi!(Ks, A, integrator.fsalfirst; m=min(alg.m, size(A,1)), norm=integrator.opts.internalnorm, + arnoldi!(Ks, A, integrator.fsalfirst; m=min(alg.m, size(A,1)), opnorm=integrator.opts.internalopnorm, cache=u, iop=alg.iop) phiv!(w, dt, Ks, 1; cache=phiv_cache) @muladd @. u = uprev + dt * @view(w[:, 2]) else - A_mul_B!(rtmp, cache.phihA, integrator.fsalfirst) + mul!(rtmp, cache.phihA, integrator.fsalfirst) @muladd @. u = uprev + dt*rtmp end @@ -129,10 +131,10 @@ function perform_step!(integrator, cache::ETDRK2ConstantCache, repeat_step=false if alg.krylov F1 = integrator.fsalfirst - w1 = phiv(dt, A, F1, 2; m=min(alg.m, size(A,1)), norm=integrator.opts.internalnorm, iop=alg.iop) + w1 = phiv(dt, A, F1, 2; m=min(alg.m, size(A,1)), opnorm=integrator.opts.internalopnorm, iop=alg.iop) U2 = uprev + dt * w1[:, 2] F2 = _compute_nl(f, U2, p, t + dt, A) + A * uprev - w2 = phiv(dt, A, F2, 2; m=min(alg.m, size(A,1)), norm=integrator.opts.internalnorm, iop=alg.iop) + w2 = phiv(dt, A, F2, 2; m=min(alg.m, size(A,1)), opnorm=integrator.opts.internalopnorm, iop=alg.iop) u = uprev + dt * (w1[:, 2] - w1[:, 3] + w2[:, 3]) else phi1, phi2 = cache.ops @@ -162,25 +164,25 @@ function perform_step!(integrator, cache::ETDRK2Cache, repeat_step=false) Ks, phiv_cache, ws = KsCache w1, w2 = ws # Krylov for F1 - arnoldi!(Ks, A, F1; m=min(alg.m, size(A,1)), norm=integrator.opts.internalnorm, cache=tmp, iop=alg.iop) + arnoldi!(Ks, A, F1; m=min(alg.m, size(A,1)), opnorm=integrator.opts.internalopnorm, cache=tmp, iop=alg.iop) phiv!(w1, dt, Ks, 2; cache=phiv_cache) # Krylov for F2 @muladd @. tmp = uprev + dt * @view(w1[:, 2]) _compute_nl!(F2, f, tmp, p, t + dt, A, rtmp) - F2 .+= A_mul_B!(rtmp, A, uprev) - arnoldi!(Ks, A, F2; m=min(alg.m, size(A,1)), norm=integrator.opts.internalnorm, cache=tmp, iop=alg.iop) + F2 .+= mul!(rtmp, A, uprev) + arnoldi!(Ks, A, F2; m=min(alg.m, size(A,1)), opnorm=integrator.opts.internalopnorm, cache=tmp, iop=alg.iop) phiv!(w2, dt, Ks, 2; cache=phiv_cache) # Update u u .= uprev - Base.axpy!( dt, @view(w1[:, 2]), u) - Base.axpy!(-dt, @view(w1[:, 3]), u) - Base.axpy!( dt, @view(w2[:, 3]), u) + axpy!( dt, @view(w1[:, 2]), u) + axpy!(-dt, @view(w1[:, 3]), u) + axpy!( dt, @view(w2[:, 3]), u) else phi1, phi2 = cache.ops F1 = integrator.fsalfirst # The caching version uses a special formula to save computation # Compute U2 - A_mul_B!(rtmp, phi1, F1) + mul!(rtmp, phi1, F1) @muladd @. tmp = uprev + dt * rtmp # tmp is U2 # Compute G2 - G1, storing result in the cache F2 f.f2(rtmp, uprev, p, t) @@ -188,7 +190,7 @@ function perform_step!(integrator, cache::ETDRK2Cache, repeat_step=false) F2 .-= rtmp # "F2" is G2 - G1 # Update u u .= tmp - Base.axpy!(dt, A_mul_B!(rtmp, phi2, F2), u) + axpy!(dt, mul!(rtmp, phi2, F2), u) end # Update integrator state @@ -204,8 +206,7 @@ function perform_step!(integrator, cache::ETDRK3ConstantCache, repeat_step=false Au = A * uprev F1 = integrator.fsalfirst if alg.krylov - # TODO: change to named tuple in v0.7 - kwargs = [(:m, min(alg.m, size(A,1))), (:norm, integrator.opts.internalnorm), (:iop, alg.iop)] + kwargs = (m=min(alg.m, size(A,1)), opnorm=integrator.opts.internalopnorm, iop=alg.iop) # Krylov on F1 (first column) Ks = arnoldi(A, F1; kwargs...) w1_half = phiv(dt/2, Ks, 1) @@ -248,13 +249,12 @@ function perform_step!(integrator, cache::ETDRK3Cache, repeat_step=false) alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg F1 = integrator.fsalfirst - A_mul_B!(Au, A, uprev) + mul!(Au, A, uprev) halfdt = dt/2 if alg.krylov Ks, phiv_cache, ws = KsCache w1_half, w1, w2, w3 = ws - # TODO: change to named tuple in v0.7 - kwargs = [(:m, min(alg.m, size(A,1))), (:norm, integrator.opts.internalnorm), (:iop, alg.iop), (:cache, tmp)] + kwargs = (m=min(alg.m, size(A,1)), opnorm=integrator.opts.internalopnorm, iop=alg.iop, cache=tmp) # Krylov for F1 (first column) arnoldi!(Ks, A, F1; kwargs...) phiv!(w1_half, halfdt, Ks, 1; cache=phiv_cache) @@ -276,19 +276,19 @@ function perform_step!(integrator, cache::ETDRK3Cache, repeat_step=false) A21, A3, B1, B2, B3 = cache.ops # stage 1 (fsaled) # stage 2 - A_mul_B!(rtmp, A21, F1) + mul!(rtmp, A21, F1) @muladd @. tmp = uprev + dt * rtmp # tmp is U2 f.f2(F2, tmp, p, t + halfdt); F2 .+= Au # stage 3 @muladd @. F3 = 2 * F2 - F1 # use F3 temporarily as cache - A_mul_B!(rtmp, A3, F3) + mul!(rtmp, A3, F3) @muladd @. tmp = uprev + dt * rtmp # tmp is U3 f.f2(F3, tmp, p, t + dt); F3 .+= Au # update u u .= uprev - Base.axpy!(dt, A_mul_B!(rtmp, B1, F1), u) - Base.axpy!(dt, A_mul_B!(rtmp, B2, F2), u) - Base.axpy!(dt, A_mul_B!(rtmp, B3, F3), u) + axpy!(dt, mul!(rtmp, B1, F1), u) + axpy!(dt, mul!(rtmp, B2, F2), u) + axpy!(dt, mul!(rtmp, B3, F3), u) end # Update integrator state @@ -305,8 +305,7 @@ function perform_step!(integrator, cache::ETDRK4ConstantCache, repeat_step=false F1 = integrator.fsalfirst halfdt = dt/2 if alg.krylov - # TODO: change to named tuple in v0.7 - kwargs = [(:m, min(alg.m, size(A,1))), (:norm, integrator.opts.internalnorm), (:iop, alg.iop)] + kwargs = (m=min(alg.m, size(A,1)), opnorm=integrator.opts.internalopnorm, iop=alg.iop) # Krylov on F1 (first column) Ks = arnoldi(A, F1; kwargs...) w1_half = phiv(halfdt, Ks, 1) @@ -329,7 +328,7 @@ function perform_step!(integrator, cache::ETDRK4ConstantCache, repeat_step=false # Krylov on F4 (fourth column) w4 = phiv(dt, A, F4, 3; kwargs...) # update u - u = uprev + dt * (w1[:,2] - 3w1[:,3] + 4w1[:,4] + 2w2[:,3] - 4w2[:,4] + + u = uprev + dt * (w1[:,2] - 3w1[:,3] + 4w1[:,4] + 2w2[:,3] - 4w2[:,4] + 2w3[:,3] - 4w3[:,4] + 4w4[:,4] - w4[:,3]) else A21, A41, A43, B1, B2, B4 = cache.ops @@ -361,13 +360,12 @@ function perform_step!(integrator, cache::ETDRK4Cache, repeat_step=false) alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg F1 = integrator.fsalfirst - A_mul_B!(Au, A, uprev) + mul!(Au, A, uprev) halfdt = dt/2 if alg.krylov Ks, phiv_cache, ws = KsCache w1_half, w2_half, w1, w2, w3, w4 = ws - # TODO: change to named tuple in v0.7 - kwargs = [(:m, min(alg.m, size(A,1))), (:norm, integrator.opts.internalnorm), (:iop, alg.iop), (:cache, tmp)] + kwargs = (m=min(alg.m, size(A,1)), opnorm=integrator.opts.internalopnorm, iop=alg.iop, cache=tmp) # Krylov for F1 (first column) arnoldi!(Ks, A, F1; kwargs...) phiv!(w1_half, halfdt, Ks, 1; cache=phiv_cache) @@ -386,7 +384,7 @@ function perform_step!(integrator, cache::ETDRK4Cache, repeat_step=false) phiv!(w3, dt, Ks, 3; cache=phiv_cache) # Extra Krylov for computing F4 # Compute rtmp = 2F3 - F1 - Au + A*U2 - A_mul_B!(rtmp, A, U2); @. rtmp += 2F3 - F1 - Au + mul!(rtmp, A, U2); @. rtmp += 2F3 - F1 - Au arnoldi!(Ks, A, rtmp; kwargs...) phiv!(w1_half, halfdt, Ks, 1; cache=phiv_cache) # original w1_half is no longer needed @muladd @. @views tmp = U2 + halfdt * w1_half[:, 2] # tmp is U4 @@ -402,23 +400,23 @@ function perform_step!(integrator, cache::ETDRK4Cache, repeat_step=false) A21, A41, A43, B1, B2, B4 = cache.ops # stage 1 (fsaled) # stage 2 - A_mul_B!(rtmp, A21, F1) + mul!(rtmp, A21, F1) @muladd @. tmp = uprev + dt * rtmp # tmp is U2 f.f2(F2, tmp, p, t + halfdt); F2 .+= Au # stage 3 - A_mul_B!(rtmp, A21, F2) # A32 = A21 + mul!(rtmp, A21, F2) # A32 = A21 @muladd @. tmp = uprev + dt * rtmp # tmp is U3 f.f2(F3, tmp, p, t + halfdt); F3 .+= Au # stage 4 @. tmp = uprev - Base.axpy!(dt, A_mul_B!(rtmp, A41, F1), tmp) - Base.axpy!(dt, A_mul_B!(rtmp, A43, F3), tmp) # tmp is U4 + axpy!(dt, mul!(rtmp, A41, F1), tmp) + axpy!(dt, mul!(rtmp, A43, F3), tmp) # tmp is U4 f.f2(F4, tmp, p, t + dt); F4 .+= Au # update u u .= uprev - Base.axpy!(dt, A_mul_B!(rtmp, B1, F1), u) - F2 .+= F3; Base.axpy!(dt, A_mul_B!(rtmp, B2, F2), u) # B3 = B2 - Base.axpy!(dt, A_mul_B!(rtmp, B4, F4), u) + axpy!(dt, mul!(rtmp, B1, F1), u) + F2 .+= F3; axpy!(dt, mul!(rtmp, B2, F2), u) # B3 = B2 + axpy!(dt, mul!(rtmp, B4, F4), u) end # Update integrator state @@ -435,8 +433,7 @@ function perform_step!(integrator, cache::HochOst4ConstantCache, repeat_step=fal F1 = integrator.fsalfirst halfdt = dt/2 if alg.krylov - # TODO: change to named tuple in v0.7 - kwargs = [(:m, min(alg.m, size(A,1))), (:norm, integrator.opts.internalnorm), (:iop, alg.iop)] + kwargs = (m=min(alg.m, size(A,1)), opnorm=integrator.opts.internalopnorm, iop=alg.iop) # Krylov on F1 (first column) Ks = arnoldi(A, F1; kwargs...) w1_half = phiv(halfdt, Ks, 3) @@ -459,9 +456,9 @@ function perform_step!(integrator, cache::HochOst4ConstantCache, repeat_step=fal Ks = arnoldi(A, F4; kwargs...) w4_half = phiv(halfdt, Ks, 3) w4 = phiv(dt, Ks, 3) - U5 = uprev + dt * (0.5w1_half[:,2] - 0.75w1_half[:,3] + 0.5w1_half[:,4] + w1[:,4] - 0.25w1[:,3] + - 0.5w2_half[:,3] - w2[:,4] + 0.25w2[:,3] - 0.5w2_half[:,4] + - 0.5w3_half[:,3] - w2[:,4] + 0.25w3[:,3] - 0.5w3_half[:,4] + + U5 = uprev + dt * (0.5w1_half[:,2] - 0.75w1_half[:,3] + 0.5w1_half[:,4] + w1[:,4] - 0.25w1[:,3] + + 0.5w2_half[:,3] - w2[:,4] + 0.25w2[:,3] - 0.5w2_half[:,4] + + 0.5w3_half[:,3] - w2[:,4] + 0.25w3[:,3] - 0.5w3_half[:,4] + w4[:,4] - 0.25w4[:,3] - 0.25w4_half[:,3] + 0.5w4_half[:,4]) F5 = _compute_nl(f, U5, p, t + halfdt, A) + Au # Krylov on F5 (fifth column) @@ -501,13 +498,12 @@ function perform_step!(integrator, cache::HochOst4Cache, repeat_step=false) alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg F1 = integrator.fsalfirst - A_mul_B!(Au, A, uprev) + mul!(Au, A, uprev) halfdt = dt/2 if alg.krylov Ks, phiv_cache, ws = KsCache w1_half, w2_half, w3_half, w4_half, w1, w2, w3, w4, w5 = ws - # TODO: change to named tuple in v0.7 - kwargs = [(:m, min(alg.m, size(A,1))), (:norm, integrator.opts.internalnorm), (:iop, alg.iop), (:cache, tmp)] + kwargs = (m=min(alg.m, size(A,1)), opnorm=integrator.opts.internalopnorm, iop=alg.iop, cache=tmp) # Krylov on F1 (first column) arnoldi!(Ks, A, F1; kwargs...) phiv!(w1_half, halfdt, Ks, 3; cache=phiv_cache) @@ -531,9 +527,9 @@ function perform_step!(integrator, cache::HochOst4Cache, repeat_step=false) phiv!(w4_half, halfdt, Ks, 3; cache=phiv_cache) phiv!(w4, dt, Ks, 3; cache=phiv_cache) @muladd @. @views tmp = uprev + dt * ( - 0.5w1_half[:,2] - 0.75w1_half[:,3] + 0.5w1_half[:,4] + w1[:,4] - 0.25w1[:,3] + - 0.5w2_half[:,3] - w2[:,4] + 0.25w2[:,3] - 0.5w2_half[:,4] + - 0.5w3_half[:,3] - w2[:,4] + 0.25w3[:,3] - 0.5w3_half[:,4] + + 0.5w1_half[:,2] - 0.75w1_half[:,3] + 0.5w1_half[:,4] + w1[:,4] - 0.25w1[:,3] + + 0.5w2_half[:,3] - w2[:,4] + 0.25w2[:,3] - 0.5w2_half[:,4] + + 0.5w3_half[:,3] - w2[:,4] + 0.25w3[:,3] - 0.5w3_half[:,4] + w4[:,4] - 0.25w4[:,3] - 0.25w4_half[:,3] + 0.5w4_half[:,4]) # tmp is U5 _compute_nl!(F5, f, tmp, p, t + dt, A, rtmp); F5 .+= Au # Krylov on F5 (fifth column) @@ -546,28 +542,28 @@ function perform_step!(integrator, cache::HochOst4Cache, repeat_step=false) A21, A31, A32, A41, A42, A51, A52, A54, B1, B4, B5 = cache.ops # stage 1 (fsaled) # stage 2 - A_mul_B!(rtmp, A21, F1) + mul!(rtmp, A21, F1) @muladd @. tmp = uprev + dt * rtmp # tmp is U2 f.f2(F2, tmp, p, t + halfdt); F2 .+= Au # stage 3 - A_mul_B!(rtmp, A31, F1); A_mul_B!(rtmp2, A32, F2); rtmp .+= rtmp2 + mul!(rtmp, A31, F1); mul!(rtmp2, A32, F2); rtmp .+= rtmp2 @muladd @. tmp = uprev + dt * rtmp # tmp is U3 f.f2(F3, tmp, p, t + halfdt); F3 .+= Au # stage 4 F2 .+= F3 # F2 now stores F2 + F3 - A_mul_B!(rtmp, A41, F1); A_mul_B!(rtmp2, A42, F2); rtmp .+= rtmp2 + mul!(rtmp, A41, F1); mul!(rtmp2, A42, F2); rtmp .+= rtmp2 @muladd @. tmp = uprev + dt * rtmp # tmp is U4 f.f2(F4, tmp, p, t + dt); F4 .+= Au # stage 5 - A_mul_B!(rtmp, A51, F1) - A_mul_B!(rtmp2, A52, F2); rtmp .+= rtmp2 - A_mul_B!(rtmp2, A54, F4); rtmp .+= rtmp2 + mul!(rtmp, A51, F1) + mul!(rtmp2, A52, F2); rtmp .+= rtmp2 + mul!(rtmp2, A54, F4); rtmp .+= rtmp2 @muladd @. tmp = uprev + dt * rtmp # tmp is U5 f.f2(F5, tmp, p, t + halfdt); F5 .+= Au # update u - A_mul_B!(rtmp, B1, F1) - A_mul_B!(rtmp2, B4, F4); rtmp .+= rtmp2 - A_mul_B!(rtmp2, B5, F5); rtmp .+= rtmp2 + mul!(rtmp, B1, F1) + mul!(rtmp2, B4, F4); rtmp .+= rtmp2 + mul!(rtmp2, B5, F5); rtmp .+= rtmp2 @muladd @. u = uprev + dt * rtmp end @@ -584,10 +580,10 @@ function perform_step!(integrator, cache::Exp4ConstantCache, repeat_step=false) alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg f0 = integrator.fsalfirst # f(uprev) is fsaled ts = [dt/3, 2dt/3, dt] - kwargs = [(:tol, integrator.opts.reltol), (:iop, alg.iop), (:norm, integrator.opts.internalnorm), (:adaptive, true)] + kwargs = (tol=integrator.opts.reltol, iop=alg.iop, opnorm=integrator.opts.internalopnorm, adaptive=true) # Krylov for f(uprev) - B1 = [zeros(f0) f0] + B1 = [zero(f0) f0] K1 = phiv_timestep(ts, A, B1; kwargs...) # tϕ(tA)f0 @inbounds for i = 1:3 K1[:,i] ./= ts[i] @@ -596,7 +592,7 @@ function perform_step!(integrator, cache::Exp4ConstantCache, repeat_step=false) u4 = uprev + dt * w4 d4 = f(u4, p, t+dt) - f0 - dt * (A*w4) # TODO: what should be the time? # Krylov for the first remainder d4 - B2 = [zeros(d4) d4] + B2 = [zero(d4) d4] K2 = phiv_timestep(ts, A, B2; kwargs...) @inbounds for i = 1:3 K2[:,i] ./= ts[i] @@ -605,7 +601,7 @@ function perform_step!(integrator, cache::Exp4ConstantCache, repeat_step=false) u7 = uprev + dt * w7 d7 = f(u7, p, t+dt) - f0 - dt * (A*w7) # Krylov for the second remainder d7 - B3 = [zeros(d7) d7] + B3 = [zero(d7) d7] k7 = phiv_timestep(ts[1], A, B3; kwargs...) k7 ./= ts[1] # Update u @@ -625,8 +621,7 @@ function perform_step!(integrator, cache::Exp4Cache, repeat_step=false) alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg f0 = integrator.fsalfirst # f(u0) is fsaled ts = [dt/3, 2dt/3, dt] - kwargs = [(:tol, integrator.opts.reltol), (:iop, alg.iop), (:norm, integrator.opts.internalnorm), - (:adaptive, true), (:caches, KsCache)] + kwargs = (tol=integrator.opts.reltol, iop=alg.iop, opnorm=integrator.opts.internalopnorm, adaptive=true, caches=KsCache) # Krylov for f(uprev) B[:, 2] .= f0 @@ -634,32 +629,32 @@ function perform_step!(integrator, cache::Exp4Cache, repeat_step=false) @inbounds for i = 1:3 K[:,i] ./= ts[i] end - A_mul_B!(rtmp, K, [-7/300, 97/150, -37/300]) # rtmp is now w4 + mul!(rtmp, K, [-7/300, 97/150, -37/300]) # rtmp is now w4 @muladd @. tmp = uprev + dt * rtmp # tmp is now u4 - A_mul_B!(rtmp2, A, rtmp) + mul!(rtmp2, A, rtmp) f(rtmp, tmp, p, t+dt) # TODO: what should be the time? @muladd @. @view(B[:,2]) = rtmp - f0 - dt * rtmp2 # B[:,2] is now d4 # Partially update entities that use k1, k2, k3 - A_mul_B!(rtmp, K, [59/300, -7/75, 269/300]) # rtmp is now w7 + mul!(rtmp, K, [59/300, -7/75, 269/300]) # rtmp is now w7 @muladd @. u = uprev + dt * @view(K[:,3]) # Krylov for the first remainder d4 phiv_timestep!(K, ts, A, B; kwargs...) @inbounds for i = 1:3 K[:,i] ./= ts[i] end - A_mul_B!(rtmp2, K, [2/3, 2/3, 2/3]); rtmp .+= rtmp2 # w7 fully updated + mul!(rtmp2, K, [2/3, 2/3, 2/3]); rtmp .+= rtmp2 # w7 fully updated @muladd @. tmp = uprev + dt * rtmp # tmp is now u7 - A_mul_B!(rtmp2, A, rtmp) + mul!(rtmp2, A, rtmp) f(rtmp, tmp, p, t+dt) # TODO: what should be the time? @muladd @. @view(B[:,2]) = rtmp - f0 - dt * rtmp2 # B[:,2] is now d7 # Partially update entities that use k4, k5, k6 - A_mul_B!(rtmp, K, [1.0, -4/3, 1.0]) - Base.axpy!(dt, rtmp, u) + mul!(rtmp, K, [1.0, -4/3, 1.0]) + axpy!(dt, rtmp, u) # Krylov for the second remainder d7 k7 = @view(K[:, 1]) phiv_timestep!(k7, ts[1], A, B; kwargs...) k7 ./= ts[1] - Base.axpy!(dt/6, k7, u) + axpy!(dt/6, k7, u) # Update integrator state f(integrator.fsallast, u, p, t + dt) @@ -671,15 +666,15 @@ function perform_step!(integrator, cache::EPIRK4s3AConstantCache, repeat_step=fa A = f.jac(uprev, p, t) alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg f0 = integrator.fsalfirst # f(uprev) is fsaled - kwargs = [(:tol, integrator.opts.reltol), (:iop, alg.iop), (:norm, integrator.opts.internalnorm), (:adaptive, true)] + kwargs = (tol=integrator.opts.reltol, iop=alg.iop, opnorm=integrator.opts.internalopnorm, adaptive=true) # Compute U2 and U3 vertically - K = phiv_timestep([dt/2, 2dt/3], A, [zeros(f0) f0]; kwargs...) - U2 = uprev + K[:, 1] + K = phiv_timestep([dt/2, 2dt/3], A, [zero(f0) f0]; kwargs...) + U2 = uprev + K[:, 1] U3 = uprev + K[:, 2] R2 = f(U2, p, t + dt/2) - f0 - A*K[:, 1] # remainder of U2 R3 = f(U3, p, t + 2dt/3) - f0 - A*K[:, 2] # remainder of U3 - + # Update u (horizontally) B = zeros(eltype(f0), length(f0), 5) B[:, 2] = f0 @@ -700,25 +695,24 @@ function perform_step!(integrator, cache::EPIRK4s3ACache, repeat_step=false) f.jac(A, uprev, p, t) alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg f0 = integrator.fsalfirst # f(u0) is fsaled - kwargs = [(:tol, integrator.opts.reltol), (:iop, alg.iop), (:norm, integrator.opts.internalnorm), - (:adaptive, true), (:caches, KsCache)] + kwargs = (tol=integrator.opts.reltol, iop=alg.iop, opnorm=integrator.opts.internalopnorm, adaptive=true, caches=KsCache) # Compute U2 and U3 vertically B[:, 2] .= f0 phiv_timestep!(K, [dt/2, 2dt/3], A, @view(B[:, 1:2]); kwargs...) ## U2 and R2 @. tmp = uprev + @view(K[:, 1]) # tmp is now U2 - f(rtmp, tmp, p, t + dt/2); A_mul_B!(rtmp2, A, @view(K[:, 1])) + f(rtmp, tmp, p, t + dt/2); mul!(rtmp2, A, @view(K[:, 1])) @. rtmp = rtmp - f0 - rtmp2 # rtmp is now R2 B[:, 4] .= (32/dt^2) * rtmp B[:, 5] .= (-144/dt^3) * rtmp ## U3 and R3 @. tmp = uprev + @view(K[:, 2]) # tmp is now U3 - f(rtmp, tmp, p, t + 2dt/3); A_mul_B!(rtmp2, A, @view(K[:, 2])) + f(rtmp, tmp, p, t + 2dt/3); mul!(rtmp2, A, @view(K[:, 2])) @. rtmp = rtmp - f0 - rtmp2 # rtmp is now R3 B[:, 4] .-= (13.5/dt^2) * rtmp B[:, 5] .+= (81/dt^3) * rtmp - + # Update u du = @view(K[:, 1]) phiv_timestep!(du, dt, A, B; kwargs...) @@ -734,17 +728,17 @@ function perform_step!(integrator, cache::EPIRK4s3BConstantCache, repeat_step=fa A = f.jac(uprev, p, t) alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg f0 = integrator.fsalfirst # f(uprev) is fsaled - kwargs = [(:tol, integrator.opts.reltol), (:iop, alg.iop), (:norm, integrator.opts.internalnorm), (:adaptive, true)] + kwargs = (tol=integrator.opts.reltol, iop=alg.iop, opnorm=integrator.opts.internalopnorm, adaptive=true) # Compute U2 and U3 vertically - K = phiv_timestep([dt/2, 3dt/4], A, [zeros(f0) zeros(f0) f0]; kwargs...) + K = phiv_timestep([dt/2, 3dt/4], A, [zero(f0) zero(f0) f0]; kwargs...) K[:, 1] .*= 8 / (3*dt) K[:, 2] .*= 16 / (9*dt) U2 = uprev + K[:, 1] U3 = uprev + K[:, 2] R2 = f(U2, p, t + dt/2) - f0 - A*K[:, 1] # remainder of U2 R3 = f(U3, p, t + 3dt/4) - f0 - A*K[:, 2] # remainder of U3 - + # Update u (horizontally) B = zeros(eltype(f0), length(f0), 5) B[:, 2] = f0 @@ -765,8 +759,7 @@ function perform_step!(integrator, cache::EPIRK4s3BCache, repeat_step=false) f.jac(A, uprev, p, t) alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg f0 = integrator.fsalfirst # f(u0) is fsaled - kwargs = [(:tol, integrator.opts.reltol), (:iop, alg.iop), (:norm, integrator.opts.internalnorm), - (:adaptive, true), (:caches, KsCache)] + kwargs = (tol=integrator.opts.reltol, iop=alg.iop, opnorm=integrator.opts.internalopnorm, adaptive=true, caches=KsCache) # Compute U2 and U3 vertically fill!(@view(B[:, 2]), zero(eltype(B))) @@ -776,17 +769,17 @@ function perform_step!(integrator, cache::EPIRK4s3BCache, repeat_step=false) K[:, 2] .*= 16 / (9*dt) ## U2 and R2 @. tmp = uprev + @view(K[:, 1]) # tmp is now U2 - f(rtmp, tmp, p, t + dt/2); A_mul_B!(rtmp2, A, @view(K[:, 1])) + f(rtmp, tmp, p, t + dt/2); mul!(rtmp2, A, @view(K[:, 1])) @. rtmp = rtmp - f0 - rtmp2 # rtmp is now R2 B[:, 4] .= (54/dt^2) * rtmp B[:, 5] .= (-324/dt^3) * rtmp ## U3 and R3 @. tmp = uprev + @view(K[:, 2]) # tmp is now U3 - f(rtmp, tmp, p, t + 3dt/4); A_mul_B!(rtmp2, A, @view(K[:, 2])) + f(rtmp, tmp, p, t + 3dt/4); mul!(rtmp2, A, @view(K[:, 2])) @. rtmp = rtmp - f0 - rtmp2 # rtmp is now R3 B[:, 4] .-= (16/dt^2) * rtmp B[:, 5] .+= (144/dt^3) * rtmp - + # Update u fill!(@view(B[:, 3]), zero(eltype(B))) B[:, 2] .= f0 @@ -804,10 +797,10 @@ function perform_step!(integrator, cache::EPIRK5s3ConstantCache, repeat_step=fal A = f.jac(uprev, p, t) alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg f0 = integrator.fsalfirst # f(uprev) is fsaled - kwargs = [(:tol, integrator.opts.reltol), (:iop, alg.iop), (:norm, integrator.opts.internalnorm), (:adaptive, true)] + kwargs = (tol=integrator.opts.reltol, iop=alg.iop, opnorm=integrator.opts.internalopnorm, adaptive=true) # Compute U2 horizontally - B = zeros(eltype(f0), length(f0), 4) + B = fill(zero(eltype(f0)), length(f0), 4) B[:, 3] = (55 / (8 * dt)) * f0 B[:, 4] = (-3025 / (192 * dt^2)) * f0 k = phiv_timestep(48dt/55, A, B; kwargs...) @@ -821,9 +814,9 @@ function perform_step!(integrator, cache::EPIRK5s3ConstantCache, repeat_step=fal k = phiv_timestep(4dt/9, A, B; kwargs...) U3 = uprev + k R3 = f(U3, p, t + 4dt/9) - f0 - A*k # remainder of U3 - + # Update u (horizontally) - B = zeros(eltype(f0), length(f0), 5) + B = fill(zero(eltype(f0)), length(f0), 5) B[:, 2] = f0 B[:, 4] = (-166375 / (61056 * dt^2)) * R2 + (2187 / (106 * dt^2)) * R3 B[:, 5] = (499125 / (27136 * dt^3)) * R2 - (2187 / (106 * dt^3)) * R3 @@ -842,8 +835,7 @@ function perform_step!(integrator, cache::EPIRK5s3Cache, repeat_step=false) f.jac(A, uprev, p, t) alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg f0 = integrator.fsalfirst # f(u0) is fsaled - kwargs = [(:tol, integrator.opts.reltol), (:iop, alg.iop), (:norm, integrator.opts.internalnorm), - (:adaptive, true), (:caches, KsCache)] + kwargs = (tol=integrator.opts.reltol, iop=alg.iop, opnorm=integrator.opts.internalopnorm, adaptive=true, caches=KsCache) # Compute U2 horizontally fill!(@view(B[:, 2]), zero(eltype(B))) @@ -852,7 +844,7 @@ function perform_step!(integrator, cache::EPIRK5s3Cache, repeat_step=false) phiv_timestep!(k, 48dt/55, A, @view(B[:, 1:4]); kwargs...) ## Compute R2 @. tmp = uprev + k # tmp is now U2 - f(rtmp, tmp, p, t + 48dt/55); A_mul_B!(rtmp2, A, k) + f(rtmp, tmp, p, t + 48dt/55); mul!(rtmp2, A, k) @. rtmp = rtmp - f0 - rtmp2 # rtmp is now R2 # Compute U3 horizontally @@ -867,11 +859,11 @@ function perform_step!(integrator, cache::EPIRK5s3Cache, repeat_step=false) B[:, 5] .= (499125 / (27136 * dt^3)) .* rtmp ## Compute R3 and update B @. tmp = uprev + k # tmp is now U3 - f(rtmp, tmp, p, t + 4dt/9); A_mul_B!(rtmp2, A, k) + f(rtmp, tmp, p, t + 4dt/9); mul!(rtmp2, A, k) @. rtmp = rtmp - f0 - rtmp2 # rtmp is now R3 B[:, 4] .+= (2187 / (106 * dt^2)) .* rtmp B[:, 5] .-= (2187 / (106 * dt^3)) .* rtmp - + # Update u phiv_timestep!(k, dt, A, B; kwargs...) @. u = uprev + k @@ -886,23 +878,23 @@ function perform_step!(integrator, cache::EXPRB53s3ConstantCache, repeat_step=fa A = f.jac(uprev, p, t) alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg f0 = integrator.fsalfirst # f(uprev) is fsaled - kwargs = [(:tol, integrator.opts.reltol), (:iop, alg.iop), (:norm, integrator.opts.internalnorm), (:adaptive, true)] + kwargs = (tol=integrator.opts.reltol, iop=alg.iop, opnorm=integrator.opts.internalopnorm, adaptive=true) # Compute the first group for U2 and U3 - B = [zeros(f0) f0] + B = [zero(f0) f0] K = phiv_timestep([dt/2, 9dt/10], A, B; kwargs...) U2 = uprev + K[:, 1] R2 = f(U2, p, t + dt/2) - f0 - A*K[:, 1] # remainder of U2 U3 = uprev + K[:, 2] # partially # Compute the second group for U3 - B = [zeros(R2) zeros(R2) zeros(R2) R2] + B = [zero(R2) zero(R2) zero(R2) R2] K = phiv_timestep([dt/2, 9dt/10], A, B; kwargs...) U3 .+= 216/(25*dt^2) .* K[:, 1] + 8/dt^2 .* K[:, 2] R3 = f(U3, p, t + 9dt/10) - f0 - A*(U3 - uprev) # remainder of U3 - + # Compute the third group for u - B = zeros(eltype(f0), length(f0), 5) + B = fill(zero(eltype(f0)), length(f0), 5) B[:, 2] = f0 B[:, 4] = (18 / dt^2) * R2 - (250 / (81 * dt^2)) * R3 B[:, 5] = (-60 / dt^3) * R2 + (500 / (27 * dt^3)) * R3 @@ -921,15 +913,14 @@ function perform_step!(integrator, cache::EXPRB53s3Cache, repeat_step=false) f.jac(A, uprev, p, t) alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg f0 = integrator.fsalfirst # f(u0) is fsaled - kwargs = [(:tol, integrator.opts.reltol), (:iop, alg.iop), (:norm, integrator.opts.internalnorm), - (:adaptive, true), (:caches, KsCache)] + kwargs = (tol=integrator.opts.reltol, iop=alg.iop, opnorm=integrator.opts.internalopnorm, adaptive=true, caches=KsCache) # Compute the first group for U2 and U3 B[:, 2] .= f0 phiv_timestep!(K, [dt/2, 9dt/10], A, @view(B[:, 1:2]); kwargs...) ## U2 and R2 @. tmp = uprev + @view(K[:, 1]) # tmp is now U2 - f(rtmp, tmp, p, t + dt/2); A_mul_B!(rtmp2, A, @view(K[:, 1])) + f(rtmp, tmp, p, t + dt/2); mul!(rtmp2, A, @view(K[:, 1])) @. rtmp = rtmp - f0 - rtmp2 # rtmp is now R2 @. tmp = uprev + @view(K[:, 2]) # tmp is now U3 (partially) @@ -944,12 +935,12 @@ function perform_step!(integrator, cache::EXPRB53s3Cache, repeat_step=false) ## U3 and R3 @views tmp .+= 216/(25*dt^2) .* K[:, 1] + 8/dt^2 .* K[:, 2] # tmp is now U3 f(rtmp, tmp, p, t + 9dt/10) - tmp .-= uprev; A_mul_B!(rtmp2, A, tmp) + tmp .-= uprev; mul!(rtmp2, A, tmp) @. rtmp = rtmp - f0 - rtmp2 # rtmp is now R3 ## Update B using R3 B[:, 4] .-= (250 / (81 * dt^2)) * rtmp B[:, 5] .+= (500 / (27 * dt^3)) * rtmp - + # Update u du = @view(K[:, 1]) phiv_timestep!(du, dt, A, B; kwargs...) @@ -965,7 +956,7 @@ function perform_step!(integrator, cache::EPIRK5P1ConstantCache, repeat_step=fal A = f.jac(uprev, p, t) alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg f0 = integrator.fsalfirst # f(uprev) is fsaled - kwargs = [(:tol, integrator.opts.reltol), (:iop, alg.iop), (:norm, integrator.opts.internalnorm), (:adaptive, true)] + kwargs = (tol=integrator.opts.reltol, iop=alg.iop, opnorm=integrator.opts.internalopnorm, adaptive=true) # Coefficients (scaling factors absorbed) g11 = 0.35129592695058193092 * dt @@ -974,21 +965,21 @@ function perform_step!(integrator, cache::EPIRK5P1ConstantCache, repeat_step=fal a22 = 2.37739153404186675585; b2 = 1.78975267532362337976; b3 = 9.35854650579261718128 / dt^2 # Compute the first column (f0) - B = [zeros(f0) f0] + B = [zero(f0) f0] K1 = phiv_timestep([g11, g21, g31], A, B; kwargs...) ## U1 and R1 U1 = uprev + K1[:, 1] R1 = f(U1, p, t + g11) - f0 - A*K1[:, 1] # remainder of U1 # Compute the second column (R1) - B = [zeros(R1) R1] + B = [zero(R1) R1] k2 = phiv_timestep(g32, A, B; kwargs...) ## U2 and R2 U2 = uprev + K1[:, 2] + a22 * k2 R2 = f(U2, p, t + g21) - f0 - A*(U2 - uprev) # remainder of U2 - + # Compute the third column (dR = R2 - 2R1) - B = zeros(eltype(f0), length(f0), 4) + B = fill(zero(eltype(f0)), length(f0), 4) B[:, 4] = R2 - 2R1 k3 = phiv_timestep(g33, A, B; kwargs...) ## Update state @@ -1007,8 +998,7 @@ function perform_step!(integrator, cache::EPIRK5P1Cache, repeat_step=false) f.jac(A, uprev, p, t) alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg f0 = integrator.fsalfirst # f(u0) is fsaled - kwargs = [(:tol, integrator.opts.reltol), (:iop, alg.iop), (:norm, integrator.opts.internalnorm), - (:adaptive, true), (:caches, KsCache)] + kwargs = (tol=integrator.opts.reltol, iop=alg.iop, opnorm=integrator.opts.internalopnorm, adaptive=true, caches=KsCache) # Coefficients (scaling factors absorbed) g11 = 0.35129592695058193092 * dt @@ -1021,7 +1011,7 @@ function perform_step!(integrator, cache::EPIRK5P1Cache, repeat_step=false) phiv_timestep!(K, [g11, g21, g31], A, @view(B[:, 1:2]); kwargs...) ## U1 and R1 @. tmp = uprev + @view(K[:, 1]) # tmp is now U1 - f(rtmp, tmp, p, t + g11); A_mul_B!(rtmp2, A, @view(K[:, 1])) + f(rtmp, tmp, p, t + g11); mul!(rtmp2, A, @view(K[:, 1])) @. rtmp = rtmp - f0 - rtmp2 # rtmp is now R1 @. tmp = uprev + @view(K[:, 2]) # partially update U2 (stored tmp) @. u = uprev + @view(K[:, 3]) # partially update u @@ -1032,17 +1022,17 @@ function perform_step!(integrator, cache::EPIRK5P1Cache, repeat_step=false) k = @view(K[:, 1]) phiv_timestep!(k, g32, A, @view(B[:, 1:2]); kwargs...) ## U2 and R2 - Base.axpy!(a22, k, tmp) # tmp is now U2 + axpy!(a22, k, tmp) # tmp is now U2 f(rtmp, tmp, p, t + g21) - tmp .-= uprev; A_mul_B!(rtmp2, A, tmp) + tmp .-= uprev; mul!(rtmp2, A, tmp) @. rtmp = rtmp - f0 - rtmp2 # rtmp is now R2 - Base.axpy!(b2, k, u) # partially update u + axpy!(b2, k, u) # partially update u B[:, 4] .+= rtmp # is now dR - + # Compute the third column (dR = R2 - 2R1) fill!(@view(B[:, 2]), zero(eltype(B))) phiv_timestep!(k, g33, A, B; kwargs...) - Base.axpy!(b3, k, u) + axpy!(b3, k, u) # Update integrator state f(integrator.fsallast, u, p, t + dt) @@ -1054,7 +1044,7 @@ function perform_step!(integrator, cache::EPIRK5P2ConstantCache, repeat_step=fal A = f.jac(uprev, p, t) alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg f0 = integrator.fsalfirst # f(uprev) is fsaled - kwargs = [(:tol, integrator.opts.reltol), (:iop, alg.iop), (:norm, integrator.opts.internalnorm), (:adaptive, true)] + kwargs = (tol=integrator.opts.reltol, iop=alg.iop, opnorm=integrator.opts.internalopnorm, adaptive=true) # Coefficients (scaling factors absorbed) g11 = 0.46629408528088195806 * dt @@ -1064,22 +1054,22 @@ function perform_step!(integrator, cache::EPIRK5P2ConstantCache, repeat_step=fal b31 = -0.128486782657005566142; b32 = -0.161028033172809183351 / dt; b33 = 5.26726331616909606251 / dt^2 # Compute the first column (f0) - B = [zeros(f0) f0] + B = [zero(f0) f0] K1 = phiv_timestep([g11, g21, g31], A, B; kwargs...) ## U1 and R1 U1 = uprev + K1[:, 1] R1 = f(U1, p, t + g11) - f0 - A*K1[:, 1] # remainder of U1 # Compute the second column (R1) - B = [zeros(R1) zeros(R1) R1] + B = [zero(R1) zero(R1) R1] k2 = phiv_timestep(g32, A, B; kwargs...) ## U2 and R2 U2 = uprev + K1[:, 2] + a22 * k2 R2 = f(U2, p, t + g21) - f0 - A*(U2 - uprev) # remainder of U2 - + # Compute the third column (dR = R2 - 2R1) dR = R2 - 2R1 - B = [zeros(dR) b31*dR b32*dR b33*dR] + B = [zero(dR) b31*dR b32*dR b33*dR] k3 = phiv_timestep(g33, A, B; kwargs...) ## Update state u = uprev + K1[:, 3] + b2 * k2 + k3 @@ -1097,8 +1087,7 @@ function perform_step!(integrator, cache::EPIRK5P2Cache, repeat_step=false) f.jac(A, uprev, p, t) alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg f0 = integrator.fsalfirst # f(u0) is fsaled - kwargs = [(:tol, integrator.opts.reltol), (:iop, alg.iop), (:norm, integrator.opts.internalnorm), - (:adaptive, true), (:caches, KsCache)] + kwargs = (tol=integrator.opts.reltol, iop=alg.iop, opnorm=integrator.opts.internalopnorm, adaptive=true, caches=KsCache) # Coefficients (scaling factors absorbed) g11 = 0.46629408528088195806 * dt @@ -1112,7 +1101,7 @@ function perform_step!(integrator, cache::EPIRK5P2Cache, repeat_step=false) phiv_timestep!(K, [g11, g21, g31], A, @view(B[:, 1:2]); kwargs...) ## U1 and R1 @. tmp = uprev + @view(K[:, 1]) # tmp is now U1 - f(rtmp, tmp, p, t + g11); A_mul_B!(rtmp2, A, @view(K[:, 1])) + f(rtmp, tmp, p, t + g11); mul!(rtmp2, A, @view(K[:, 1])) @. rtmp = rtmp - f0 - rtmp2 # rtmp is now R1 @. tmp = uprev + @view(K[:, 2]) # partially update U2 (stored in tmp) @. u = uprev + @view(K[:, 3]) # partially update u @@ -1124,13 +1113,13 @@ function perform_step!(integrator, cache::EPIRK5P2Cache, repeat_step=false) k = @view(K[:, 1]) phiv_timestep!(k, g32, A, @view(B[:, 1:3]); kwargs...) ## U2 and R2 - Base.axpy!(a22, k, tmp) # tmp is now U2 + axpy!(a22, k, tmp) # tmp is now U2 f(rtmp, tmp, p, t + g21) - tmp .-= uprev; A_mul_B!(rtmp2, A, tmp) + tmp .-= uprev; mul!(rtmp2, A, tmp) @. rtmp = rtmp - f0 - rtmp2 # rtmp is now R2 dR .+= rtmp # dR is now R2 - 2R1 - Base.axpy!(b2, k, u) # partially update u - + axpy!(b2, k, u) # partially update u + # Compute the third column (dR = R2 - 2R1) @. B[:, 2] = b31 * dR @. B[:, 3] = b32 * dR @@ -1147,14 +1136,14 @@ end # Multistep exponential integrators function initialize!(integrator,cache::ETD2ConstantCache) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Pre-start fsal lin = integrator.f.f1(integrator.uprev,integrator.p,integrator.t) nl = integrator.f.f2(integrator.uprev,integrator.p,integrator.t) nlprev = zero(nl) # to be computed in the first iteration via ETD1 integrator.fsalfirst = ETD2Fsal(lin, nl, nlprev) - + # Avoid undefined entries if k is an array of arrays rate_prototype = lin integrator.fsallast = ETD2Fsal(rate_prototype) @@ -1187,13 +1176,13 @@ function initialize!(integrator, cache::ETD2Cache) integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) rate_prototype = cache.rtmp1 - + # Pre-start fsal integrator.fsalfirst = ETD2Fsal(rate_prototype) @unpack lin,nl = integrator.fsalfirst integrator.f.f1(lin,integrator.uprev,integrator.p,integrator.t) integrator.f.f2(nl,integrator.uprev,integrator.p,integrator.t) - + # Avoid undefined entries if k is an array of arrays integrator.fsallast = ETD2Fsal(rate_prototype) integrator.k[1] = lin + nl @@ -1207,13 +1196,13 @@ function perform_step!(integrator, cache::ETD2Cache, repeat_step=false) @. integrator.k[1] = lin + nl if integrator.iter == 1 # ETD1 for initial step - A_mul_B!(utmp, exphA, uprev) - A_mul_B!(rtmp1, phihA, nl) + mul!(utmp, exphA, uprev) + mul!(rtmp1, phihA, nl) @muladd @. u = utmp + dt*rtmp1 else - A_mul_B!(utmp, exphA, uprev) - A_mul_B!(rtmp1, B1, nl) - A_mul_B!(rtmp2, B0, nlprev) + mul!(utmp, exphA, uprev) + mul!(rtmp1, B1, nl) + mul!(rtmp2, B0, nlprev) @muladd @. u = utmp + dt*(rtmp1 + rtmp2) end diff --git a/src/perform_step/feagin_rk_perform_step.jl b/src/perform_step/feagin_rk_perform_step.jl index c4d67f6414..19cd62c2ba 100644 --- a/src/perform_step/feagin_rk_perform_step.jl +++ b/src/perform_step/feagin_rk_perform_step.jl @@ -1,7 +1,7 @@ function initialize!(integrator, cache::Feagin10ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -189,7 +189,7 @@ end function initialize!(integrator, cache::Feagin12ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -433,7 +433,7 @@ end function initialize!(integrator,cache::Feagin14ConstantCache,f=integrator.f) integrator.fsalfirst = f(integrator.uprev,integrator.p,integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) diff --git a/src/perform_step/fixed_timestep_perform_step.jl b/src/perform_step/fixed_timestep_perform_step.jl index 8de2f1c382..21d7995e66 100644 --- a/src/perform_step/fixed_timestep_perform_step.jl +++ b/src/perform_step/fixed_timestep_perform_step.jl @@ -1,6 +1,6 @@ function initialize!(integrator,cache::FunctionMapConstantCache) integrator.kshortsize = 0 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) end function perform_step!(integrator,cache::FunctionMapConstantCache,repeat_step=false) @@ -29,14 +29,14 @@ function perform_step!(integrator,cache::FunctionMapCache,repeat_step=false) f(u,uprev,p,t) end if typeof(u) <: DEDataArray # Needs to get the fields, since updated uprev - copy_fields!(u,uprev) + DiffEqBase.copy_fields!(u,uprev) end end end function initialize!(integrator,cache::EulerConstantCache) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays @@ -74,7 +74,7 @@ end function initialize!(integrator,cache::Union{HeunConstantCache,RalstonConstantCache}) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays @@ -169,7 +169,7 @@ end function initialize!(integrator,cache::MidpointConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -224,7 +224,7 @@ end function initialize!(integrator,cache::RK4ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -320,7 +320,7 @@ end function initialize!(integrator,cache::CarpenterKennedy2N54ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 1 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) diff --git a/src/perform_step/general_rosenbrock_perform_step.jl b/src/perform_step/general_rosenbrock_perform_step.jl index 3f5b16be5d..b2bf2d1b8f 100644 --- a/src/perform_step/general_rosenbrock_perform_step.jl +++ b/src/perform_step/general_rosenbrock_perform_step.jl @@ -1,6 +1,6 @@ function initialize!(integrator, cache::GenRosen4ConstantCache) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Avoid undefined entries if k is an array of arrays diff --git a/src/perform_step/generic_implicit_perform_step.jl b/src/perform_step/generic_implicit_perform_step.jl index 6a4dd1149b..3cbc611d7d 100644 --- a/src/perform_step/generic_implicit_perform_step.jl +++ b/src/perform_step/generic_implicit_perform_step.jl @@ -32,7 +32,7 @@ function initialize!(integrator, cache::Union{GenericImplicitEulerConstantCache,GenericTrapezoidConstantCache}) cache.uhold[1] = integrator.uprev integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Avoid undefined entries if k is an array of arrays @@ -104,21 +104,21 @@ end @unpack t,dt,uprev,u,f,p = integrator @unpack dual_cache,k,nl_rhs,rhs,tmp,atmp = cache alg = typeof(integrator.alg) <: CompositeAlgorithm ? integrator.alg.algs[integrator.cache.current] : integrator.alg - copy!(tmp,uprev) + copyto!(tmp,uprev) if integrator.success_iter > 0 && !integrator.reeval_fsal && alg.extrapolant == :interpolant current_extrapolant!(u,t+dt,integrator) elseif alg.extrapolant == :linear @. u = uprev + dt*integrator.fsalfirst else - copy!(u,uprev) + copyto!(u,uprev) end rhs.t = t rhs.dt = dt rhs.a = dt nlres = alg.nlsolve(nl_rhs,u) - copy!(u,nlres) + copyto!(u,nlres) if integrator.opts.adaptive && integrator.success_iter > 0 # local truncation error (LTE) bound by dt^2/2*max|y''(t)| @@ -147,7 +147,7 @@ function initialize!(integrator, cache::GenericTrapezoidConstantCache) cache.uhold[1] = integrator.uprev integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -241,15 +241,15 @@ end elseif alg.extrapolant == :linear @. u = uprev + dt*integrator.fsalfirst else - copy!(u,uprev) + copyto!(u,uprev) end - # copy!(rhs.fsalfirst,fsalfirst) Implicitly done by pointers: fsalfirst === fsalfirst == rhs.fsalfirst + # copyto!(rhs.fsalfirst,fsalfirst) Implicitly done by pointers: fsalfirst === fsalfirst == rhs.fsalfirst rhs.t = t rhs.dt = dt rhs.a = dt/2 nlres = alg.nlsolve(nl_rhs,u) - copy!(u,nlres) + copyto!(u,nlres) if integrator.opts.adaptive if integrator.iter > 2 @@ -279,12 +279,12 @@ end calculate_residuals!(atmp, tmp, uprev, u, integrator.opts.abstol, integrator.opts.reltol,integrator.opts.internalnorm) integrator.EEst = integrator.opts.internalnorm(atmp) if integrator.EEst <= 1 - copy!(cache.uprev3,uprev2) + copyto!(cache.uprev3,uprev2) cache.tprev2 = tprev end elseif integrator.success_iter > 0 integrator.EEst = 1 - copy!(cache.uprev3,integrator.uprev2) + copyto!(cache.uprev3,integrator.uprev2) cache.tprev2 = integrator.tprev else integrator.EEst = 1 diff --git a/src/perform_step/high_order_rk_perform_step.jl b/src/perform_step/high_order_rk_perform_step.jl index 236181dd32..21ab01d5a4 100644 --- a/src/perform_step/high_order_rk_perform_step.jl +++ b/src/perform_step/high_order_rk_perform_step.jl @@ -1,7 +1,7 @@ function initialize!(integrator,cache::TanYam7ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -140,7 +140,7 @@ end function initialize!(integrator, cache::DP8ConstantCache) integrator.kshortsize = 7 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays @@ -382,7 +382,7 @@ end function initialize!(integrator, cache::TsitPap8ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) diff --git a/src/perform_step/iif_perform_step.jl b/src/perform_step/iif_perform_step.jl index 9bc77e40e6..eec338f3f2 100644 --- a/src/perform_step/iif_perform_step.jl +++ b/src/perform_step/iif_perform_step.jl @@ -13,7 +13,7 @@ end function initialize!(integrator,cache::Union{GenericIIF1ConstantCache,GenericIIF2ConstantCache}) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) A = integrator.f.f1 cache.uhold[1] = integrator.f.f2(integrator.uprev,integrator.p,integrator.t) integrator.fsalfirst = integrator.f.f1(integrator.uprev,integrator.p,integrator.t) .+ cache.uhold[1] @@ -32,9 +32,9 @@ function perform_step!(integrator,cache::Union{GenericIIF1ConstantCache,GenericI # If adaptive, this should be computed after and cached A = integrator.f.f1 if typeof(cache) <: GenericIIF1ConstantCache - rhs.tmp = expm(A*dt)*(uprev) + rhs.tmp = exp(A*dt)*(uprev) elseif typeof(cache) <: GenericIIF2ConstantCache - @muladd rhs.tmp = expm(A*dt)*(uprev + 0.5dt*uhold[1]) # This uhold only works for non-adaptive + @muladd rhs.tmp = exp(A*dt)*(uprev + 0.5dt*uhold[1]) # This uhold only works for non-adaptive end if integrator.success_iter > 0 && !integrator.reeval_fsal @@ -75,7 +75,7 @@ function initialize!(integrator,cache::Union{GenericIIF1Cache,GenericIIF2Cache}) resize!(integrator.k, integrator.kshortsize) A = integrator.f.f1 integrator.f.f2(cache.rtmp1,integrator.uprev,integrator.p,integrator.t) - A_mul_B!(cache.k,A,integrator.uprev) + mul!(cache.k,A,integrator.uprev) @. integrator.fsalfirst = cache.k + cache.rtmp1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -92,7 +92,7 @@ function perform_step!(integrator,cache::Union{GenericIIF1Cache,GenericIIF2Cache @muladd @. k = k + 0.5dt*rtmp1 end - A_mul_B!(tmp,cache.expA,k) + mul!(tmp,cache.expA,k) if integrator.success_iter > 0 && !integrator.reeval_fsal current_extrapolant!(u,t+dt,integrator) @@ -102,7 +102,7 @@ function perform_step!(integrator,cache::Union{GenericIIF1Cache,GenericIIF2Cache rhs.dt = dt nlres = alg.nlsolve(nl_rhs,u) - copy!(u,nlres) + copyto!(u,nlres) integrator.f.f2(rtmp1,nlres,integrator.p,t+dt) A = f.f1 integrator.fsallast .= A*u .+ rtmp1 diff --git a/src/perform_step/kencarp_kvaerno_perform_step.jl b/src/perform_step/kencarp_kvaerno_perform_step.jl index 97196ce06d..9d19a1db0e 100644 --- a/src/perform_step/kencarp_kvaerno_perform_step.jl +++ b/src/perform_step/kencarp_kvaerno_perform_step.jl @@ -5,7 +5,7 @@ function initialize!(integrator, cache::Union{Kvaerno3ConstantCache, Kvaerno5ConstantCache, KenCarp5ConstantCache}) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays @@ -148,8 +148,8 @@ end if integrator.opts.adaptive @. dz = btilde1*z₁ + btilde2*z₂ + btilde3*z₃ + btilde4*z₄ if alg.smooth_est # From Shampine - if has_invW(f) - A_mul_B!(vec(tmp),W,vec(dz)) + if DiffEqBase.has_invW(f) + mul!(vec(tmp),W,vec(dz)) else cache.linsolve(vec(tmp),W,vec(dz),false) end @@ -391,8 +391,8 @@ end @. dz = btilde1*z₁ + btilde2*z₂ + btilde3*z₃ + btilde4*z₄ end if alg.smooth_est # From Shampine - if has_invW(f) - A_mul_B!(vec(tmp),W,vec(dz)) + if DiffEqBase.has_invW(f) + mul!(vec(tmp),W,vec(dz)) else cache.linsolve(vec(tmp),W,vec(dz),false) end @@ -552,8 +552,8 @@ end if integrator.opts.adaptive @. dz = btilde1*z₁ + btilde2*z₂ + btilde3*z₃ + btilde4*z₄ + btilde5*z₅ if alg.smooth_est # From Shampine - if has_invW(f) - A_mul_B!(vec(tmp),W,vec(dz)) + if DiffEqBase.has_invW(f) + mul!(vec(tmp),W,vec(dz)) else cache.linsolve(vec(tmp),W,vec(dz),false) end @@ -886,8 +886,8 @@ end end if alg.smooth_est # From Shampine - if has_invW(f) - A_mul_B!(vec(tmp),W,vec(dz)) + if DiffEqBase.has_invW(f) + mul!(vec(tmp),W,vec(dz)) else cache.linsolve(vec(tmp),W,vec(dz),false) end @@ -1088,8 +1088,8 @@ end @inbounds dz[i] = btilde1*z₁[i] + btilde3*z₃[i] + btilde4*z₄[i] + btilde5*z₅[i] + btilde6*z₆[i] + btilde7*z₇[i] end if alg.smooth_est # From Shampine - if has_invW(f) - A_mul_B!(vec(tmp),W,vec(dz)) + if DiffEqBase.has_invW(f) + mul!(vec(tmp),W,vec(dz)) else cache.linsolve(vec(tmp),W,vec(dz),false) end @@ -1502,8 +1502,8 @@ end end if alg.smooth_est # From Shampine - if has_invW(f) - A_mul_B!(vec(tmp),W,vec(dz)) + if DiffEqBase.has_invW(f) + mul!(vec(tmp),W,vec(dz)) else cache.linsolve(vec(tmp),W,vec(dz),false) end diff --git a/src/perform_step/linear_perform_step.jl b/src/perform_step/linear_perform_step.jl index 08249dcae6..cc17174fce 100644 --- a/src/perform_step/linear_perform_step.jl +++ b/src/perform_step/linear_perform_step.jl @@ -1,6 +1,6 @@ function initialize!(integrator, cache::LinearImplicitEulerConstantCache) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays @@ -137,16 +137,16 @@ function perform_step!(integrator, cache::MidpointSplittingCache, repeat_step=fa A = L.As[1] Bs = L.As[2:end] - copy!(tmp, uprev) + copyto!(tmp, uprev) for B in reverse(Bs) - u .= expm((dt/2)*B)*tmp + u .= exp((dt/2)*B)*tmp @swap!(tmp,u) end - u .= expm(dt*A)*tmp + u .= exp(dt*A)*tmp for B in Bs - tmp .= expm((dt/2)*B)*u + tmp .= exp((dt/2)*B)*u @swap!(u,tmp) end diff --git a/src/perform_step/low_order_rk_perform_step.jl b/src/perform_step/low_order_rk_perform_step.jl index d0310ba9a4..0951079817 100644 --- a/src/perform_step/low_order_rk_perform_step.jl +++ b/src/perform_step/low_order_rk_perform_step.jl @@ -1,6 +1,6 @@ function initialize!(integrator, cache::BS3ConstantCache) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays @@ -62,7 +62,7 @@ end function initialize!(integrator, cache::OwrenZen3ConstantCache) integrator.kshortsize = 4 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays @@ -122,7 +122,7 @@ end function initialize!(integrator, cache::OwrenZen4ConstantCache) integrator.kshortsize = 6 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev,integrator.p,integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays @@ -226,7 +226,7 @@ end function initialize!(integrator, cache::OwrenZen5ConstantCache) integrator.kshortsize = 8 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays @@ -346,7 +346,7 @@ end function initialize!(integrator, cache::BS5ConstantCache) alg = unwrap_alg(integrator, false) alg.lazy ? (integrator.kshortsize = 8) : (integrator.kshortsize = 11) - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays @@ -520,7 +520,7 @@ end function initialize!(integrator, cache::Tsit5ConstantCache) integrator.kshortsize = 7 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays @@ -657,7 +657,7 @@ end function initialize!(integrator, cache::DP5ConstantCache) integrator.kshortsize = 4 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays diff --git a/src/perform_step/nordsieck_perform_step.jl b/src/perform_step/nordsieck_perform_step.jl index 332a419a55..25da51608f 100644 --- a/src/perform_step/nordsieck_perform_step.jl +++ b/src/perform_step/nordsieck_perform_step.jl @@ -1,6 +1,6 @@ function initialize!(integrator,cache::AN5ConstantCache) integrator.kshortsize = 7 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays @@ -107,7 +107,7 @@ end if cache.order == 1 ## Start the Nordsieck vector in two shots! perform_step!(integrator, tsit5cache, repeat_step) - copy!(tmp, integrator.u) + copyto!(tmp, integrator.u) cache.order = 4 @. z[1] = integrator.uprev @. z[2] = integrator.k[1]*dt @@ -172,7 +172,7 @@ end function initialize!(integrator,cache::JVODEConstantCache) integrator.kshortsize = 7 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays diff --git a/src/perform_step/rkn_perform_step.jl b/src/perform_step/rkn_perform_step.jl index 5a369477bc..6e8879f414 100644 --- a/src/perform_step/rkn_perform_step.jl +++ b/src/perform_step/rkn_perform_step.jl @@ -14,7 +14,7 @@ const NystromCCDefaultInitialization = Union{Nystrom4ConstantCache, function initialize!(integrator,cache::NystromCCDefaultInitialization) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) duprev,uprev = integrator.uprev.x kdu = integrator.f.f1(duprev,uprev,integrator.p,integrator.t) @@ -186,7 +186,7 @@ end u = uprev + bconst1*dt*duprev + dt*(bconst2*duprev2 + dt*bbar2*(k₂x1-k₂.x[1])) integrator.fsallast = ArrayPartition((f.f1(du,u,p,t+dt),f.f2(du,u,p,t+dt))) - copy!(k₂.x[1],k₂.x[2]) + copyto!(k₂.x[1],k₂.x[2]) k1cache = ArrayPartition((k1cache.x[1],k.x[2])) end # end if end @@ -205,7 +205,7 @@ end # if there's a discontinuity or the solver is in the first step if integrator.iter < 2 && !integrator.u_modified perform_step!(integrator,integrator.cache.onestep_cache) - copy!(k1cache.x[1], k.x[1]) + copyto!(k1cache.x[1], k.x[1]) f.f1(k1cache.x[2],duprev,uprev,p,t+c1*dt) @. kdu= uprev + dt*(c1*duprev + dt*a21*k1cache.x[2]) f.f1(k₂.x[1],duprev,kdu,p,t+c1*dt) @@ -220,9 +220,9 @@ end end f.f1(k.x[1],du,u,p,t+dt) f.f2(k.x[2],du,u,p,t+dt) - copy!(k₂.x[1],k₂.x[2]) - copy!(k1cache.x[2],k1cache.x[1]) - copy!(k1cache.x[1],k.x[1]) + copyto!(k₂.x[1],k₂.x[2]) + copyto!(k1cache.x[2],k1cache.x[1]) + copyto!(k1cache.x[1],k.x[1]) end # end if end @@ -240,7 +240,7 @@ end # if there's a discontinuity or the solver is in the first step if integrator.iter < 2 && !integrator.u_modified perform_step!(integrator,integrator.cache.onestep_cache) - copy!(k1cache.x[1], k.x[1]) + copyto!(k1cache.x[1], k.x[1]) f.f1(k1cache.x[2],duprev,uprev,p,t+c1*dt) @. kdu= uprev + dt*(c1*duprev + dt*a21*k1cache.x[1]) f.f1(k₂.x[1],duprev,kdu,p,t+c1*dt) @@ -261,10 +261,10 @@ end end f.f1(k.x[1],du,u,p,t+dt) f.f2(k.x[2],du,u,p,t+dt) - copy!(k₂.x[1],k₂.x[2]) - copy!(k₃.x[1],k₃.x[2]) - copy!(k1cache.x[2],k1cache.x[1]) - copy!(k1cache.x[1],k.x[1]) + copyto!(k₂.x[1],k₂.x[2]) + copyto!(k₃.x[1],k₃.x[2]) + copyto!(k1cache.x[2],k1cache.x[1]) + copyto!(k1cache.x[1],k.x[1]) end # end if end @@ -352,7 +352,7 @@ end function initialize!(integrator, cache::DPRKN6ConstantCache) duprev,uprev = integrator.uprev.x integrator.kshortsize = 3 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) kdu = integrator.f.f1(duprev,uprev,integrator.p,integrator.t) ku = integrator.f.f2(duprev,uprev,integrator.p,integrator.t) @@ -863,8 +863,8 @@ end integrator.k[2] = integrator.fsallast if integrator.opts.adaptive dtsq = dt^2 - uhat = dtsq*(btilde1*k1 + btilde2*k2 + btilde3*k3 + btilde4*k4) - atmp = calculate_residuals(uhat, integrator.uprev, integrator.u, integrator.opts.abstol, integrator.opts.reltol,integrator.opts.internalnorm) + uhat = dtsq*(btilde1*k1 + btilde2*k2 + btilde3*k3 + btilde4*k4) + atmp = calculate_residuals(uhat, integrator.uprev.x[2], integrator.u.x[2], integrator.opts.abstol, integrator.opts.reltol,integrator.opts.internalnorm) integrator.EEst = integrator.opts.internalnorm(atmp) end end @@ -901,7 +901,7 @@ end @tight_loop_macros for i in uidx @inbounds uhat[i] = dtsq*(btilde1*k1[i] + btilde2*k2[i] + btilde3*k3[i] + btilde4*k4[i]) end - calculate_residuals!(atmp, uhat, integrator.uprev, integrator.u, integrator.opts.abstol, integrator.opts.reltol,integrator.opts.internalnorm) - integrator.EEst = integrator.opts.internalnorm(atmp) + calculate_residuals!(atmp.x[2], uhat, integrator.uprev.x[2], integrator.u.x[2], integrator.opts.abstol, integrator.opts.reltol,integrator.opts.internalnorm) + integrator.EEst = integrator.opts.internalnorm(atmp.x[2]) end end diff --git a/src/perform_step/rosenbrock_perform_step.jl b/src/perform_step/rosenbrock_perform_step.jl index 469a9e0c15..d26e647dd2 100644 --- a/src/perform_step/rosenbrock_perform_step.jl +++ b/src/perform_step/rosenbrock_perform_step.jl @@ -12,7 +12,7 @@ end function initialize!(integrator, cache::Union{Rosenbrock23ConstantCache, Rosenbrock32ConstantCache}) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Avoid undefined entries if k is an array of arrays @@ -37,8 +37,8 @@ end calc_rosenbrock_differentiation!(integrator, cache, γ, γ, repeat_step, false) - if has_invW(f) - A_mul_B!(vectmp, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp, W, linsolve_tmp_vec) else cache.linsolve(vectmp, W, linsolve_tmp_vec, !repeat_step) end @@ -50,12 +50,12 @@ end if mass_matrix == I tmp .= k₁ else - A_mul_B!(tmp,mass_matrix,k₁) + mul!(tmp,mass_matrix,k₁) end @. linsolve_tmp = f₁ - tmp - if has_invW(f) - A_mul_B!(vectmp2, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp2, W, linsolve_tmp_vec) else cache.linsolve(vectmp2, W, linsolve_tmp_vec) end @@ -71,13 +71,13 @@ end @. linsolve_tmp = fsallast - c₃₂*(k₂-f₁) - 2(k₁-fsalfirst) + dt*dT else @. du2 = c₃₂*k₂ + 2k₁ - A_mul_B!(du1,mass_matrix,du2) + mul!(du1,mass_matrix,du2) @. linsolve_tmp = fsallast - du1 + c₃₂*f₁ + 2fsalfirst + dt*dT end - if has_invW(f) - A_mul_B!(vectmp3, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp3, W, linsolve_tmp_vec) else cache.linsolve(vectmp3, W, linsolve_tmp_vec) end @@ -107,8 +107,8 @@ end calc_rosenbrock_differentiation!(integrator, cache, γ, γ, repeat_step, false) - if has_invW(f) - A_mul_B!(vectmp, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp, W, linsolve_tmp_vec) else cache.linsolve(vectmp, W, linsolve_tmp_vec, !repeat_step) end @@ -120,13 +120,13 @@ end if mass_matrix == I tmp .= k₁ else - A_mul_B!(tmp,mass_matrix,k₁) + mul!(tmp,mass_matrix,k₁) end @. linsolve_tmp = f₁ - tmp - if has_invW(f) - A_mul_B!(vectmp2, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp2, W, linsolve_tmp_vec) else cache.linsolve(vectmp2, W, linsolve_tmp_vec) end @@ -140,12 +140,12 @@ end @. linsolve_tmp = fsallast - c₃₂*(k₂-f₁) - 2(k₁-fsalfirst) + dt*dT else @. du2 = c₃₂*k₂ + 2k₁ - A_mul_B!(du1,mass_matrix,du2) + mul!(du1,mass_matrix,du2) @. linsolve_tmp = fsallast - du1 + c₃₂*f₁ + 2fsalfirst + dt*dT end - if has_invW(f) - A_mul_B!(vectmp3, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp3, W, linsolve_tmp_vec) else cache.linsolve(vectmp3, W, linsolve_tmp_vec) end @@ -242,7 +242,7 @@ function initialize!(integrator, cache::Union{Rosenbrock33ConstantCache, Rosenbrock4ConstantCache, Rosenbrock5ConstantCache}) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Avoid undefined entries if k is an array of arrays @@ -339,8 +339,8 @@ end calc_rosenbrock_differentiation!(integrator, cache, dtd1, dtgamma, repeat_step, true) - if has_invW(f) - A_mul_B!(vectmp, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp, W, linsolve_tmp_vec) else cache.linsolve(vectmp, W, linsolve_tmp_vec, !repeat_step) end @@ -353,12 +353,12 @@ end @. linsolve_tmp = du + dtd2*dT + dtC21*k1 else @. du1 = dtC21*k1 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + dtd2*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp2, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp2, W, linsolve_tmp_vec) else cache.linsolve(vectmp2, W, linsolve_tmp_vec) end @@ -371,12 +371,12 @@ end @. linsolve_tmp = du + dtd3*dT + dtC31*k1 + dtC32*k2 else @. du1 = dtC31*k1 + dtC32*k2 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + dtd3*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp3, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp3, W, linsolve_tmp_vec) else cache.linsolve(vectmp3, W, linsolve_tmp_vec) end @@ -481,8 +481,8 @@ end calc_rosenbrock_differentiation!(integrator, cache, dtd1, dtgamma, repeat_step, true) - if has_invW(f) - A_mul_B!(vectmp, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp, W, linsolve_tmp_vec) else cache.linsolve(vectmp, W, linsolve_tmp_vec, !repeat_step) end @@ -501,12 +501,12 @@ end @. linsolve_tmp = fsalfirst + dtd2*dT + dtC21*k1 else @. du1 = dtC21*k1 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = fsalfirst + dtd2*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp2, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp2, W, linsolve_tmp_vec) else cache.linsolve(vectmp2, W, linsolve_tmp_vec) end @@ -519,12 +519,12 @@ end @. linsolve_tmp = du + dtd3*dT + dtC31*k1 + dtC32*k2 else @. du1 = dtC31*k1 + dtC32*k2 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + dtd3*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp3, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp3, W, linsolve_tmp_vec) else cache.linsolve(vectmp3, W, linsolve_tmp_vec) end @@ -535,12 +535,12 @@ end @. linsolve_tmp = du + dtd4*dT + dtC41*k1 + dtC42*k2 + dtC43*k3 else @. du1 = dtC41*k1 + dtC42*k2 + dtC43*k3 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + dtd4*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp4, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp4, W, linsolve_tmp_vec) else cache.linsolve(vectmp4, W, linsolve_tmp_vec) end @@ -648,8 +648,8 @@ end calc_rosenbrock_differentiation!(integrator, cache, dtd1, dtgamma, repeat_step, true) - if has_invW(f) - A_mul_B!(vectmp, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp, W, linsolve_tmp_vec) else cache.linsolve(vectmp, W, linsolve_tmp_vec, !repeat_step) end @@ -662,12 +662,12 @@ end @. linsolve_tmp = du + dtd2*dT + dtC21*k1 else @. du1 = dtC21*k1 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + dtd2*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp2, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp2, W, linsolve_tmp_vec) else cache.linsolve(vectmp2, W, linsolve_tmp_vec) end @@ -680,12 +680,12 @@ end @. linsolve_tmp = du + dtd3*dT + dtC31*k1 + dtC32*k2 else @. du1 = dtC31*k1 + dtC32*k2 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + dtd3*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp3, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp3, W, linsolve_tmp_vec) else cache.linsolve(vectmp3, W, linsolve_tmp_vec) end @@ -696,12 +696,12 @@ end @. linsolve_tmp = du + dtd4*dT + dtC41*k1 + dtC42*k2 + dtC43*k3 else @. du1 = dtC41*k1 + dtC42*k2 + dtC43*k3 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + dtd4*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp4, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp4, W, linsolve_tmp_vec) else cache.linsolve(vectmp4, W, linsolve_tmp_vec) end @@ -724,7 +724,7 @@ end function initialize!(integrator, cache::Rodas4ConstantCache) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.k[1] = zero(integrator.u) integrator.k[2] = zero(integrator.u) @@ -859,8 +859,8 @@ end calc_rosenbrock_differentiation!(integrator, cache, dtd1, dtgamma, repeat_step, true) - if has_invW(f) - A_mul_B!(vectmp, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp, W, linsolve_tmp_vec) else cache.linsolve(vectmp, W, linsolve_tmp_vec, !repeat_step) end @@ -873,12 +873,12 @@ end @. linsolve_tmp = du + dtd2*dT + dtC21*k1 else @. du1 = dtC21*k1 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + dtd2*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp2, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp2, W, linsolve_tmp_vec) else cache.linsolve(vectmp2, W, linsolve_tmp_vec) end @@ -891,12 +891,12 @@ end @. linsolve_tmp = du + dtd3*dT + (dtC31*k1 + dtC32*k2) else @. du1 = dtC31*k1 + dtC32*k2 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + dtd3*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp3, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp3, W, linsolve_tmp_vec) else cache.linsolve(vectmp3, W, linsolve_tmp_vec) end @@ -909,12 +909,12 @@ end @. linsolve_tmp = du + dtd4*dT + (dtC41*k1 + dtC42*k2 + dtC43*k3) else @. du1 = dtC41*k1 + dtC42*k2 + dtC43*k3 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + dtd4*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp4, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp4, W, linsolve_tmp_vec) else cache.linsolve(vectmp4, W, linsolve_tmp_vec) end @@ -927,12 +927,12 @@ end @. linsolve_tmp = du + (dtC52*k2 + dtC54*k4 + dtC51*k1 + dtC53*k3) else @. du1 = dtC52*k2 + dtC54*k4 + dtC51*k1 + dtC53*k3 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + du2 end - if has_invW(f) - A_mul_B!(vectmp5, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp5, W, linsolve_tmp_vec) else cache.linsolve(vectmp5, W, linsolve_tmp_vec) end @@ -951,12 +951,12 @@ end @tight_loop_macros for i in uidx @inbounds du1[i] = dtC61*k1[i] + dtC62*k2[i] + dtC65*k5[i] + dtC64*k4[i] + dtC63*k3[i] end - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + du2 end - if has_invW(f) - A_mul_B!(vectmp6, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp6, W, linsolve_tmp_vec) else cache.linsolve(vectmp6, W, linsolve_tmp_vec) end @@ -1149,8 +1149,8 @@ end calc_rosenbrock_differentiation!(integrator, cache, dtd1, dtgamma, repeat_step, true) - if has_invW(f) - A_mul_B!(vectmp, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp, W, linsolve_tmp_vec) else cache.linsolve(vectmp, W, linsolve_tmp_vec, !repeat_step) end @@ -1165,12 +1165,12 @@ end @. linsolve_tmp = du + dtd2*dT + dtC21*k1 else @. du1 = dtC21*k1 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + dtd2*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp2, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp2, W, linsolve_tmp_vec) else cache.linsolve(vectmp2, W, linsolve_tmp_vec) end @@ -1183,12 +1183,12 @@ end @. linsolve_tmp = du + dtd3*dT + (dtC31*k1 + dtC32*k2) else @. du1 = dtC31*k1 + dtC32*k2 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + dtd3*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp3, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp3, W, linsolve_tmp_vec) else cache.linsolve(vectmp3, W, linsolve_tmp_vec) end @@ -1201,12 +1201,12 @@ end @. linsolve_tmp = du + dtd4*dT + (dtC41*k1 + dtC42*k2 + dtC43*k3) else @. du1 = dtC41*k1 + dtC42*k2 + dtC43*k3 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + dtd4*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp4, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp4, W, linsolve_tmp_vec) else cache.linsolve(vectmp4, W, linsolve_tmp_vec) end @@ -1222,12 +1222,12 @@ end end else @. du1 = dtC52*k2 + dtC54*k4 + dtC51*k1 + dtC53*k3 - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + dtd5*dT + du2 end - if has_invW(f) - A_mul_B!(vectmp5, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp5, W, linsolve_tmp_vec) else cache.linsolve(vectmp5, W, linsolve_tmp_vec) end @@ -1249,12 +1249,12 @@ end @tight_loop_macros for i in uidx @inbounds du1[i] = dtC61*k1[i] + dtC62*k2[i] + dtC63*k3[i] + dtC64*k4[i] + dtC65*k5[i] end - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + du2 end - if has_invW(f) - A_mul_B!(vectmp6, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp6, W, linsolve_tmp_vec) else cache.linsolve(vectmp6, W, linsolve_tmp_vec) end @@ -1273,12 +1273,12 @@ end @tight_loop_macros for i in uidx @inbounds du1[i] = dtC71*k1[i] + dtC72*k2[i] + dtC73*k3[i] + dtC74*k4[i] + dtC75*k5[i] + dtC76*k6[i] end - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + du2 end - if has_invW(f) - A_mul_B!(vectmp7, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp7, W, linsolve_tmp_vec) else cache.linsolve(vectmp7, W, linsolve_tmp_vec) end @@ -1297,12 +1297,12 @@ end @tight_loop_macros for i in uidx @inbounds du1[i] = dtC81*k1[i] + dtC82*k2[i] + dtC83*k3[i] + dtC84*k4[i] + dtC85*k5[i] + dtC86*k6[i] + dtC87*k7[i] end - A_mul_B!(du2,mass_matrix,du1) + mul!(du2,mass_matrix,du1) @. linsolve_tmp = du + du2 end - if has_invW(f) - A_mul_B!(vectmp8, W, linsolve_tmp_vec) + if DiffEqBase.has_invW(f) + mul!(vectmp8, W, linsolve_tmp_vec) else cache.linsolve(vectmp8, W, linsolve_tmp_vec) end diff --git a/src/perform_step/sdirk_perform_step.jl b/src/perform_step/sdirk_perform_step.jl index 065e532328..901a3106f7 100644 --- a/src/perform_step/sdirk_perform_step.jl +++ b/src/perform_step/sdirk_perform_step.jl @@ -7,7 +7,7 @@ function initialize!(integrator, cache::Union{ImplicitEulerConstantCache, Cash4ConstantCache, Hairer4ConstantCache}) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays @@ -292,12 +292,12 @@ end calculate_residuals!(atmp, tmp, uprev, u, integrator.opts.abstol, integrator.opts.reltol,integrator.opts.internalnorm) integrator.EEst = integrator.opts.internalnorm(atmp) if integrator.EEst <= 1 - copy!(cache.uprev3,uprev2) + copyto!(cache.uprev3,uprev2) cache.tprev2 = tprev end elseif integrator.success_iter > 0 integrator.EEst = 1 - copy!(cache.uprev3,integrator.uprev2) + copyto!(cache.uprev3,integrator.uprev2) cache.tprev2 = integrator.tprev else integrator.EEst = 1 @@ -397,8 +397,8 @@ end if integrator.opts.adaptive @. dz = btilde1*zprev + btilde2*zᵧ + btilde3*z if alg.smooth_est # From Shampine - if has_invW(f) - A_mul_B!(vec(tmp),W,vec(dz)) + if DiffEqBase.has_invW(f) + mul!(vec(tmp),W,vec(dz)) else cache.linsolve(vec(tmp),W,vec(dz),false) end @@ -500,8 +500,8 @@ end if integrator.opts.adaptive @. dz = z₁/2 - z₂/2 if alg.smooth_est # From Shampine - if has_invW(f) - A_mul_B!(vec(tmp),W,vec(dz)) + if DiffEqBase.has_invW(f) + mul!(vec(tmp),W,vec(dz)) else cache.linsolve(vec(tmp),W,vec(dz),false) end @@ -760,8 +760,8 @@ end @. dz = btilde1*z₁ + btilde2*z₂ + btilde3*z₃ + btilde4*z₄ + btilde5*z₅ if alg.smooth_est # From Shampine - if has_invW(f) - A_mul_B!(vec(tmp),W,vec(dz)) + if DiffEqBase.has_invW(f) + mul!(vec(tmp),W,vec(dz)) else cache.linsolve(vec(tmp),W,vec(dz),false) end @@ -912,8 +912,8 @@ end dz[i] = btilde1*z₁[i] + btilde2*z₂[i] + btilde3*z₃[i] + btilde4*z₄[i] + btilde5*z₅[i] end if alg.smooth_est # From Shampine - if has_invW(f) - A_mul_B!(vec(tmp),W,vec(dz)) + if DiffEqBase.has_invW(f) + mul!(vec(tmp),W,vec(dz)) else cache.linsolve(vec(tmp),W,vec(dz),false) end diff --git a/src/perform_step/split_perform_step.jl b/src/perform_step/split_perform_step.jl index 413edac824..01c58d9f4b 100644 --- a/src/perform_step/split_perform_step.jl +++ b/src/perform_step/split_perform_step.jl @@ -1,6 +1,6 @@ function initialize!(integrator,cache::SplitEulerConstantCache) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f.f1(integrator.uprev,integrator.p,integrator.t) + integrator.f.f2(integrator.uprev,integrator.p,integrator.t) # Pre-start fsal diff --git a/src/perform_step/ssprk_perform_step.jl b/src/perform_step/ssprk_perform_step.jl index 96635d19a8..826bfe485a 100644 --- a/src/perform_step/ssprk_perform_step.jl +++ b/src/perform_step/ssprk_perform_step.jl @@ -1,7 +1,7 @@ function initialize!(integrator,cache::SSPRK22ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev,integrator.p,integrator.t) # Pre-start fsal integrator.kshortsize = 1 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -51,7 +51,7 @@ end function initialize!(integrator,cache::SSPRK33ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev,integrator.p,integrator.t) # Pre-start fsal integrator.kshortsize = 1 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -108,7 +108,7 @@ end function initialize!(integrator,cache::SSPRK53ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev,integrator.p,integrator.t) # Pre-start fsal integrator.kshortsize = 1 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -180,7 +180,7 @@ end function initialize!(integrator,cache::SSPRK63ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev,integrator.p,integrator.t) # Pre-start fsal integrator.kshortsize = 1 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -259,7 +259,7 @@ end function initialize!(integrator,cache::SSPRK73ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev,integrator.p,integrator.t) # Pre-start fsal integrator.kshortsize = 1 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -345,7 +345,7 @@ end function initialize!(integrator,cache::SSPRK83ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev,integrator.p,integrator.t) # Pre-start fsal integrator.kshortsize = 1 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -437,7 +437,7 @@ end function initialize!(integrator,cache::SSPRK432ConstantCache) integrator.kshortsize = 1 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev,integrator.p,integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays @@ -519,7 +519,7 @@ end function initialize!(integrator,cache::SSPRK932ConstantCache) integrator.kshortsize = 1 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev,integrator.p,integrator.t) # Pre-start fsal # Avoid undefined entries if k is an array of arrays @@ -646,7 +646,7 @@ end function initialize!(integrator,cache::SSPRK54ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev,integrator.p,integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -721,7 +721,7 @@ end function initialize!(integrator,cache::SSPRK104ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev,integrator.p,integrator.t) # Pre-start fsal integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) diff --git a/src/perform_step/symplectic_perform_step.jl b/src/perform_step/symplectic_perform_step.jl index 57628061a6..56253d55b9 100644 --- a/src/perform_step/symplectic_perform_step.jl +++ b/src/perform_step/symplectic_perform_step.jl @@ -2,7 +2,7 @@ function initialize!(integrator,cache::SymplecticEulerConstantCache) integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Do the calculation pre # So that way FSAL interpolation duprev,uprev = integrator.uprev.x @@ -91,7 +91,7 @@ function initialize!(integrator,cache::C) where Symplectic6ConstantCache,Symplectic62ConstantCache, McAte8ConstantCache,KahanLi8ConstantCache,SofSpa10ConstantCache}} integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) duprev,uprev = integrator.uprev.x kdu = integrator.f.f1(duprev,uprev,integrator.p,integrator.t) @@ -130,10 +130,10 @@ end f.f1(kdu,duprev,u,p,t+dt) # v(t+Δt) = v(t) + 1/2*(a(t)+a(t+Δt))*Δt @. du = duprev + dt*(half*ku + half*kdu) - copy!(integrator.k[1].x[1],integrator.k[2].x[1]) - copy!(integrator.k[1].x[2],integrator.k[2].x[2]) - copy!(integrator.k[2].x[1],kdu) - copy!(integrator.k[2].x[2],du) + copyto!(integrator.k[1].x[1],integrator.k[2].x[1]) + copyto!(integrator.k[1].x[2],integrator.k[2].x[2]) + copyto!(integrator.k[2].x[1],kdu) + copyto!(integrator.k[2].x[2],du) end @muladd function perform_step!(integrator,cache::Symplectic2ConstantCache,repeat_step=false) @@ -177,10 +177,10 @@ end f.f1(kdu,du,u,p,tnew) @. du = du + dt*a2*kdu - copy!(integrator.k[1].x[1],integrator.k[2].x[1]) - copy!(integrator.k[1].x[2],integrator.k[2].x[2]) - copy!(integrator.k[2].x[2],du) - copy!(integrator.k[2].x[1],kdu) + copyto!(integrator.k[1].x[1],integrator.k[2].x[1]) + copyto!(integrator.k[1].x[2],integrator.k[2].x[2]) + copyto!(integrator.k[2].x[2],du) + copyto!(integrator.k[2].x[1],kdu) end @muladd function perform_step!(integrator,cache::Symplectic3ConstantCache,repeat_step=false) @@ -239,10 +239,10 @@ end f.f1(kdu,du,u,p,tnew) @. du = du + dt*a3*kdu - copy!(integrator.k[1].x[1],integrator.k[2].x[1]) - copy!(integrator.k[1].x[2],integrator.k[2].x[2]) - copy!(integrator.k[2].x[2],du) - copy!(integrator.k[2].x[1],kdu) + copyto!(integrator.k[1].x[1],integrator.k[2].x[1]) + copyto!(integrator.k[1].x[2],integrator.k[2].x[2]) + copyto!(integrator.k[2].x[2],du) + copyto!(integrator.k[2].x[1],kdu) end @muladd function perform_step!(integrator,cache::Symplectic4ConstantCache,repeat_step=false) @@ -317,10 +317,10 @@ end f.f1(kdu,du,u,p,tnew) @. du = du + dt*a4*kdu - copy!(integrator.k[1].x[1],integrator.k[2].x[1]) - copy!(integrator.k[1].x[2],integrator.k[2].x[2]) - copy!(integrator.k[2].x[2],du) - copy!(integrator.k[2].x[1],kdu) + copyto!(integrator.k[1].x[1],integrator.k[2].x[1]) + copyto!(integrator.k[1].x[2],integrator.k[2].x[2]) + copyto!(integrator.k[2].x[2],du) + copyto!(integrator.k[2].x[1],kdu) end @muladd function perform_step!(integrator,cache::Symplectic45ConstantCache,repeat_step=false) @@ -415,10 +415,10 @@ end if typeof(integrator.alg) <: McAte42 @. du = du + dt*a5*kdu end - copy!(integrator.k[1].x[1],integrator.k[2].x[1]) - copy!(integrator.k[1].x[2],integrator.k[2].x[2]) - copy!(integrator.k[2].x[2],du) - copy!(integrator.k[2].x[1],kdu) + copyto!(integrator.k[1].x[1],integrator.k[2].x[1]) + copyto!(integrator.k[1].x[2],integrator.k[2].x[2]) + copyto!(integrator.k[2].x[2],du) + copyto!(integrator.k[2].x[1],kdu) end @muladd function perform_step!(integrator,cache::Symplectic5ConstantCache,repeat_step=false) @@ -523,10 +523,10 @@ end f.f1(kdu,du,u,p,tnew) @. du = du + dt*a6*kdu - copy!(integrator.k[1].x[1],integrator.k[2].x[1]) - copy!(integrator.k[1].x[2],integrator.k[2].x[2]) - copy!(integrator.k[2].x[2],du) - copy!(integrator.k[2].x[1],kdu) + copyto!(integrator.k[1].x[1],integrator.k[2].x[1]) + copyto!(integrator.k[1].x[2],integrator.k[2].x[2]) + copyto!(integrator.k[2].x[2],du) + copyto!(integrator.k[2].x[1],kdu) end @muladd function perform_step!(integrator,cache::Symplectic6ConstantCache,repeat_step=false) @@ -659,10 +659,10 @@ end f.f1(kdu,du,u,p,tnew) # @. du = du + dt*a8*kdu - copy!(integrator.k[1].x[1],integrator.k[2].x[1]) - copy!(integrator.k[1].x[2],integrator.k[2].x[2]) - copy!(integrator.k[2].x[2],du) - copy!(integrator.k[2].x[1],kdu) + copyto!(integrator.k[1].x[1],integrator.k[2].x[1]) + copyto!(integrator.k[1].x[2],integrator.k[2].x[2]) + copyto!(integrator.k[2].x[2],du) + copyto!(integrator.k[2].x[1],kdu) end @muladd function perform_step!(integrator,cache::Symplectic62ConstantCache,repeat_step=false) @@ -823,10 +823,10 @@ end f.f1(kdu,du,u,p,tnew) # @. du = du + dt*a10*kdu - copy!(integrator.k[1].x[1],integrator.k[2].x[1]) - copy!(integrator.k[1].x[2],integrator.k[2].x[2]) - copy!(integrator.k[2].x[2],du) - copy!(integrator.k[2].x[1],kdu) + copyto!(integrator.k[1].x[1],integrator.k[2].x[1]) + copyto!(integrator.k[1].x[2],integrator.k[2].x[2]) + copyto!(integrator.k[2].x[2],du) + copyto!(integrator.k[2].x[1],kdu) end @muladd function perform_step!(integrator,cache::McAte8ConstantCache,repeat_step=false) @@ -1073,10 +1073,10 @@ end f.f1(kdu,du,u,p,tnew) # @. du = du + dt*a16*kdu - copy!(integrator.k[1].x[1],integrator.k[2].x[1]) - copy!(integrator.k[1].x[2],integrator.k[2].x[2]) - copy!(integrator.k[2].x[2],du) - copy!(integrator.k[2].x[1],kdu) + copyto!(integrator.k[1].x[1],integrator.k[2].x[1]) + copyto!(integrator.k[1].x[2],integrator.k[2].x[2]) + copyto!(integrator.k[2].x[2],du) + copyto!(integrator.k[2].x[1],kdu) end @muladd function perform_step!(integrator,cache::KahanLi8ConstantCache,repeat_step=false) @@ -1351,10 +1351,10 @@ end f.f1(kdu,du,u,p,tnew) # @. du = du + dt*a18*kdu - copy!(integrator.k[1].x[1],integrator.k[2].x[1]) - copy!(integrator.k[1].x[2],integrator.k[2].x[2]) - copy!(integrator.k[2].x[2],du) - copy!(integrator.k[2].x[1],kdu) + copyto!(integrator.k[1].x[1],integrator.k[2].x[1]) + copyto!(integrator.k[1].x[2],integrator.k[2].x[2]) + copyto!(integrator.k[2].x[2],du) + copyto!(integrator.k[2].x[1],kdu) end @muladd function perform_step!(integrator,cache::SofSpa10ConstantCache,repeat_step=false) @@ -1889,8 +1889,8 @@ end f.f1(kdu,du,u,p,tnew) # @. du = du + dt*a30*kdu - copy!(integrator.k[1].x[1],integrator.k[2].x[1]) - copy!(integrator.k[1].x[2],integrator.k[2].x[2]) - copy!(integrator.k[2].x[2],du) - copy!(integrator.k[2].x[1],kdu) + copyto!(integrator.k[1].x[1],integrator.k[2].x[1]) + copyto!(integrator.k[1].x[2],integrator.k[2].x[2]) + copyto!(integrator.k[2].x[2],du) + copyto!(integrator.k[2].x[1],kdu) end diff --git a/src/perform_step/verner_rk_perform_step.jl b/src/perform_step/verner_rk_perform_step.jl index 7d2f1c2f40..001ad09d74 100644 --- a/src/perform_step/verner_rk_perform_step.jl +++ b/src/perform_step/verner_rk_perform_step.jl @@ -2,7 +2,7 @@ function initialize!(integrator, cache::Vern6ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal alg = unwrap_alg(integrator, false) alg.lazy ? (integrator.kshortsize = 9) : (integrator.kshortsize = 12) - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -190,7 +190,7 @@ end function initialize!(integrator, cache::Vern7ConstantCache) alg = unwrap_alg(integrator, false) alg.lazy ? (integrator.kshortsize = 10) : (integrator.kshortsize = 16) - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays @inbounds for i in eachindex(integrator.k) @@ -397,7 +397,7 @@ end function initialize!(integrator, cache::Vern8ConstantCache) alg = unwrap_alg(integrator, false) alg.lazy ? (integrator.kshortsize = 13) : (integrator.kshortsize = 21) - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays @inbounds for i in eachindex(integrator.k) @@ -634,7 +634,7 @@ end function initialize!(integrator, cache::Vern9ConstantCache) alg = unwrap_alg(integrator, false) alg.lazy ? (integrator.kshortsize = 16) : (integrator.kshortsize = 26) - integrator.k = typeof(integrator.k)(integrator.kshortsize) + integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) # Avoid undefined entries if k is an array of arrays @inbounds for i in eachindex(integrator.k) diff --git a/src/solve.jl b/src/solve.jl index e68be5ffee..53cce3c378 100644 --- a/src/solve.jl +++ b/src/solve.jl @@ -1,15 +1,15 @@ -function solve{algType<:OrdinaryDiffEqAlgorithm,recompile_flag}( - prob::AbstractODEProblem, +function DiffEqBase.__solve( + prob::DiffEqBase.AbstractODEProblem, alg::algType,timeseries=[],ts=[],ks=[],recompile::Type{Val{recompile_flag}}=Val{true}; - kwargs...) + kwargs...) where {algType<:OrdinaryDiffEqAlgorithm,recompile_flag} - integrator = init(prob,alg,timeseries,ts,ks,recompile;kwargs...) + integrator = DiffEqBase.__init(prob,alg,timeseries,ts,ks,recompile;kwargs...) solve!(integrator) integrator.sol end -function init{algType<:OrdinaryDiffEqAlgorithm,recompile_flag}( - prob::AbstractODEProblem, +function DiffEqBase.__init( + prob::DiffEqBase.AbstractODEProblem, alg::algType,timeseries_init=typeof(prob.u0)[], ts_init=eltype(prob.tspan)[],ks_init=[], recompile::Type{Val{recompile_flag}}=Val{true}; @@ -45,6 +45,7 @@ function init{algType<:OrdinaryDiffEqAlgorithm,recompile_flag}( typeof(one(eltype(prob.tspan))) <: Integer ? 0 : eltype(prob.tspan)(1//10^(10)), internalnorm = ODE_DEFAULT_NORM, + internalopnorm = LinearAlgebra.opnorm, isoutofdomain = ODE_DEFAULT_ISOUTOFDOMAIN, unstable_check = ODE_DEFAULT_UNSTABLE_CHECK, verbose = true, force_dtmin = false, @@ -55,7 +56,7 @@ function init{algType<:OrdinaryDiffEqAlgorithm,recompile_flag}( progress_message = ODE_DEFAULT_PROG_MESSAGE, userdata=nothing, allow_extrapolation = alg_extrapolates(alg), - initialize_integrator=true,kwargs...) + initialize_integrator=true,kwargs...) where {algType<:OrdinaryDiffEqAlgorithm,recompile_flag} if typeof(prob.f)<:Tuple if min((mm != I for mm in prob.mass_matrix)...) @@ -68,12 +69,12 @@ function init{algType<:OrdinaryDiffEqAlgorithm,recompile_flag}( end if !isempty(saveat) && dense - warn("Dense output is incompatible with saveat. Please use the SavingCallback from the Callback Library to mix the two behaviors.") + @warn("Dense output is incompatible with saveat. Please use the SavingCallback from the Callback Library to mix the two behaviors.") end if (eltype(prob.u0) <: Dual && !(eltype(prob.tspan)<:Dual) || !(eltype(prob.u0) <: Dual) && eltype(prob.tspan)<:Dual) && adaptive - warn("Autodifferentiation through the solver with adaptive timestepping requires both time and states to be dual numbers. Please see the FAQ.") + @warn("Autodifferentiation through the solver with adaptive timestepping requires both time and states to be dual numbers. Please see the FAQ.") end tType = eltype(prob.tspan) @@ -105,7 +106,7 @@ function init{algType<:OrdinaryDiffEqAlgorithm,recompile_flag}( uBottomEltype = recursive_bottom_eltype(u) uBottomEltypeNoUnits = recursive_unitless_bottom_eltype(u) - ks = Vector{uType}(0) + ks = Vector{uType}(undef, 0) uEltypeNoUnits = recursive_unitless_eltype(u) tTypeNoUnits = typeof(one(tType)) @@ -135,7 +136,7 @@ function init{algType<:OrdinaryDiffEqAlgorithm,recompile_flag}( if isinplace(prob) && typeof(u) <: AbstractArray && eltype(u) <: Number # Could this be more efficient for other arrays? if !(typeof(u) <: ArrayPartition) - rate_prototype = similar(u,typeof(oneunit(uBottomEltype)/oneunit(tType)),indices(u)) + rate_prototype = similar(u,typeof(oneunit(uBottomEltype)/oneunit(tType)),axes(u)) else rate_prototype = similar(u, typeof.(oneunit.(recursive_bottom_eltype.(u.x))./oneunit(tType))...) end @@ -149,7 +150,6 @@ function init{algType<:OrdinaryDiffEqAlgorithm,recompile_flag}( callbacks_internal = CallbackSet(callback,prob.callback) - ### Algorithm-specific defaults ### if save_idxs == nothing ksEltype = Vector{rateType} @@ -238,7 +238,7 @@ function init{algType<:OrdinaryDiffEqAlgorithm,recompile_flag}( end opts = DEOptions{typeof(abstol_internal),typeof(reltol_internal),QT,tType, - typeof(internalnorm),typeof(callbacks_internal),typeof(isoutofdomain), + typeof(internalnorm),typeof(internalopnorm),typeof(callbacks_internal),typeof(isoutofdomain), typeof(progress_message),typeof(unstable_check),typeof(tstops_internal), typeof(d_discontinuities_internal),typeof(userdata),typeof(save_idxs), typeof(maxiters),typeof(tstops),typeof(saveat), @@ -247,7 +247,7 @@ function init{algType<:OrdinaryDiffEqAlgorithm,recompile_flag}( reltol_internal,QT(gamma),QT(qmax), QT(qmin),QT(qsteady_max), QT(qsteady_min),QT(failfactor),tType(dtmax), - tType(dtmin),internalnorm,save_idxs,tstops_internal,saveat_internal, + tType(dtmin),internalnorm,internalopnorm,save_idxs,tstops_internal,saveat_internal, d_discontinuities_internal, tstops,saveat,d_discontinuities, userdata,progress,progress_steps, @@ -258,12 +258,12 @@ function init{algType<:OrdinaryDiffEqAlgorithm,recompile_flag}( calck,force_dtmin,advance_to_tstop,stop_at_next_tstop) if typeof(alg) <: OrdinaryDiffEqCompositeAlgorithm - sol = build_solution(prob,alg,ts,timeseries, + sol = DiffEqBase.build_solution(prob,alg,ts,timeseries, dense=dense,k=ks,interp=id, alg_choice=alg_choice, calculate_error = false) else - sol = build_solution(prob,alg,ts,timeseries, + sol = DiffEqBase.build_solution(prob,alg,ts,timeseries, dense=dense,k=ks,interp=id, calculate_error = false) end @@ -274,7 +274,7 @@ function init{algType<:OrdinaryDiffEqAlgorithm,recompile_flag}( cacheType = typeof(cache) else FType = Function - SolType = AbstractODESolution + SolType = DiffEqBase.AbstractODESolution cacheType = OrdinaryDiffEqCache end @@ -325,7 +325,7 @@ function init{algType<:OrdinaryDiffEqAlgorithm,recompile_flag}( end if isnan(integrator.dt) if verbose - warn("Automatic dt set the starting dt as NaN, causing instability.") + @warn("Automatic dt set the starting dt as NaN, causing instability.") end end elseif integrator.opts.adaptive && integrator.dt > zero(integrator.dt) && integrator.tdir < 0 @@ -335,7 +335,7 @@ function init{algType<:OrdinaryDiffEqAlgorithm,recompile_flag}( integrator end -function solve!(integrator::ODEIntegrator) +function DiffEqBase.solve!(integrator::ODEIntegrator) @inbounds while !isempty(integrator.opts.tstops) while integrator.tdir*integrator.t < integrator.tdir*top(integrator.opts.tstops) loopheader!(integrator) @@ -356,10 +356,10 @@ function solve!(integrator::ODEIntegrator) f = integrator.sol.prob.f end - if has_analytic(f) - calculate_solution_errors!(integrator.sol;timeseries_errors=integrator.opts.timeseries_errors,dense_errors=integrator.opts.dense_errors) + if !(typeof(integrator.sol.prob)<:DiscreteProblem) && DiffEqBase.has_analytic(f) + DiffEqBase.calculate_solution_errors!(integrator.sol;timeseries_errors=integrator.opts.timeseries_errors,dense_errors=integrator.opts.dense_errors) end - integrator.sol = solution_new_retcode(integrator.sol,:Success) + integrator.sol = DiffEqBase.solution_new_retcode(integrator.sol,:Success) nothing end diff --git a/src/tableaus/feagin_tableaus.jl b/src/tableaus/feagin_tableaus.jl index f566731cfb..0bbd0764bb 100644 --- a/src/tableaus/feagin_tableaus.jl +++ b/src/tableaus/feagin_tableaus.jl @@ -125,7 +125,7 @@ end constructFeagin10 """ -Base.@pure function Feagin10ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function Feagin10ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} adaptiveConst = T(0.002777777777777778) a0100 = T(0.1) @@ -274,104 +274,104 @@ function Feagin10ConstantCache(T::Type,T2::Type) adaptiveConst = T(1//360) a0100 = T(1//10) - a0200 = T(parse(BigFloat,"-0.915176561375291440520015019275342154318951387664369720564660")) - a0201 = T(parse(BigFloat,"1.45453440217827322805250021715664459117622483736537873607016")) - - a0300 = T(parse(BigFloat,"0.202259190301118170324681949205488413821477543637878380814562")) - a0302 = T(parse(BigFloat,"0.606777570903354510974045847616465241464432630913635142443687")) - - a0400 = T(parse(BigFloat,"0.184024714708643575149100693471120664216774047979591417844635")) - a0402 = T(parse(BigFloat,"0.197966831227192369068141770510388793370637287463360401555746")) - a0403 = T(parse(BigFloat,"-0.0729547847313632629185146671595558023015011608914382961421311")) - - a0500 = T(parse(BigFloat,"0.0879007340206681337319777094132125475918886824944548534041378")) - a0503 = T(parse(BigFloat,"0.410459702520260645318174895920453426088035325902848695210406")) - a0504 = T(parse(BigFloat,"0.482713753678866489204726942976896106809132737721421333413261")) - - a0600 = T(parse(BigFloat,"0.0859700504902460302188480225945808401411132615636600222593880")) - a0603 = T(parse(BigFloat,"0.330885963040722183948884057658753173648240154838402033448632")) - a0604 = T(parse(BigFloat,"0.489662957309450192844507011135898201178015478433790097210790")) - a0605 = T(parse(BigFloat,"-0.0731856375070850736789057580558988816340355615025188195854775")) - - a0700 = T(parse(BigFloat,"0.120930449125333720660378854927668953958938996999703678812621")) - a0704 = T(parse(BigFloat,"0.260124675758295622809007617838335174368108756484693361887839")) - a0705 = T(parse(BigFloat,"0.0325402621549091330158899334391231259332716675992700000776101")) - a0706 = T(parse(BigFloat,"-0.0595780211817361001560122202563305121444953672762930724538856")) - - a0800 = T(parse(BigFloat,"0.110854379580391483508936171010218441909425780168656559807038")) - a0805 = T(parse(BigFloat,"-0.0605761488255005587620924953655516875526344415354339234619466")) - a0806 = T(parse(BigFloat,"0.321763705601778390100898799049878904081404368603077129251110")) - a0807 = T(parse(BigFloat,"0.510485725608063031577759012285123416744672137031752354067590")) - - a0900 = T(parse(BigFloat,"0.112054414752879004829715002761802363003717611158172229329393")) - a0905 = T(parse(BigFloat,"-0.144942775902865915672349828340980777181668499748506838876185")) - a0906 = T(parse(BigFloat,"-0.333269719096256706589705211415746871709467423992115497968724")) - a0907 = T(parse(BigFloat,"0.499269229556880061353316843969978567860276816592673201240332")) - a0908 = T(parse(BigFloat,"0.509504608929686104236098690045386253986643232352989602185060")) - - a1000 = T(parse(BigFloat,"0.113976783964185986138004186736901163890724752541486831640341")) - a1005 = T(parse(BigFloat,"-0.0768813364203356938586214289120895270821349023390922987406384")) - a1006 = T(parse(BigFloat,"0.239527360324390649107711455271882373019741311201004119339563")) - a1007 = T(parse(BigFloat,"0.397774662368094639047830462488952104564716416343454639902613")) - a1008 = T(parse(BigFloat,"0.0107558956873607455550609147441477450257136782823280838547024")) - a1009 = T(parse(BigFloat,"-0.327769124164018874147061087350233395378262992392394071906457")) - - a1100 = T(parse(BigFloat,"0.0798314528280196046351426864486400322758737630423413945356284")) - a1105 = T(parse(BigFloat,"-0.0520329686800603076514949887612959068721311443881683526937298")) - a1106 = T(parse(BigFloat,"-0.0576954146168548881732784355283433509066159287152968723021864")) - a1107 = T(parse(BigFloat,"0.194781915712104164976306262147382871156142921354409364738090")) - a1108 = T(parse(BigFloat,"0.145384923188325069727524825977071194859203467568236523866582")) - a1109 = T(parse(BigFloat,"-0.0782942710351670777553986729725692447252077047239160551335016")) - a1110 = T(parse(BigFloat,"-0.114503299361098912184303164290554670970133218405658122674674")) - - a1200 = T(parse(BigFloat,"0.985115610164857280120041500306517278413646677314195559520529")) - a1203 = T(parse(BigFloat,"0.330885963040722183948884057658753173648240154838402033448632")) - a1204 = T(parse(BigFloat,"0.489662957309450192844507011135898201178015478433790097210790")) - a1205 = T(parse(BigFloat,"-1.37896486574843567582112720930751902353904327148559471526397")) - a1206 = T(parse(BigFloat,"-0.861164195027635666673916999665534573351026060987427093314412")) - a1207 = T(parse(BigFloat,"5.78428813637537220022999785486578436006872789689499172601856")) - a1208 = T(parse(BigFloat,"3.28807761985103566890460615937314805477268252903342356581925")) - a1209 = T(parse(BigFloat,"-2.38633905093136384013422325215527866148401465975954104585807")) - a1210 = T(parse(BigFloat,"-3.25479342483643918654589367587788726747711504674780680269911")) - a1211 = T(parse(BigFloat,"-2.16343541686422982353954211300054820889678036420109999154887")) - - a1300 = T(parse(BigFloat,"0.895080295771632891049613132336585138148156279241561345991710")) - a1302 = T(parse(BigFloat,"0.197966831227192369068141770510388793370637287463360401555746")) - a1303 = T(parse(BigFloat,"-0.0729547847313632629185146671595558023015011608914382961421311")) - a1305 = T(parse(BigFloat,"-0.851236239662007619739049371445966793289359722875702227166105")) - a1306 = T(parse(BigFloat,"0.398320112318533301719718614174373643336480918103773904231856")) - a1307 = T(parse(BigFloat,"3.63937263181035606029412920047090044132027387893977804176229")) - a1308 = T(parse(BigFloat,"1.54822877039830322365301663075174564919981736348973496313065")) - a1309 = T(parse(BigFloat,"-2.12221714704053716026062427460427261025318461146260124401561")) - a1310 = T(parse(BigFloat,"-1.58350398545326172713384349625753212757269188934434237975291")) - a1311 = T(parse(BigFloat,"-1.71561608285936264922031819751349098912615880827551992973034")) - a1312 = T(parse(BigFloat,"-0.0244036405750127452135415444412216875465593598370910566069132")) - - a1400 = T(parse(BigFloat,"-0.915176561375291440520015019275342154318951387664369720564660")) - a1401 = T(parse(BigFloat,"1.45453440217827322805250021715664459117622483736537873607016")) - a1404 = T(parse(BigFloat,"-0.777333643644968233538931228575302137803351053629547286334469")) - a1406 = T(parse(BigFloat,"-0.0910895662155176069593203555807484200111889091770101799647985")) - a1412 = T(parse(BigFloat,"0.0910895662155176069593203555807484200111889091770101799647985")) - a1413 = T(parse(BigFloat,"0.777333643644968233538931228575302137803351053629547286334469")) + a0200 = T(-0.915176561375291440520015019275342154318951387664369720564660) + a0201 = T(1.45453440217827322805250021715664459117622483736537873607016) + + a0300 = T(0.202259190301118170324681949205488413821477543637878380814562) + a0302 = T(0.606777570903354510974045847616465241464432630913635142443687) + + a0400 = T(0.184024714708643575149100693471120664216774047979591417844635) + a0402 = T(0.197966831227192369068141770510388793370637287463360401555746) + a0403 = T(-0.0729547847313632629185146671595558023015011608914382961421311) + + a0500 = T(0.0879007340206681337319777094132125475918886824944548534041378) + a0503 = T(0.410459702520260645318174895920453426088035325902848695210406) + a0504 = T(0.482713753678866489204726942976896106809132737721421333413261) + + a0600 = T(0.0859700504902460302188480225945808401411132615636600222593880) + a0603 = T(0.330885963040722183948884057658753173648240154838402033448632) + a0604 = T(0.489662957309450192844507011135898201178015478433790097210790) + a0605 = T(-0.0731856375070850736789057580558988816340355615025188195854775) + + a0700 = T(0.120930449125333720660378854927668953958938996999703678812621) + a0704 = T(0.260124675758295622809007617838335174368108756484693361887839) + a0705 = T(0.0325402621549091330158899334391231259332716675992700000776101) + a0706 = T(-0.0595780211817361001560122202563305121444953672762930724538856) + + a0800 = T(0.110854379580391483508936171010218441909425780168656559807038) + a0805 = T(-0.0605761488255005587620924953655516875526344415354339234619466) + a0806 = T(0.321763705601778390100898799049878904081404368603077129251110) + a0807 = T(0.510485725608063031577759012285123416744672137031752354067590) + + a0900 = T(0.112054414752879004829715002761802363003717611158172229329393) + a0905 = T(-0.144942775902865915672349828340980777181668499748506838876185) + a0906 = T(-0.333269719096256706589705211415746871709467423992115497968724) + a0907 = T(0.499269229556880061353316843969978567860276816592673201240332) + a0908 = T(0.509504608929686104236098690045386253986643232352989602185060) + + a1000 = T(0.113976783964185986138004186736901163890724752541486831640341) + a1005 = T(-0.0768813364203356938586214289120895270821349023390922987406384) + a1006 = T(0.239527360324390649107711455271882373019741311201004119339563) + a1007 = T(0.397774662368094639047830462488952104564716416343454639902613) + a1008 = T(0.0107558956873607455550609147441477450257136782823280838547024) + a1009 = T(-0.327769124164018874147061087350233395378262992392394071906457) + + a1100 = T(0.0798314528280196046351426864486400322758737630423413945356284) + a1105 = T(-0.0520329686800603076514949887612959068721311443881683526937298) + a1106 = T(-0.0576954146168548881732784355283433509066159287152968723021864) + a1107 = T(0.194781915712104164976306262147382871156142921354409364738090) + a1108 = T(0.145384923188325069727524825977071194859203467568236523866582) + a1109 = T(-0.0782942710351670777553986729725692447252077047239160551335016) + a1110 = T(-0.114503299361098912184303164290554670970133218405658122674674) + + a1200 = T(0.985115610164857280120041500306517278413646677314195559520529) + a1203 = T(0.330885963040722183948884057658753173648240154838402033448632) + a1204 = T(0.489662957309450192844507011135898201178015478433790097210790) + a1205 = T(-1.37896486574843567582112720930751902353904327148559471526397) + a1206 = T(-0.861164195027635666673916999665534573351026060987427093314412) + a1207 = T(5.78428813637537220022999785486578436006872789689499172601856) + a1208 = T(3.28807761985103566890460615937314805477268252903342356581925) + a1209 = T(-2.38633905093136384013422325215527866148401465975954104585807) + a1210 = T(-3.25479342483643918654589367587788726747711504674780680269911) + a1211 = T(-2.16343541686422982353954211300054820889678036420109999154887) + + a1300 = T(0.895080295771632891049613132336585138148156279241561345991710) + a1302 = T(0.197966831227192369068141770510388793370637287463360401555746) + a1303 = T(-0.0729547847313632629185146671595558023015011608914382961421311) + a1305 = T(-0.851236239662007619739049371445966793289359722875702227166105) + a1306 = T(0.398320112318533301719718614174373643336480918103773904231856) + a1307 = T(3.63937263181035606029412920047090044132027387893977804176229) + a1308 = T(1.54822877039830322365301663075174564919981736348973496313065) + a1309 = T(-2.12221714704053716026062427460427261025318461146260124401561) + a1310 = T(-1.58350398545326172713384349625753212757269188934434237975291) + a1311 = T(-1.71561608285936264922031819751349098912615880827551992973034) + a1312 = T(-0.0244036405750127452135415444412216875465593598370910566069132) + + a1400 = T(-0.915176561375291440520015019275342154318951387664369720564660) + a1401 = T(1.45453440217827322805250021715664459117622483736537873607016) + a1404 = T(-0.777333643644968233538931228575302137803351053629547286334469) + a1406 = T(-0.0910895662155176069593203555807484200111889091770101799647985) + a1412 = T(0.0910895662155176069593203555807484200111889091770101799647985) + a1413 = T(0.777333643644968233538931228575302137803351053629547286334469) a1500 = T(1//10) - a1502 = T(parse(BigFloat,"-0.157178665799771163367058998273128921867183754126709419409654")) - a1514 = T(parse(BigFloat,"0.157178665799771163367058998273128921867183754126709419409654")) + a1502 = T(-0.157178665799771163367058998273128921867183754126709419409654) + a1514 = T(0.157178665799771163367058998273128921867183754126709419409654) - a1600 = T(parse(BigFloat,"0.181781300700095283888472062582262379650443831463199521664945")) + a1600 = T(0.181781300700095283888472062582262379650443831463199521664945) a1601 = T(27//40) - a1602 = T(parse(BigFloat,"0.342758159847189839942220553413850871742338734703958919937260")) - a1604 = T(parse(BigFloat,"0.259111214548322744512977076191767379267783684543182428778156")) - a1605 = T(parse(BigFloat,"-0.358278966717952089048961276721979397739750634673268802484271")) - a1606 = T(parse(BigFloat,"-1.04594895940883306095050068756409905131588123172378489286080")) - a1607 = T(parse(BigFloat,"0.930327845415626983292300564432428777137601651182965794680397")) - a1608 = T(parse(BigFloat,"1.77950959431708102446142106794824453926275743243327790536000")) + a1602 = T(0.342758159847189839942220553413850871742338734703958919937260) + a1604 = T(0.259111214548322744512977076191767379267783684543182428778156) + a1605 = T(-0.358278966717952089048961276721979397739750634673268802484271) + a1606 = T(-1.04594895940883306095050068756409905131588123172378489286080) + a1607 = T(0.930327845415626983292300564432428777137601651182965794680397) + a1608 = T(1.77950959431708102446142106794824453926275743243327790536000) a1609 = T(1//10) - a1610 = T(parse(BigFloat,"-0.282547569539044081612477785222287276408489375976211189952877")) - a1611 = T(parse(BigFloat,"-0.159327350119972549169261984373485859278031542127551931461821")) - a1612 = T(parse(BigFloat,"-0.145515894647001510860991961081084111308650130578626404945571")) - a1613 = T(parse(BigFloat,"-0.259111214548322744512977076191767379267783684543182428778156")) - a1614 = T(parse(BigFloat,"-0.342758159847189839942220553413850871742338734703958919937260")) + a1610 = T(-0.282547569539044081612477785222287276408489375976211189952877) + a1611 = T(-0.159327350119972549169261984373485859278031542127551931461821) + a1612 = T(-0.145515894647001510860991961081084111308650130578626404945571) + a1613 = T(-0.259111214548322744512977076191767379267783684543182428778156) + a1614 = T(-0.342758159847189839942220553413850871742338734703958919937260) a1615 = T(-27//40) b1 = T(1//30) @@ -382,10 +382,10 @@ function Feagin10ConstantCache(T::Type,T2::Type) b6 = T(0) b7 = T(1//25) b8 = T(0) - b9 = T(parse(BigFloat,"0.189237478148923490158306404106012326238162346948625830327194")) - b10 = T(parse(BigFloat,"0.277429188517743176508360262560654340428504319718040836339472")) - b11 = T(parse(BigFloat,"0.277429188517743176508360262560654340428504319718040836339472")) - b12 = T(parse(BigFloat,"0.189237478148923490158306404106012326238162346948625830327194")) + b9 = T(0.189237478148923490158306404106012326238162346948625830327194) + b10 = T(0.277429188517743176508360262560654340428504319718040836339472) + b11 = T(0.277429188517743176508360262560654340428504319718040836339472) + b12 = T(0.189237478148923490158306404106012326238162346948625830327194) b13 = T(-1//25) b14 = T(-1//20) b15 = T(-1//30) @@ -393,19 +393,19 @@ function Feagin10ConstantCache(T::Type,T2::Type) b17 = T(1//30) c1 = T2(1//10) - c2 = T2(parse(BigFloat,"0.539357840802981787532485197881302436857273449701009015505500")) - c3 = T2(parse(BigFloat,"0.809036761204472681298727796821953655285910174551513523258250")) - c4 = T2(parse(BigFloat,"0.309036761204472681298727796821953655285910174551513523258250")) - c5 = T2(parse(BigFloat,"0.981074190219795268254879548310562080489056746118724882027805")) + c2 = T2(0.539357840802981787532485197881302436857273449701009015505500) + c3 = T2(0.809036761204472681298727796821953655285910174551513523258250) + c4 = T2(0.309036761204472681298727796821953655285910174551513523258250) + c5 = T2(0.981074190219795268254879548310562080489056746118724882027805) c6 = T2(5//6) - c7 = T2(parse(BigFloat,"0.354017365856802376329264185948796742115824053807373968324184")) - c8 = T2(parse(BigFloat,"0.882527661964732346425501486979669075182867844268052119663791")) - c9 = T2(parse(BigFloat,"0.642615758240322548157075497020439535959501736363212695909875")) - c10 = T2(parse(BigFloat,"0.357384241759677451842924502979560464040498263636787304090125")) - c11 = T2(parse(BigFloat,"0.117472338035267653574498513020330924817132155731947880336209")) + c7 = T2(0.354017365856802376329264185948796742115824053807373968324184) + c8 = T2(0.882527661964732346425501486979669075182867844268052119663791) + c9 = T2(0.642615758240322548157075497020439535959501736363212695909875) + c10 = T2(0.357384241759677451842924502979560464040498263636787304090125) + c11 = T2(0.117472338035267653574498513020330924817132155731947880336209) c12 = T2(5//6) - c13 = T2(parse(BigFloat,"0.309036761204472681298727796821953655285910174551513523258250")) - c14 = T2(parse(BigFloat,"0.539357840802981787532485197881302436857273449701009015505500")) + c13 = T2(0.309036761204472681298727796821953655285910174551513523258250) + c14 = T2(0.539357840802981787532485197881302436857273449701009015505500) c15 = T2(1//10) c16 = T2(1) Feagin10ConstantCache(adaptiveConst,a0100,a0200,a0201,a0300,a0302,a0400,a0402,a0403,a0500,a0503,a0504,a0600,a0603,a0604,a0605,a0700,a0704,a0705,a0706,a0800,a0805,a0806,a0807,a0900,a0905,a0906,a0907,a0908,a1000,a1005,a1006,a1007,a1008,a1009,a1100,a1105,a1106,a1107,a1108,a1109,a1110,a1200,a1203,a1204,a1205,a1206,a1207,a1208,a1209,a1210,a1211,a1300,a1302,a1303,a1305,a1306,a1307,a1308,a1309,a1310,a1311,a1312,a1400,a1401,a1404,a1406,a1412,a1413,a1500,a1502,a1514,a1600,a1601,a1602,a1604,a1605,a1606,a1607,a1608,a1609,a1610,a1611,a1612,a1613,a1614,a1615,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16) @@ -638,7 +638,7 @@ end constructFeagin12 """ -Base.@pure function Feagin12ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function Feagin12ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} adaptiveConst = T(49//640) c1 = T2(1//5) c2 = T2(5//9) @@ -899,21 +899,21 @@ function Feagin12ConstantCache(T::Type,T2::Type) c3 = T2(5//6) c4 = T2(1//3) c5 = T2(1) - c6 = T2(parse(BigFloat,"0.671835709170513812712245661002797570438953420568682550710222")) - c7 = T2(parse(BigFloat,"0.288724941110620201935458488967024976908118598341806976469674")) + c6 = T2(0.671835709170513812712245661002797570438953420568682550710222) + c7 = T2(0.288724941110620201935458488967024976908118598341806976469674) c8 = T2(9//16) c9 = T2(5//6) - c10 = T2(parse(BigFloat,"0.947695431179199287562380162101836721649589325892740646458322")) - c11 = T2(parse(BigFloat,"0.0548112876863802643887753674810754475842153612931128785028369")) - c12 = T2(parse(BigFloat,"0.0848880518607165350639838930162674302064148175640019542045934")) - c13 = T2(parse(BigFloat,"0.265575603264642893098114059045616835297201264164077621448665")) + c10 = T2(0.947695431179199287562380162101836721649589325892740646458322) + c11 = T2(0.0548112876863802643887753674810754475842153612931128785028369) + c12 = T2(0.0848880518607165350639838930162674302064148175640019542045934) + c13 = T2(0.265575603264642893098114059045616835297201264164077621448665) c14 = T2(1//2) - c15 = T2(parse(BigFloat,"0.734424396735357106901885940954383164702798735835922378551335")) - c16 = T2(parse(BigFloat,"0.915111948139283464936016106983732569793585182435998045795407")) - c17 = T2(parse(BigFloat,"0.947695431179199287562380162101836721649589325892740646458322")) + c15 = T2(0.734424396735357106901885940954383164702798735835922378551335) + c16 = T2(0.915111948139283464936016106983732569793585182435998045795407) + c17 = T2(0.947695431179199287562380162101836721649589325892740646458322) c18 = T2(5//6) - c19 = T2(parse(BigFloat,"0.288724941110620201935458488967024976908118598341806976469674")) - c20 = T2(parse(BigFloat,"0.671835709170513812712245661002797570438953420568682550710222")) + c19 = T2(0.288724941110620201935458488967024976908118598341806976469674) + c20 = T2(0.671835709170513812712245661002797570438953420568682550710222) c21 = T2(1//3) c22 = T2(5//9) c23 = T2(1//5) @@ -931,12 +931,12 @@ function Feagin12ConstantCache(T::Type,T2::Type) b10 = T(1//10) b11 = T(1//14) b12 = T(0) - b13 = T(parse(BigFloat,"0.138413023680782974005350203145033146748813640089941234591267")) - b14 = T(parse(BigFloat,"0.215872690604931311708935511140681138965472074195773051123019")) - b15 = T(parse(BigFloat,"0.243809523809523809523809523809523809523809523809523809523810")) - b16 = T(parse(BigFloat,"0.215872690604931311708935511140681138965472074195773051123019")) - b17 = T(parse(BigFloat,"0.138413023680782974005350203145033146748813640089941234591267")) - b18 = T(parse(BigFloat,"-0.0714285714285714285714285714285714285714285714285714285714286")) + b13 = T(0.138413023680782974005350203145033146748813640089941234591267) + b14 = T(0.215872690604931311708935511140681138965472074195773051123019) + b15 = T(0.243809523809523809523809523809523809523809523809523809523810) + b16 = T(0.215872690604931311708935511140681138965472074195773051123019) + b17 = T(0.138413023680782974005350203145033146748813640089941234591267) + b18 = T(-0.0714285714285714285714285714285714285714285714285714285714286) b19 = T(-1//10) b20 = T(-1//20) b21 = T(-1//20) @@ -947,8 +947,8 @@ function Feagin12ConstantCache(T::Type,T2::Type) a0100 = T(1//5) - a0200 = T(parse(BigFloat,"-0.216049382716049382716049382716049382716049382716049382716049")) - a0201 = T(parse(BigFloat,"0.771604938271604938271604938271604938271604938271604938271605")) + a0200 = T(-0.216049382716049382716049382716049382716049382716049382716049) + a0201 = T(0.771604938271604938271604938271604938271604938271604938271605) a0300 = T(5//24) a0302 = T(5//8) @@ -961,180 +961,180 @@ function Feagin12ConstantCache(T::Type,T2::Type) a0503 = T(2//5) a0504 = T(1//2) - a0600 = T(parse(BigFloat,"0.103364471650010477570395435690481791543342708330349879244197")) - a0603 = T(parse(BigFloat,"0.124053094528946761061581889237115328211074784955180298044074")) - a0604 = T(parse(BigFloat,"0.483171167561032899288836480451962508724109257517289177302380")) - a0605 = T(parse(BigFloat,"-0.0387530245694763252085681443767620580395733302341368038804290")) - - a0700 = T(parse(BigFloat,"0.124038261431833324081904585980175168140024670698633612292480")) - a0704 = T(parse(BigFloat,"0.217050632197958486317846256953159942875916353757734167684657")) - a0705 = T(parse(BigFloat,"0.0137455792075966759812907801835048190594443990939408530842918")) - a0706 = T(parse(BigFloat,"-0.0661095317267682844455831341498149531672668252085016565917546")) - - a0800 = T(parse(BigFloat,"0.0914774894856882983144991846980432197088832099976660100090486")) - a0805 = T(parse(BigFloat,"-0.00544348523717469689965754944144838611346156873847009178068318")) - a0806 = T(parse(BigFloat,"0.0680716801688453518578515120895103863112751730758794372203952")) - a0807 = T(parse(BigFloat,"0.408394315582641046727306852653894780093303185664924644551239")) - - a0900 = T(parse(BigFloat,"0.0890013652502551018954509355423841780143232697403434118692699")) - a0905 = T(parse(BigFloat,"0.00499528226645532360197793408420692800405891149406814091955810")) - a0906 = T(parse(BigFloat,"0.397918238819828997341739603001347156083435060931424970826304")) - a0907 = T(parse(BigFloat,"0.427930210752576611068192608300897981558240730580396406312359")) - a0908 = T(parse(BigFloat,"-0.0865117637557827005740277475955029103267246394128995965941585")) - - a1000 = T(parse(BigFloat,"0.0695087624134907543112693906409809822706021061685544615255758")) - a1005 = T(parse(BigFloat,"0.129146941900176461970759579482746551122871751501482634045487")) - a1006 = T(parse(BigFloat,"1.53073638102311295076342566143214939031177504112433874313011")) - a1007 = T(parse(BigFloat,"0.577874761129140052546751349454576715334892100418571882718036")) - a1008 = T(parse(BigFloat,"-0.951294772321088980532340837388859453930924498799228648050949")) - a1009 = T(parse(BigFloat,"-0.408276642965631951497484981519757463459627174520978426909934")) - - a1100 = T(parse(BigFloat,"0.0444861403295135866269453507092463581620165501018684152933313")) - a1105 = T(parse(BigFloat,"-0.00380476867056961731984232686574547203016331563626856065717964")) - a1106 = T(parse(BigFloat,"0.0106955064029624200721262602809059154469206077644957399593972")) - a1107 = T(parse(BigFloat,"0.0209616244499904333296674205928919920806734650660039898074652")) - a1108 = T(parse(BigFloat,"-0.0233146023259321786648561431551978077665337818756053603898847")) - a1109 = T(parse(BigFloat,"0.00263265981064536974369934736325334761174975280887405725010964")) - a1110 = T(parse(BigFloat,"0.00315472768977025060103545855572111407955208306374459723959783")) - - a1200 = T(parse(BigFloat,"0.0194588815119755475588801096525317761242073762016273186231215")) - a1208 = T(parse(BigFloat,"0.0000678512949171812509306121653452367476194364781259165332321534")) - a1209 = T(parse(BigFloat,"-0.0000429795859049273623271005330230162343568863387724883603675550")) - a1210 = T(parse(BigFloat,"0.0000176358982260285155407485928953302139937553442829975734148981")) - a1211 = T(parse(BigFloat,"0.0653866627415027051009595231385181033549511358787382098351924")) - - a1300 = T(parse(BigFloat,"0.206836835664277105916828174798272361078909196043446411598231")) - a1308 = T(parse(BigFloat,"0.0166796067104156472828045866664696450306326505094792505215514")) - a1309 = T(parse(BigFloat,"-0.00879501563200710214457024178249986591130234990219959208704979")) - a1310 = T(parse(BigFloat,"0.00346675455362463910824462315246379209427513654098596403637231")) - a1311 = T(parse(BigFloat,"-0.861264460105717678161432562258351242030270498966891201799225")) - a1312 = T(parse(BigFloat,"0.908651882074050281096239478469262145034957129939256789178785")) - - a1400 = T(parse(BigFloat,"0.0203926084654484010091511314676925686038504449562413004562382")) - a1408 = T(parse(BigFloat,"0.0869469392016685948675400555583947505833954460930940959577347")) - a1409 = T(parse(BigFloat,"-0.0191649630410149842286436611791405053287170076602337673587681")) - a1410 = T(parse(BigFloat,"0.00655629159493663287364871573244244516034828755253746024098838")) - a1411 = T(parse(BigFloat,"0.0987476128127434780903798528674033899738924968006632201445462")) - a1412 = T(parse(BigFloat,"0.00535364695524996055083260173615567408717110247274021056118319")) - a1413 = T(parse(BigFloat,"0.301167864010967916837091303817051676920059229784957479998077")) - - a1500 = T(parse(BigFloat,"0.228410433917778099547115412893004398779136994596948545722283")) - a1508 = T(parse(BigFloat,"-0.498707400793025250635016567442511512138603770959682292383042")) - a1509 = T(parse(BigFloat,"0.134841168335724478552596703792570104791700727205981058201689")) - a1510 = T(parse(BigFloat,"-0.0387458244055834158439904226924029230935161059142806805674360")) - a1511 = T(parse(BigFloat,"-1.27473257473474844240388430824908952380979292713250350199641")) - a1512 = T(parse(BigFloat,"1.43916364462877165201184452437038081875299303577911839630524")) - a1513 = T(parse(BigFloat,"-0.214007467967990254219503540827349569639028092344812795499026")) - a1514 = T(parse(BigFloat,"0.958202417754430239892724139109781371059908874605153648768037")) - - a1600 = T(parse(BigFloat,"2.00222477655974203614249646012506747121440306225711721209798")) - a1608 = T(parse(BigFloat,"2.06701809961524912091954656438138595825411859673341600679555")) - a1609 = T(parse(BigFloat,"0.623978136086139541957471279831494466155292316167021080663140")) - a1610 = T(parse(BigFloat,"-0.0462283685500311430283203554129062069391947101880112723185773")) - a1611 = T(parse(BigFloat,"-8.84973288362649614860075246727118949286604835457092701094630")) - a1612 = T(parse(BigFloat,"7.74257707850855976227437225791835589560188590785037197433615")) - a1613 = T(parse(BigFloat,"-0.588358519250869210993353314127711745644125882130941202896436")) - a1614 = T(parse(BigFloat,"-1.10683733362380649395704708016953056176195769617014899442903")) - a1615 = T(parse(BigFloat,"-0.929529037579203999778397238291233214220788057511899747507074")) - - a1700 = T(parse(BigFloat,"3.13789533412073442934451608989888796808161259330322100268310")) - a1705 = T(parse(BigFloat,"0.129146941900176461970759579482746551122871751501482634045487")) - a1706 = T(parse(BigFloat,"1.53073638102311295076342566143214939031177504112433874313011")) - a1707 = T(parse(BigFloat,"0.577874761129140052546751349454576715334892100418571882718036")) - a1708 = T(parse(BigFloat,"5.42088263055126683050056840891857421941300558851862156403363")) - a1709 = T(parse(BigFloat,"0.231546926034829304872663800877643660904880180835945693836936")) - a1710 = T(parse(BigFloat,"0.0759292995578913560162301311785251873561801342333194895292058")) - a1711 = T(parse(BigFloat,"-12.3729973380186513287414553402595806591349822617535905976253")) - a1712 = T(parse(BigFloat,"9.85455883464769543935957209317369202080367765721777101906955")) - a1713 = T(parse(BigFloat,"0.0859111431370436529579357709052367772889980495122329601159540")) - a1714 = T(parse(BigFloat,"-5.65242752862643921117182090081762761180392602644189218673969")) - a1715 = T(parse(BigFloat,"-1.94300935242819610883833776782364287728724899124166920477873")) - a1716 = T(parse(BigFloat,"-0.128352601849404542018428714319344620742146491335612353559923")) - - a1800 = T(parse(BigFloat,"1.38360054432196014878538118298167716825163268489922519995564")) - a1805 = T(parse(BigFloat,"0.00499528226645532360197793408420692800405891149406814091955810")) - a1806 = T(parse(BigFloat,"0.397918238819828997341739603001347156083435060931424970826304")) - a1807 = T(parse(BigFloat,"0.427930210752576611068192608300897981558240730580396406312359")) - a1808 = T(parse(BigFloat,"-1.30299107424475770916551439123047573342071475998399645982146")) - a1809 = T(parse(BigFloat,"0.661292278669377029097112528107513072734573412294008071500699")) - a1810 = T(parse(BigFloat,"-0.144559774306954349765969393688703463900585822441545655530145")) - a1811 = T(parse(BigFloat,"-6.96576034731798203467853867461083919356792248105919255460819")) - a1812 = T(parse(BigFloat,"6.65808543235991748353408295542210450632193197576935120716437")) - a1813 = T(parse(BigFloat,"-1.66997375108841486404695805725510845049807969199236227575796")) - a1814 = T(parse(BigFloat,"2.06413702318035263832289040301832647130604651223986452170089")) - a1815 = T(parse(BigFloat,"-0.674743962644306471862958129570837723192079875998405058648892")) - a1816 = T(parse(BigFloat,"-0.00115618834794939500490703608435907610059605754935305582045729")) - a1817 = T(parse(BigFloat,"-0.00544057908677007389319819914241631024660726585015012485938593")) - - a1900 = T(parse(BigFloat,"0.951236297048287669474637975894973552166903378983475425758226")) - a1904 = T(parse(BigFloat,"0.217050632197958486317846256953159942875916353757734167684657")) - a1905 = T(parse(BigFloat,"0.0137455792075966759812907801835048190594443990939408530842918")) - a1906 = T(parse(BigFloat,"-0.0661095317267682844455831341498149531672668252085016565917546")) - a1908 = T(parse(BigFloat,"0.152281696736414447136604697040747131921486432699422112099617")) - a1909 = T(parse(BigFloat,"-0.337741018357599840802300793133998004354643424457539667670080")) - a1910 = T(parse(BigFloat,"-0.0192825981633995781534949199286824400469353110630787982121133")) - a1911 = T(parse(BigFloat,"-3.68259269696866809932409015535499603576312120746888880201882")) - a1912 = T(parse(BigFloat,"3.16197870406982063541533528419683854018352080342887002331312")) - a1913 = T(parse(BigFloat,"-0.370462522106885290716991856022051125477943482284080569177386")) - a1914 = T(parse(BigFloat,"-0.0514974200365440434996434456698127984941168616474316871020314")) - a1915 = T(parse(BigFloat,"-0.000829625532120152946787043541792848416659382675202720677536554")) - a1916 = T(parse(BigFloat,"0.00000279801041419278598986586589070027583961355402640879503213503")) - a1917 = T(parse(BigFloat,"0.0418603916412360287969841020776788461794119440689356178942252")) - a1918 = T(parse(BigFloat,"0.279084255090877355915660874555379649966282167560126269290222")) - - a2000 = T(parse(BigFloat,"0.103364471650010477570395435690481791543342708330349879244197")) - a2003 = T(parse(BigFloat,"0.124053094528946761061581889237115328211074784955180298044074")) - a2004 = T(parse(BigFloat,"0.483171167561032899288836480451962508724109257517289177302380")) - a2005 = T(parse(BigFloat,"-0.0387530245694763252085681443767620580395733302341368038804290")) - a2007 = T(parse(BigFloat,"-0.438313820361122420391059788940960176420682836652600698580091")) - a2009 = T(parse(BigFloat,"-0.218636633721676647685111485017151199362509373698288330593486")) - a2010 = T(parse(BigFloat,"-0.0312334764394719229981634995206440349766174759626578122323015")) - a2017 = T(parse(BigFloat,"0.0312334764394719229981634995206440349766174759626578122323015")) - a2018 = T(parse(BigFloat,"0.218636633721676647685111485017151199362509373698288330593486")) - a2019 = T(parse(BigFloat,"0.438313820361122420391059788940960176420682836652600698580091")) + a0600 = T(0.103364471650010477570395435690481791543342708330349879244197) + a0603 = T(0.124053094528946761061581889237115328211074784955180298044074) + a0604 = T(0.483171167561032899288836480451962508724109257517289177302380) + a0605 = T(-0.0387530245694763252085681443767620580395733302341368038804290) + + a0700 = T(0.124038261431833324081904585980175168140024670698633612292480) + a0704 = T(0.217050632197958486317846256953159942875916353757734167684657) + a0705 = T(0.0137455792075966759812907801835048190594443990939408530842918) + a0706 = T(-0.0661095317267682844455831341498149531672668252085016565917546) + + a0800 = T(0.0914774894856882983144991846980432197088832099976660100090486) + a0805 = T(-0.00544348523717469689965754944144838611346156873847009178068318) + a0806 = T(0.0680716801688453518578515120895103863112751730758794372203952) + a0807 = T(0.408394315582641046727306852653894780093303185664924644551239) + + a0900 = T(0.0890013652502551018954509355423841780143232697403434118692699) + a0905 = T(0.00499528226645532360197793408420692800405891149406814091955810) + a0906 = T(0.397918238819828997341739603001347156083435060931424970826304) + a0907 = T(0.427930210752576611068192608300897981558240730580396406312359) + a0908 = T(-0.0865117637557827005740277475955029103267246394128995965941585) + + a1000 = T(0.0695087624134907543112693906409809822706021061685544615255758) + a1005 = T(0.129146941900176461970759579482746551122871751501482634045487) + a1006 = T(1.53073638102311295076342566143214939031177504112433874313011) + a1007 = T(0.577874761129140052546751349454576715334892100418571882718036) + a1008 = T(-0.951294772321088980532340837388859453930924498799228648050949) + a1009 = T(-0.408276642965631951497484981519757463459627174520978426909934) + + a1100 = T(0.0444861403295135866269453507092463581620165501018684152933313) + a1105 = T(-0.00380476867056961731984232686574547203016331563626856065717964) + a1106 = T(0.0106955064029624200721262602809059154469206077644957399593972) + a1107 = T(0.0209616244499904333296674205928919920806734650660039898074652) + a1108 = T(-0.0233146023259321786648561431551978077665337818756053603898847) + a1109 = T(0.00263265981064536974369934736325334761174975280887405725010964) + a1110 = T(0.00315472768977025060103545855572111407955208306374459723959783) + + a1200 = T(0.0194588815119755475588801096525317761242073762016273186231215) + a1208 = T(0.0000678512949171812509306121653452367476194364781259165332321534) + a1209 = T(-0.0000429795859049273623271005330230162343568863387724883603675550) + a1210 = T(0.0000176358982260285155407485928953302139937553442829975734148981) + a1211 = T(0.0653866627415027051009595231385181033549511358787382098351924) + + a1300 = T(0.206836835664277105916828174798272361078909196043446411598231) + a1308 = T(0.0166796067104156472828045866664696450306326505094792505215514) + a1309 = T(-0.00879501563200710214457024178249986591130234990219959208704979) + a1310 = T(0.00346675455362463910824462315246379209427513654098596403637231) + a1311 = T(-0.861264460105717678161432562258351242030270498966891201799225) + a1312 = T(0.908651882074050281096239478469262145034957129939256789178785) + + a1400 = T(0.0203926084654484010091511314676925686038504449562413004562382) + a1408 = T(0.0869469392016685948675400555583947505833954460930940959577347) + a1409 = T(-0.0191649630410149842286436611791405053287170076602337673587681) + a1410 = T(0.00655629159493663287364871573244244516034828755253746024098838) + a1411 = T(0.0987476128127434780903798528674033899738924968006632201445462) + a1412 = T(0.00535364695524996055083260173615567408717110247274021056118319) + a1413 = T(0.301167864010967916837091303817051676920059229784957479998077) + + a1500 = T(0.228410433917778099547115412893004398779136994596948545722283) + a1508 = T(-0.498707400793025250635016567442511512138603770959682292383042) + a1509 = T(0.134841168335724478552596703792570104791700727205981058201689) + a1510 = T(-0.0387458244055834158439904226924029230935161059142806805674360) + a1511 = T(-1.27473257473474844240388430824908952380979292713250350199641) + a1512 = T(1.43916364462877165201184452437038081875299303577911839630524) + a1513 = T(-0.214007467967990254219503540827349569639028092344812795499026) + a1514 = T(0.958202417754430239892724139109781371059908874605153648768037) + + a1600 = T(2.00222477655974203614249646012506747121440306225711721209798) + a1608 = T(2.06701809961524912091954656438138595825411859673341600679555) + a1609 = T(0.623978136086139541957471279831494466155292316167021080663140) + a1610 = T(-0.0462283685500311430283203554129062069391947101880112723185773) + a1611 = T(-8.84973288362649614860075246727118949286604835457092701094630) + a1612 = T(7.74257707850855976227437225791835589560188590785037197433615) + a1613 = T(-0.588358519250869210993353314127711745644125882130941202896436) + a1614 = T(-1.10683733362380649395704708016953056176195769617014899442903) + a1615 = T(-0.929529037579203999778397238291233214220788057511899747507074) + + a1700 = T(3.13789533412073442934451608989888796808161259330322100268310) + a1705 = T(0.129146941900176461970759579482746551122871751501482634045487) + a1706 = T(1.53073638102311295076342566143214939031177504112433874313011) + a1707 = T(0.577874761129140052546751349454576715334892100418571882718036) + a1708 = T(5.42088263055126683050056840891857421941300558851862156403363) + a1709 = T(0.231546926034829304872663800877643660904880180835945693836936) + a1710 = T(0.0759292995578913560162301311785251873561801342333194895292058) + a1711 = T(-12.3729973380186513287414553402595806591349822617535905976253) + a1712 = T(9.85455883464769543935957209317369202080367765721777101906955) + a1713 = T(0.0859111431370436529579357709052367772889980495122329601159540) + a1714 = T(-5.65242752862643921117182090081762761180392602644189218673969) + a1715 = T(-1.94300935242819610883833776782364287728724899124166920477873) + a1716 = T(-0.128352601849404542018428714319344620742146491335612353559923) + + a1800 = T(1.38360054432196014878538118298167716825163268489922519995564) + a1805 = T(0.00499528226645532360197793408420692800405891149406814091955810) + a1806 = T(0.397918238819828997341739603001347156083435060931424970826304) + a1807 = T(0.427930210752576611068192608300897981558240730580396406312359) + a1808 = T(-1.30299107424475770916551439123047573342071475998399645982146) + a1809 = T(0.661292278669377029097112528107513072734573412294008071500699) + a1810 = T(-0.144559774306954349765969393688703463900585822441545655530145) + a1811 = T(-6.96576034731798203467853867461083919356792248105919255460819) + a1812 = T(6.65808543235991748353408295542210450632193197576935120716437) + a1813 = T(-1.66997375108841486404695805725510845049807969199236227575796) + a1814 = T(2.06413702318035263832289040301832647130604651223986452170089) + a1815 = T(-0.674743962644306471862958129570837723192079875998405058648892) + a1816 = T(-0.00115618834794939500490703608435907610059605754935305582045729) + a1817 = T(-0.00544057908677007389319819914241631024660726585015012485938593) + + a1900 = T(0.951236297048287669474637975894973552166903378983475425758226) + a1904 = T(0.217050632197958486317846256953159942875916353757734167684657) + a1905 = T(0.0137455792075966759812907801835048190594443990939408530842918) + a1906 = T(-0.0661095317267682844455831341498149531672668252085016565917546) + a1908 = T(0.152281696736414447136604697040747131921486432699422112099617) + a1909 = T(-0.337741018357599840802300793133998004354643424457539667670080) + a1910 = T(-0.0192825981633995781534949199286824400469353110630787982121133) + a1911 = T(-3.68259269696866809932409015535499603576312120746888880201882) + a1912 = T(3.16197870406982063541533528419683854018352080342887002331312) + a1913 = T(-0.370462522106885290716991856022051125477943482284080569177386) + a1914 = T(-0.0514974200365440434996434456698127984941168616474316871020314) + a1915 = T(-0.000829625532120152946787043541792848416659382675202720677536554) + a1916 = T(0.00000279801041419278598986586589070027583961355402640879503213503) + a1917 = T(0.0418603916412360287969841020776788461794119440689356178942252) + a1918 = T(0.279084255090877355915660874555379649966282167560126269290222) + + a2000 = T(0.103364471650010477570395435690481791543342708330349879244197) + a2003 = T(0.124053094528946761061581889237115328211074784955180298044074) + a2004 = T(0.483171167561032899288836480451962508724109257517289177302380) + a2005 = T(-0.0387530245694763252085681443767620580395733302341368038804290) + a2007 = T(-0.438313820361122420391059788940960176420682836652600698580091) + a2009 = T(-0.218636633721676647685111485017151199362509373698288330593486) + a2010 = T(-0.0312334764394719229981634995206440349766174759626578122323015) + a2017 = T(0.0312334764394719229981634995206440349766174759626578122323015) + a2018 = T(0.218636633721676647685111485017151199362509373698288330593486) + a2019 = T(0.438313820361122420391059788940960176420682836652600698580091) a2100 = T(29//150) a2102 = T(11//50) a2103 = T(-2//25) - a2106 = T(parse(BigFloat,"0.0984256130499315928152900286856048243348202521491288575952143")) - a2107 = T(parse(BigFloat,"-0.196410889223054653446526504390100417677539095340135532418849")) - a2109 = T(parse(BigFloat,"0.436457930493068729391826122587949137609670676712525034763317")) - a2110 = T(parse(BigFloat,"0.0652613721675721098560370939805555698350543810708414716730270")) - a2117 = T(parse(BigFloat,"-0.0652613721675721098560370939805555698350543810708414716730270")) - a2118 = T(parse(BigFloat,"-0.436457930493068729391826122587949137609670676712525034763317")) - a2119 = T(parse(BigFloat,"0.196410889223054653446526504390100417677539095340135532418849")) - a2120 = T(parse(BigFloat,"-0.0984256130499315928152900286856048243348202521491288575952143")) - - a2200 = T(parse(BigFloat,"-0.216049382716049382716049382716049382716049382716049382716049")) - a2201 = T(parse(BigFloat,"0.771604938271604938271604938271604938271604938271604938271605")) + a2106 = T(0.0984256130499315928152900286856048243348202521491288575952143) + a2107 = T(-0.196410889223054653446526504390100417677539095340135532418849) + a2109 = T(0.436457930493068729391826122587949137609670676712525034763317) + a2110 = T(0.0652613721675721098560370939805555698350543810708414716730270) + a2117 = T(-0.0652613721675721098560370939805555698350543810708414716730270) + a2118 = T(-0.436457930493068729391826122587949137609670676712525034763317) + a2119 = T(0.196410889223054653446526504390100417677539095340135532418849) + a2120 = T(-0.0984256130499315928152900286856048243348202521491288575952143) + + a2200 = T(-0.216049382716049382716049382716049382716049382716049382716049) + a2201 = T(0.771604938271604938271604938271604938271604938271604938271605) a2204 = T(-2//3) - a2206 = T(parse(BigFloat,"-0.390696469295978451446999802258495981249099665294395945559163")) - a2220 = T(parse(BigFloat,"0.390696469295978451446999802258495981249099665294395945559163")) + a2206 = T(-0.390696469295978451446999802258495981249099665294395945559163) + a2220 = T(0.390696469295978451446999802258495981249099665294395945559163) a2221 = T(2//3) a2300 = T(1//5) - a2302 = T(parse(BigFloat,"-0.164609053497942386831275720164609053497942386831275720164609")) - a2322 = T(parse(BigFloat,"0.164609053497942386831275720164609053497942386831275720164609")) + a2302 = T(-0.164609053497942386831275720164609053497942386831275720164609) + a2322 = T(0.164609053497942386831275720164609053497942386831275720164609) - a2400 = T(parse(BigFloat,"1.47178724881110408452949550989023611293535315518571691939396")) + a2400 = T(1.47178724881110408452949550989023611293535315518571691939396) a2401 = T(63//80) a2402 = T(91//216) a2404 = T(7//24) - a2406 = T(parse(BigFloat,"0.348600717628329563206854421629657569274689947367847465753757")) - a2407 = T(parse(BigFloat,"0.229499544768994849582890233710555447073823569666506700662510")) - a2408 = T(parse(BigFloat,"5.79046485790481979159831978177003471098279506036722411333192")) - a2409 = T(parse(BigFloat,"0.418587511856506868874073759426596207226461447604248151080016")) - a2410 = T(parse(BigFloat,"0.307039880222474002649653817490106690389251482313213999386651")) - a2411 = T(parse(BigFloat,"-4.68700905350603332214256344683853248065574415794742040470287")) - a2412 = T(parse(BigFloat,"3.13571665593802262152038152399873856554395436199962915429076")) - a2413 = T(parse(BigFloat,"1.40134829710965720817510506275620441055845017313930508348898")) - a2414 = T(parse(BigFloat,"-5.52931101439499023629010306005764336421276055777658156400910")) - a2415 = T(parse(BigFloat,"-0.853138235508063349309546894974784906188927508039552519557498")) - a2416 = T(parse(BigFloat,"0.103575780373610140411804607167772795518293914458500175573749")) - a2417 = T(parse(BigFloat,"-0.140474416950600941142546901202132534870665923700034957196546")) - a2418 = T(parse(BigFloat,"-0.418587511856506868874073759426596207226461447604248151080016")) - a2419 = T(parse(BigFloat,"-0.229499544768994849582890233710555447073823569666506700662510")) - a2420 = T(parse(BigFloat,"-0.348600717628329563206854421629657569274689947367847465753757")) + a2406 = T(0.348600717628329563206854421629657569274689947367847465753757) + a2407 = T(0.229499544768994849582890233710555447073823569666506700662510) + a2408 = T(5.79046485790481979159831978177003471098279506036722411333192) + a2409 = T(0.418587511856506868874073759426596207226461447604248151080016) + a2410 = T(0.307039880222474002649653817490106690389251482313213999386651) + a2411 = T(-4.68700905350603332214256344683853248065574415794742040470287) + a2412 = T(3.13571665593802262152038152399873856554395436199962915429076) + a2413 = T(1.40134829710965720817510506275620441055845017313930508348898) + a2414 = T(-5.52931101439499023629010306005764336421276055777658156400910) + a2415 = T(-0.853138235508063349309546894974784906188927508039552519557498) + a2416 = T(0.103575780373610140411804607167772795518293914458500175573749) + a2417 = T(-0.140474416950600941142546901202132534870665923700034957196546) + a2418 = T(-0.418587511856506868874073759426596207226461447604248151080016) + a2419 = T(-0.229499544768994849582890233710555447073823569666506700662510) + a2420 = T(-0.348600717628329563206854421629657569274689947367847465753757) a2421 = T(-7//24) a2422 = T(-91//216) a2423 = T(-63//80) @@ -1543,7 +1543,7 @@ end constructFeagin14 """ -Base.@pure function Feagin14ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function Feagin14ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} adaptiveConst = T(1//1000) c1 = T2(1//9) c2 = T2(5//9) @@ -1989,31 +1989,31 @@ function Feagin14ConstantCache(T::Type,T2::Type) c3 = T2(5//6) c4 = T2(1//3) c5 = T2(1) - c6 = T2(parse(BigFloat,"0.669986979272772921764683785505998513938845229638460353285142")) - c7 = T2(parse(BigFloat,"0.297068384213818357389584716808219413223332094698915687379168")) + c6 = T2(0.669986979272772921764683785505998513938845229638460353285142) + c7 = T2(0.297068384213818357389584716808219413223332094698915687379168) c8 = T2(8//11) - c9 = T2(parse(BigFloat,"0.140152799042188765276187487966946717629806463082532936287323")) - c10 = T2(parse(BigFloat,"0.700701039770150737151099854830749337941407049265546408969222")) + c9 = T2(0.140152799042188765276187487966946717629806463082532936287323) + c10 = T2(0.700701039770150737151099854830749337941407049265546408969222) c11 = T2(4//11) - c12 = T2(parse(BigFloat,"0.263157894736842105263157894736842105263157894736842105263158")) - c13 = T2(parse(BigFloat,"0.0392172246650270859125196642501208648863714315266128052078483")) - c14 = T2(parse(BigFloat,"0.812917502928376762983393159278036506189612372617238550774312")) + c12 = T2(0.263157894736842105263157894736842105263157894736842105263158) + c13 = T2(0.0392172246650270859125196642501208648863714315266128052078483) + c14 = T2(0.812917502928376762983393159278036506189612372617238550774312) c15 = T2(1//6) c16 = T2(9//10) - c17 = T2(parse(BigFloat,"0.0641299257451966923312771193896682809481096651615083225402924")) - c18 = T2(parse(BigFloat,"0.204149909283428848927744634301023405027149505241333751628870")) - c19 = T2(parse(BigFloat,"0.395350391048760565615671369827324372352227297456659450554577")) - c20 = T2(parse(BigFloat,"0.604649608951239434384328630172675627647772702543340549445423")) - c21 = T2(parse(BigFloat,"0.795850090716571151072255365698976594972850494758666248371130")) - c22 = T2(parse(BigFloat,"0.935870074254803307668722880610331719051890334838491677459708")) + c17 = T2(0.0641299257451966923312771193896682809481096651615083225402924) + c18 = T2(0.204149909283428848927744634301023405027149505241333751628870) + c19 = T2(0.395350391048760565615671369827324372352227297456659450554577) + c20 = T2(0.604649608951239434384328630172675627647772702543340549445423) + c21 = T2(0.795850090716571151072255365698976594972850494758666248371130) + c22 = T2(0.935870074254803307668722880610331719051890334838491677459708) c23 = T2(1//6) - c24 = T2(parse(BigFloat,"0.812917502928376762983393159278036506189612372617238550774312")) - c25 = T2(parse(BigFloat,"0.0392172246650270859125196642501208648863714315266128052078483")) + c24 = T2(0.812917502928376762983393159278036506189612372617238550774312) + c25 = T2(0.0392172246650270859125196642501208648863714315266128052078483) c26 = T2(4//11) - c27 = T2(parse(BigFloat,"0.700701039770150737151099854830749337941407049265546408969222")) - c28 = T2(parse(BigFloat,"0.140152799042188765276187487966946717629806463082532936287323")) - c29 = T2(parse(BigFloat,"0.297068384213818357389584716808219413223332094698915687379168")) - c30 = T2(parse(BigFloat,"0.669986979272772921764683785505998513938845229638460353285142")) + c27 = T2(0.700701039770150737151099854830749337941407049265546408969222) + c28 = T2(0.140152799042188765276187487966946717629806463082532936287323) + c29 = T2(0.297068384213818357389584716808219413223332094698915687379168) + c30 = T2(0.669986979272772921764683785505998513938845229638460353285142) c31 = T2(1//3) c32 = T2(5//9) c33 = T2(1//9) @@ -2036,12 +2036,12 @@ function Feagin14ConstantCache(T::Type,T2::Type) b15 = T(15//256) b16 = T(33//512) b17 = T(0) - b18 = T(parse(BigFloat,"0.105352113571753019691496032887878162227673083080523884041670")) - b19 = T(parse(BigFloat,"0.170561346241752182382120338553874085887555487802790804737501")) - b20 = T(parse(BigFloat,"0.206229397329351940783526485701104894741914286259542454077972")) - b21 = T(parse(BigFloat,"0.206229397329351940783526485701104894741914286259542454077972")) - b22 = T(parse(BigFloat,"0.170561346241752182382120338553874085887555487802790804737501")) - b23 = T(parse(BigFloat,"0.105352113571753019691496032887878162227673083080523884041670")) + b18 = T(0.105352113571753019691496032887878162227673083080523884041670) + b19 = T(0.170561346241752182382120338553874085887555487802790804737501) + b20 = T(0.206229397329351940783526485701104894741914286259542454077972) + b21 = T(0.206229397329351940783526485701104894741914286259542454077972) + b22 = T(0.170561346241752182382120338553874085887555487802790804737501) + b23 = T(0.105352113571753019691496032887878162227673083080523884041670) b24 = T(-33//512) b25 = T(-15//256) b26 = T(-27//512) @@ -2071,346 +2071,346 @@ function Feagin14ConstantCache(T::Type,T2::Type) a0503 = T(2//5) a0504 = T(1//2) - a0600 = T(parse(BigFloat,"0.103484561636679776672993546511910344499744798201971316606663")) - a0603 = T(parse(BigFloat,"0.122068887306407222589644082868962077139592714834162134741275")) - a0604 = T(parse(BigFloat,"0.482574490331246622475134780125688112865919023850168049679402")) - a0605 = T(parse(BigFloat,"-0.0381409600015606999730886240005620205664113072478411477421970")) - - a0700 = T(parse(BigFloat,"0.124380526654094412881516420868799316268491466359671423163289")) - a0704 = T(parse(BigFloat,"0.226120282197584301422238662979202901196752320742633143965145")) - a0705 = T(parse(BigFloat,"0.0137885887618080880607695837016477814530969417491493385363543")) - a0706 = T(parse(BigFloat,"-0.0672210133996684449749399507414305856950086341525382182856200")) - a0800 = T(parse(BigFloat,"0.0936919065659673815530885456083005933866349695217750085655603")) - a0805 = T(parse(BigFloat,"-0.00613406843450510987229498995641664735620914507128858871007099")) - a0806 = T(parse(BigFloat,"0.216019825625503063708860097659866573490979433278117320188668")) - a0807 = T(parse(BigFloat,"0.423695063515761937337619073960976753205867469544123532683116")) - - - a0900 = T(parse(BigFloat,"0.0838479812409052664616968791372814085980533139224911131069335")) - a0905 = T(parse(BigFloat,"-0.0117949367100973814319755056031295775367961960590736150777613")) - a0906 = T(parse(BigFloat,"-0.247299020568812652339473838743194598325992840353340132697498")) - a0907 = T(parse(BigFloat,"0.0978080858367729012259313014081291665503740655476733940756599")) - a0908 = T(parse(BigFloat,"0.217590689243420631360008651767860318344168120024782176879989")) - - a1000 = T(parse(BigFloat,"0.0615255359769428227954562389614314714333423969064821107453940")) - a1005 = T(parse(BigFloat,"0.00592232780324503308042990005798046524738389560444257136834990")) - a1006 = T(parse(BigFloat,"0.470326159963841112217224303205894113455362530746108825010848")) - a1007 = T(parse(BigFloat,"0.299688863848679000853981837096192399136831121671781279184194")) - a1008 = T(parse(BigFloat,"-0.247656877593994914689992276329810825853958069263947095548189")) - a1009 = T(parse(BigFloat,"0.110895029771437682893999851839061714522445173600678718208625")) - - a1100 = T(parse(BigFloat,"0.0419700073362782579861792864787277787213483656543104611245994")) - a1105 = T(parse(BigFloat,"-0.00317987696266205093901912847692712407988609169703103952205634")) - a1106 = T(parse(BigFloat,"0.806397714906192077260821711520379506393543111567419750119748")) - a1107 = T(parse(BigFloat,"0.0975983126412388979093522850684288851314672048003054550357187")) - a1108 = T(parse(BigFloat,"0.778575578158398909027512446452927238999763460594181964958853")) - a1109 = T(parse(BigFloat,"0.204890423831599428189499202098105603312029235081420653574829")) - a1110 = T(parse(BigFloat,"-1.56261579627468188307070943950527825211462892236424360892806")) - - a1200 = T(parse(BigFloat,"0.0437726782233730163574465242495339811688214967071614123256973")) - a1208 = T(parse(BigFloat,"0.00624365027520195208794358628580933625281631216903095917201250")) - a1209 = T(parse(BigFloat,"0.200043097109577314994435165469647856829066232218264969608768")) - a1210 = T(parse(BigFloat,"-0.00805328367804983036823857162048902911923392887337029314844206")) - a1211 = T(parse(BigFloat,"0.0211517528067396521915711903523399601316877825157550573051221")) - - a1300 = T(parse(BigFloat,"0.0283499250363514563095023591920717312247137654896477097768495")) - a1308 = T(parse(BigFloat,"0.00249163204855817407538949148805995149459884653585417680098222")) - a1309 = T(parse(BigFloat,"0.0230138787854593149638399846373742768772087122638142234223658")) - a1310 = T(parse(BigFloat,"-0.00322155956692977098724476092467120878189463604760620461043308")) - a1311 = T(parse(BigFloat,"0.00988442549447664668946335414487885256040819982786014648129297")) - a1312 = T(parse(BigFloat,"-0.0213010771328887351384307642875927384886634565429572466632092")) - - a1400 = T(parse(BigFloat,"0.343511894290243001049432234735147943083353174980701426268122")) - a1408 = T(parse(BigFloat,"0.210451912023627385609097011999010655788807405225626700040882")) - a1409 = T(parse(BigFloat,"1.03427452057230411936482926828825709938667999698324740166559")) - a1410 = T(parse(BigFloat,"0.00600303645864422487051240448206640574939078092406156945568306")) - a1411 = T(parse(BigFloat,"0.855938125099619537578012106002407728915062652616416005816477")) - a1412 = T(parse(BigFloat,"-0.977235005036766810872264852372525633013107656892839677696022")) - a1413 = T(parse(BigFloat,"-0.660026980479294694616225013856327693720573981219974874776419")) - - a1500 = T(parse(BigFloat,"-0.0143574001672168069538206399935076366657755954378399880691949")) - a1508 = T(parse(BigFloat,"-0.0366253270049039970293685796848974791733119081733552207318285")) - a1509 = T(parse(BigFloat,"0.0350254975636213681976849406979846524346789082471103574920148")) - a1510 = T(parse(BigFloat,"0.0360946016362113508931786658758335239823689929864237671348749")) - a1511 = T(parse(BigFloat,"-0.0265219967553681106351595946834601923649627012457464284442911")) - a1512 = T(parse(BigFloat,"0.0445699011305698119638911537508839908104336323082226770910408")) - a1513 = T(parse(BigFloat,"0.124343093331358243286225595741786448038973408895106741855721")) - a1514 = T(parse(BigFloat,"0.00413829693239480694403512496204335960426192908674476033832967")) - - a1600 = T(parse(BigFloat,"0.356032404425120290975609116398089176264106222379748802654822")) - a1608 = T(parse(BigFloat,"-0.450192758947562595966821779075956175110645100214763601190349")) - a1609 = T(parse(BigFloat,"0.430527907083710898626656292808782917793030154094709462877146")) - a1610 = T(parse(BigFloat,"0.511973029011022237668556960394071692077125787030651386389972")) - a1611 = T(parse(BigFloat,"0.908303638886404260390159124638110213997496214819904630546596")) - a1612 = T(parse(BigFloat,"-1.23921093371933931757372469151534028854413889248605726186520")) - a1613 = T(parse(BigFloat,"-0.649048661671761465141672348879062553905402831967191097656668")) - a1614 = T(parse(BigFloat,"0.251708904586819292210480529948970541404887852931447491219418")) - a1615 = T(parse(BigFloat,"0.779906470345586398810756795282334476023540593411550187024263")) - - a1700 = T(parse(BigFloat,"0.0130935687406513066406881206418834980127470438213192487844956")) - a1712 = T(parse(BigFloat,"-0.0000932053067985113945908461962767108237858631509684667142124826")) - a1713 = T(parse(BigFloat,"0.0505374334262299359640090443138590726770942344716122381702746")) - a1714 = T(parse(BigFloat,"8.04470341944487979109579109610197797641311868930865361048975e-7")) - a1715 = T(parse(BigFloat,"0.000591726029494171190528755742777717259844340971924321528178248")) - a1716 = T(parse(BigFloat,"-4.01614722154557337064691684906375587732264247950093804676867e-7")) - - a1800 = T(parse(BigFloat,"0.0207926484466053012541944544000765652167255206144373407979758")) - a1812 = T(parse(BigFloat,"0.000582695918800085915101902697837284108951406103029871570103075")) - a1813 = T(parse(BigFloat,"-0.00801700732358815939083342186525852746640558465919633524655451")) - a1814 = T(parse(BigFloat,"4.03847643847136940375170821743560570484117290330895506618968e-6")) - a1815 = T(parse(BigFloat,"0.0854609998055506144225056114567535602510114622033622491802597")) - a1816 = T(parse(BigFloat,"-2.04486480935804242706707569691004307904442837552677456232848e-6")) - a1817 = T(parse(BigFloat,"0.105328578824431893399799402979093997354240904235172843146582")) - - - a1900 = T(parse(BigFloat,"1.40153449795736021415446247355771306718486452917597731683689")) - a1912 = T(parse(BigFloat,"-0.230252000984221261616272410367415621261130298274455611733277")) - a1913 = T(parse(BigFloat,"-7.21106840466912905659582237106874247165856493509961561958267")) - a1914 = T(parse(BigFloat,"0.00372901560694836335236995327852132340217759566678662385552634")) - a1915 = T(parse(BigFloat,"-4.71415495727125020678778179392224757011323373221820091641216")) - a1916 = T(parse(BigFloat,"-0.00176367657545349242053841995032797673574903886695600132759652")) - a1917 = T(parse(BigFloat,"7.64130548038698765563029310880237651185173367813936997648198")) - a1918 = T(parse(BigFloat,"3.50602043659751834989896082949744710968212949893375368243588")) - - a2000 = T(parse(BigFloat,"11.9514650694120686799372385830716401674473610826553517297976")) - a2012 = T(parse(BigFloat,"7.79480932108175968783516700231764388220284279598980948538579")) - a2013 = T(parse(BigFloat,"-56.4501393867325792523560991120904281440468100061340556540132")) - a2014 = T(parse(BigFloat,"0.0912376306930644901344530449290276645709607450403673704844997")) - a2015 = T(parse(BigFloat,"-12.7336279925434886201945524309199275038162717529918963305155")) - a2016 = T(parse(BigFloat,"-0.0396895921904719712313542810939736674712383070433147873009352")) - a2017 = T(parse(BigFloat,"54.4392141883570886996225765155307791861438378423305337073797")) - a2018 = T(parse(BigFloat,"-3.64411637921569236846406990361350645806721478409266709351203")) - a2019 = T(parse(BigFloat,"-0.804503249910509910899030787958579499315694913210787878260459")) - - a2100 = T(parse(BigFloat,"-148.809426507100488427838868268647625561930612082148597076690")) - a2112 = T(parse(BigFloat,"-91.7295278291256484357935662402321623495228729036354276506427")) - a2113 = T(parse(BigFloat,"707.656144971598359834575719286335716154821128966649565194286")) - a2114 = T(parse(BigFloat,"-1.10563611857482440905296961311590930801338308942637769555540")) - a2115 = T(parse(BigFloat,"176.134591883811372587859898076055660406999516762301689616841")) - a2116 = T(parse(BigFloat,"0.491384824214880662268898345164454557416884631402764792538746")) - a2117 = T(parse(BigFloat,"-684.278000449814944358237535610895081956077167893600278300805")) - a2118 = T(parse(BigFloat,"27.9910604998398258984224332124380407446002518400668657974589")) - a2119 = T(parse(BigFloat,"13.1939710030282333443670964371153238435064159623744975073252")) - a2120 = T(parse(BigFloat,"1.25128781283980445450114974148056006317268830077396406361417")) - - a2200 = T(parse(BigFloat,"-9.67307946948196763644126118433219395839951408571877262880482")) - a2212 = T(parse(BigFloat,"-4.46990150858505531443846227701960360497830681408751431146712")) - a2213 = T(parse(BigFloat,"45.5127128690952681968241950400052751178905907817398483534845")) - a2214 = T(parse(BigFloat,"-0.0713085086183826912791492024438246129930559805352394367050813")) - a2215 = T(parse(BigFloat,"11.2273614068412741582590624479939384207826800776794485051540")) - a2216 = T(parse(BigFloat,"0.126244376717622724516237912909138809361786889819105426371393")) - a2217 = T(parse(BigFloat,"-43.5439339549483313605810624907242107623814304467621407753424")) - a2218 = T(parse(BigFloat,"0.787174307543058978398792994996550902064546091443233850464377")) - a2219 = T(parse(BigFloat,"0.532264696744684215669300708603886690785395776821503851830821")) - a2220 = T(parse(BigFloat,"0.422422733996325326010225127471388772575086538809603346825334")) - a2221 = T(parse(BigFloat,"0.0859131249503067107308438031499859443441115056294154956487671")) - - a2300 = T(parse(BigFloat,"-10.0664032447054702403396606900426891472202824757968765569183")) - a2308 = T(parse(BigFloat,"-0.0366253270049039970293685796848974791733119081733552207318285")) - a2309 = T(parse(BigFloat,"0.0350254975636213681976849406979846524346789082471103574920148")) - a2310 = T(parse(BigFloat,"0.0360946016362113508931786658758335239823689929864237671348749")) - a2311 = T(parse(BigFloat,"-0.0265219967553681106351595946834601923649627012457464284442911")) - a2312 = T(parse(BigFloat,"-6.27088972181464143590553149478871603839356122957396018530209")) - a2313 = T(parse(BigFloat,"48.2079237442562989090702103008195063923492593141636117832993")) - a2314 = T(parse(BigFloat,"-0.0694471689136165640882395180583732834557754169149088630301342")) - a2315 = T(parse(BigFloat,"12.6810690204850295698341370913609807066108483811412127009785")) - a2316 = T(parse(BigFloat,"0.0119671168968323754838161435501011294100927813964199613229864")) - a2317 = T(parse(BigFloat,"-46.7249764992482408003358268242662695593201321659795608950429")) - a2318 = T(parse(BigFloat,"1.33029613326626711314710039298216591399033511191227101321435")) - a2319 = T(parse(BigFloat,"1.00766787503398298353438903619926657771162717793661719708370")) - a2320 = T(parse(BigFloat,"0.0209512051933665091664122388475480702892770753864487241177616")) - a2321 = T(parse(BigFloat,"0.0210134706331264177317735424331396407424412188443757490871603")) - a2322 = T(parse(BigFloat,"0.00952196014417121794175101542454575907376360233658356240547761")) - - a2400 = T(parse(BigFloat,"-409.478081677743708772589097409370357624424341606752069725341")) - a2408 = T(parse(BigFloat,"0.210451912023627385609097011999010655788807405225626700040882")) - a2409 = T(parse(BigFloat,"1.03427452057230411936482926828825709938667999698324740166559")) - a2410 = T(parse(BigFloat,"0.00600303645864422487051240448206640574939078092406156945568306")) - a2411 = T(parse(BigFloat,"0.855938125099619537578012106002407728915062652616416005816477")) - a2412 = T(parse(BigFloat,"-250.516998547447860492777657729316130386584050420782075966990")) - a2413 = T(parse(BigFloat,"1946.42466652388427766053750328264758595829850895761428240231")) - a2414 = T(parse(BigFloat,"-3.04503882102310365506105809086860882786950544097602101685174")) - a2415 = T(parse(BigFloat,"490.626379528281713521208265299168083841598542274061671576230")) - a2416 = T(parse(BigFloat,"1.56647589531270907115484067013597445739595615245966775329993")) - a2417 = T(parse(BigFloat,"-1881.97428994011173362217267377035870619215906638453056643641")) - a2418 = T(parse(BigFloat,"75.2592224724847175278837713643303149821620618914245864351135")) - a2419 = T(parse(BigFloat,"34.5734356980331067622434344736554689696728644793551014989002")) - a2420 = T(parse(BigFloat,"3.21147679440968961435417361847073755169022966748891627882572")) - a2421 = T(parse(BigFloat,"-0.460408041738414391307201404237058848867245095265382820823055")) - a2422 = T(parse(BigFloat,"-0.0870718339841810522431884137957986245724252047388936572215438")) - a2423 = T(parse(BigFloat,"-7.39351814158303067567016952195521063999185773249132944724553")) - - a2500 = T(parse(BigFloat,"3.43347475853550878921093496257596781120623891072008459930197")) - a2508 = T(parse(BigFloat,"0.00249163204855817407538949148805995149459884653585417680098222")) - a2509 = T(parse(BigFloat,"0.0230138787854593149638399846373742768772087122638142234223658")) - a2510 = T(parse(BigFloat,"-0.00322155956692977098724476092467120878189463604760620461043308")) - a2511 = T(parse(BigFloat,"0.00988442549447664668946335414487885256040819982786014648129297")) - a2512 = T(parse(BigFloat,"2.16252799377922507788307841904757354045759225335732707916530")) - a2513 = T(parse(BigFloat,"-16.2699864546457421328065640660139489006987552040228852402716")) - a2514 = T(parse(BigFloat,"-0.128534502120524552843583417470935010538029037542654506231743")) - a2515 = T(parse(BigFloat,"-8.98915042666504253089307820833379330486511746063552853023189")) - a2516 = T(parse(BigFloat,"-0.00348595363232025333387080201851013650192401767250513765000963")) - a2517 = T(parse(BigFloat,"15.7936194113339807536235187388695574135853387025139738341334")) - a2518 = T(parse(BigFloat,"-0.574403330914095065628165482017335820148383663195675408024658")) - a2519 = T(parse(BigFloat,"-0.345602039021393296692722496608124982535237228827655306030152")) - a2520 = T(parse(BigFloat,"-0.00662241490206585091731619991383757781133067992707418687587487")) - a2521 = T(parse(BigFloat,"-0.00777788129242204164032546458607364309759347209626759111946150")) - a2522 = T(parse(BigFloat,"-0.00356084192402274913338827232697437364675240818791706587952939")) - a2523 = T(parse(BigFloat,"4.79282506449930799649797749629840189457296934139359048988332")) - a2524 = T(parse(BigFloat,"0.153725464873068577844576387402512082757034273069877432944621")) - - a2600 = T(parse(BigFloat,"32.3038520871985442326994734440031535091364975047784630088983")) - a2605 = T(parse(BigFloat,"-0.00317987696266205093901912847692712407988609169703103952205634")) - a2606 = T(parse(BigFloat,"0.806397714906192077260821711520379506393543111567419750119748")) - a2607 = T(parse(BigFloat,"0.0975983126412388979093522850684288851314672048003054550357187")) - a2608 = T(parse(BigFloat,"0.778575578158398909027512446452927238999763460594181964958853")) - a2609 = T(parse(BigFloat,"0.204890423831599428189499202098105603312029235081420653574829")) - a2610 = T(parse(BigFloat,"-1.56261579627468188307070943950527825211462892236424360892806")) - a2612 = T(parse(BigFloat,"16.3429891882310570648504243973927174708753353504154550405647")) - a2613 = T(parse(BigFloat,"-154.544555293543621230730189631471036399316683669609116705323")) - a2614 = T(parse(BigFloat,"1.56971088703334872692034283417621761466263593582497085955201")) - a2615 = T(parse(BigFloat,"3.27685545087248131321429817269900731165522404974733504794135")) - a2616 = T(parse(BigFloat,"-0.0503489245193653176348040727199783626534081095691632396802451")) - a2617 = T(parse(BigFloat,"153.321151858041665070593767885914694011224363102594556731397")) - a2618 = T(parse(BigFloat,"7.17568186327720495846766484814784143567826308034865369443637")) - a2619 = T(parse(BigFloat,"-2.94036748675300481945917659896930989215320594380777597403592")) - a2620 = T(parse(BigFloat,"-0.0665845946076803144470749676022628870281920493197256887985612")) - a2621 = T(parse(BigFloat,"-0.0462346054990843661229248668562217261176966514016859284197145")) - a2622 = T(parse(BigFloat,"-0.0204198733585679401539388228617269778848579774821581777675337")) - a2623 = T(parse(BigFloat,"-53.3523106438735850515953441165998107974045090495791591218714")) - a2624 = T(parse(BigFloat,"-1.35548714715078654978732186705996404017554501614191325114947")) - a2625 = T(parse(BigFloat,"-1.57196275801232751882901735171459249177687219114442583461866")) - - a2700 = T(parse(BigFloat,"-16.6451467486341512872031294403931758764560371130818978459405")) - a2705 = T(parse(BigFloat,"0.00592232780324503308042990005798046524738389560444257136834990")) - a2706 = T(parse(BigFloat,"0.470326159963841112217224303205894113455362530746108825010848")) - a2707 = T(parse(BigFloat,"0.299688863848679000853981837096192399136831121671781279184194")) - a2708 = T(parse(BigFloat,"-0.247656877593994914689992276329810825853958069263947095548189")) - a2709 = T(parse(BigFloat,"0.110895029771437682893999851839061714522445173600678718208625")) - a2711 = T(parse(BigFloat,"-0.491719043846229147070666628704194097678081907210673044988866")) - a2712 = T(parse(BigFloat,"-11.4743154427289496968389492564352536350842454130853175250727")) - a2713 = T(parse(BigFloat,"80.2593166576230272541702485886484400152793366623589989106256")) - a2714 = T(parse(BigFloat,"-0.384132303980042847625312526759029103746926841342088219165648")) - a2715 = T(parse(BigFloat,"7.28147667468107583471326950926136115767612581862877764249646")) - a2716 = T(parse(BigFloat,"-0.132699384612248379510571708176035274836827341616751884314074")) - a2717 = T(parse(BigFloat,"-81.0799832525730726674679289752255240006070716633632990308935")) - a2718 = T(parse(BigFloat,"-1.25037492835620639521768185656179119962253747492403205797494")) - a2719 = T(parse(BigFloat,"2.59263594969543681023776379504377324994226447359296887778718")) - a2720 = T(parse(BigFloat,"-0.301440298346404539830163997260526875264431537275641495291993")) - a2721 = T(parse(BigFloat,"0.221384460789832337451706451572773791695246839057318414301020")) - a2722 = T(parse(BigFloat,"0.0827577274771892931955989870974693152996276435429809890551210")) - a2723 = T(parse(BigFloat,"18.9960662040611520464672450037243263998175161412237156872211")) - a2724 = T(parse(BigFloat,"0.269231946409639685623468015128334167460051910348912845121977")) - a2725 = T(parse(BigFloat,"1.62674827447066537462989364929628933988125029284183680279020")) - a2726 = T(parse(BigFloat,"0.491719043846229147070666628704194097678081907210673044988866")) - - a2800 = T(parse(BigFloat,"0.0838479812409052664616968791372814085980533139224911131069335")) - a2805 = T(parse(BigFloat,"-0.0117949367100973814319755056031295775367961960590736150777613")) - a2806 = T(parse(BigFloat,"-0.247299020568812652339473838743194598325992840353340132697498")) - a2807 = T(parse(BigFloat,"0.0978080858367729012259313014081291665503740655476733940756599")) - a2808 = T(parse(BigFloat,"0.217590689243420631360008651767860318344168120024782176879989")) - a2810 = T(parse(BigFloat,"0.137585606763325224865659632196787746647447222975084865975440")) - a2811 = T(parse(BigFloat,"0.0439870229715046685058790092341545026046103890294261359042581")) - a2813 = T(parse(BigFloat,"-0.513700813768193341957004456618630303738757363641964030086972")) - a2814 = T(parse(BigFloat,"0.826355691151315508644211308399153458701423158616168576922372")) - a2815 = T(parse(BigFloat,"25.7018139719811832625873882972519939511136556341960074626615")) - a2823 = T(parse(BigFloat,"-25.7018139719811832625873882972519939511136556341960074626615")) - a2824 = T(parse(BigFloat,"-0.826355691151315508644211308399153458701423158616168576922372")) - a2825 = T(parse(BigFloat,"0.513700813768193341957004456618630303738757363641964030086972")) - a2826 = T(parse(BigFloat,"-0.0439870229715046685058790092341545026046103890294261359042581")) - a2827 = T(parse(BigFloat,"-0.137585606763325224865659632196787746647447222975084865975440")) - - a2900 = T(parse(BigFloat,"0.124380526654094412881516420868799316268491466359671423163289")) - a2904 = T(parse(BigFloat,"0.226120282197584301422238662979202901196752320742633143965145")) - a2905 = T(parse(BigFloat,"0.0137885887618080880607695837016477814530969417491493385363543")) - a2906 = T(parse(BigFloat,"-0.0672210133996684449749399507414305856950086341525382182856200")) - a2909 = T(parse(BigFloat,"-0.856238975085428354755349769879501772112121597411563802855067")) - a2910 = T(parse(BigFloat,"-1.96337522866858908928262850028093813988180440518267404553576")) - a2911 = T(parse(BigFloat,"-0.232332822724119401237246257308921847250108199230419994978218")) - a2913 = T(parse(BigFloat,"4.30660719086453349461668936876562947772432562053478092626764")) - a2914 = T(parse(BigFloat,"-2.92722963249465482659787911202390446687687394950633612630592")) - a2915 = T(parse(BigFloat,"-82.3131666397858944454492334105458707735761966428138676971041")) - a2923 = T(parse(BigFloat,"82.3131666397858944454492334105458707735761966428138676971041")) - a2924 = T(parse(BigFloat,"2.92722963249465482659787911202390446687687394950633612630592")) - a2925 = T(parse(BigFloat,"-4.30660719086453349461668936876562947772432562053478092626764")) - a2926 = T(parse(BigFloat,"0.232332822724119401237246257308921847250108199230419994978218")) - a2927 = T(parse(BigFloat,"1.96337522866858908928262850028093813988180440518267404553576")) - a2928 = T(parse(BigFloat,"0.856238975085428354755349769879501772112121597411563802855067")) - - a3000 = T(parse(BigFloat,"0.103484561636679776672993546511910344499744798201971316606663")) - a3003 = T(parse(BigFloat,"0.122068887306407222589644082868962077139592714834162134741275")) - a3004 = T(parse(BigFloat,"0.482574490331246622475134780125688112865919023850168049679402")) - a3005 = T(parse(BigFloat,"-0.0381409600015606999730886240005620205664113072478411477421970")) - a3007 = T(parse(BigFloat,"-0.550499525310802324138388507020508177411414311000037561712836")) - a3009 = T(parse(BigFloat,"-0.711915811585189227887648262043794387578291882406745570495765")) - a3010 = T(parse(BigFloat,"-0.584129605671551340432988730158480872095335329645227595707052")) - a3013 = T(parse(BigFloat,"2.11046308125864932128717300046622750300375054278936987850718")) - a3014 = T(parse(BigFloat,"-0.0837494736739572135525742023001037992695260175335123517729291")) - a3015 = T(parse(BigFloat,"5.10021499072320914075295969043344113107545060862804249161191")) - a3023 = T(parse(BigFloat,"-5.10021499072320914075295969043344113107545060862804249161191")) - a3024 = T(parse(BigFloat,"0.0837494736739572135525742023001037992695260175335123517729291")) - a3025 = T(parse(BigFloat,"-2.11046308125864932128717300046622750300375054278936987850718")) - a3027 = T(parse(BigFloat,"0.584129605671551340432988730158480872095335329645227595707052")) - a3028 = T(parse(BigFloat,"0.711915811585189227887648262043794387578291882406745570495765")) - a3029 = T(parse(BigFloat,"0.550499525310802324138388507020508177411414311000037561712836")) + a0600 = T(0.103484561636679776672993546511910344499744798201971316606663) + a0603 = T(0.122068887306407222589644082868962077139592714834162134741275) + a0604 = T(0.482574490331246622475134780125688112865919023850168049679402) + a0605 = T(-0.0381409600015606999730886240005620205664113072478411477421970) - a3100 = T(29//150) - a3102 = T(11//50) - a3103 = T(-2//25) - a3106 = T(parse(BigFloat,"0.109993425580724703919462404865068340845119058295846426463652")) - a3107 = T(parse(BigFloat,"-0.254297048076270161384068506997153122141835626976703920846242")) - a3109 = T(parse(BigFloat,"0.865570777116694254343770343821098281832847401233011859346737")) - a3110 = T(parse(BigFloat,"3.32416449114093083106799552786572018336860092936986407160200")) - a3113 = T(parse(BigFloat,"-12.0102223315977933882352385148661841260301942633996815127277")) - a3114 = T(parse(BigFloat,"0.476601466242493239430442776862061899602963782003580209476163")) - a3115 = T(parse(BigFloat,"-29.0243011221036390525802623213654099596251221332470910692353")) - a3123 = T(parse(BigFloat,"29.0243011221036390525802623213654099596251221332470910692353")) - a3124 = T(parse(BigFloat,"-0.476601466242493239430442776862061899602963782003580209476163")) - a3125 = T(parse(BigFloat,"12.0102223315977933882352385148661841260301942633996815127277")) - a3127 = T(parse(BigFloat,"-3.32416449114093083106799552786572018336860092936986407160200")) - a3128 = T(parse(BigFloat,"-0.865570777116694254343770343821098281832847401233011859346737")) - a3129 = T(parse(BigFloat,"0.254297048076270161384068506997153122141835626976703920846242")) - a3130 = T(parse(BigFloat,"-0.109993425580724703919462404865068340845119058295846426463652")) + a0700 = T(0.124380526654094412881516420868799316268491466359671423163289) + a0704 = T(0.226120282197584301422238662979202901196752320742633143965145) + a0705 = T(0.0137885887618080880607695837016477814530969417491493385363543) + a0706 = T(-0.0672210133996684449749399507414305856950086341525382182856200) + a0800 = T(0.0936919065659673815530885456083005933866349695217750085655603) + a0805 = T(-0.00613406843450510987229498995641664735620914507128858871007099) + a0806 = T(0.216019825625503063708860097659866573490979433278117320188668) + a0807 = T(0.423695063515761937337619073960976753205867469544123532683116) - a3200 = T(-5//6) - a3201 = T(25//18) - a3204 = T(-3//4) - a3206 = T(parse(BigFloat,"-0.492529543718026304422682049114021320200214681580657784719074")) - a3230 = T(parse(BigFloat,"0.492529543718026304422682049114021320200214681580657784719074")) - a3231 = T(3//4) - a3300 = T(1//9) - a3302 = T(-2//9) - a3332 = T(2//9) + a0900 = T(0.0838479812409052664616968791372814085980533139224911131069335) + a0905 = T(-0.0117949367100973814319755056031295775367961960590736150777613) + a0906 = T(-0.247299020568812652339473838743194598325992840353340132697498) + a0907 = T(0.0978080858367729012259313014081291665503740655476733940756599) + a0908 = T(0.217590689243420631360008651767860318344168120024782176879989) - a3400 = T(parse(BigFloat,"0.285835140388971558796088842163836414852927537894596466840753")) - a3401 = T(7//24) - a3402 = T(7//32) - a3404 = T(21//128) - a3406 = T(parse(BigFloat,"0.218194354945556658327188241581352107093288824322187941141516")) - a3407 = T(parse(BigFloat,"0.180392898478697766863635221946775437719620053641849228562435")) - a3409 = T(parse(BigFloat,"0.205713839404845018859120755122929542277570094982808905393991")) - a3410 = T(parse(BigFloat,"0.242715791581770239970282927959446515762745971386670541948576")) - a3411 = T(parse(BigFloat,"0.246465780813629305833609291181891407799228103869305705137021")) - a3412 = T(parse(BigFloat,"-3.44991940790890824979834154601622662060370460614931644223924")) - a3413 = T(parse(BigFloat,"0.228875562160036081760729060738458584294220372552740218459295")) - a3414 = T(parse(BigFloat,"0.283290599702151415321527419056733335978436595493855789831434")) - a3415 = T(parse(BigFloat,"3.21085125837766640960131490544236787005557320332238705967955")) - a3416 = T(parse(BigFloat,"-0.223538777364845699920233756214162507964125230083674032084065")) - a3417 = T(parse(BigFloat,"-0.707121157204419073518727286207487212130091231955206160635271")) - a3418 = T(parse(BigFloat,"3.21123345150287080408174729202856500893260034443022374267639")) - a3419 = T(parse(BigFloat,"1.40954348309669766030414474301123175769045945573548986335553")) - a3420 = T(parse(BigFloat,"-0.151362053443742613121602276742518111090963026203676055891793")) - a3421 = T(parse(BigFloat,"0.372350574527014276454724080214619984397121028202148298716575")) - a3422 = T(parse(BigFloat,"0.252978746406361336722199907762141285915775728129414319261111")) - a3423 = T(parse(BigFloat,"-3.21085125837766640960131490544236787005557320332238705967955")) - a3424 = T(parse(BigFloat,"-0.283290599702151415321527419056733335978436595493855789831434")) - a3425 = T(parse(BigFloat,"-0.228875562160036081760729060738458584294220372552740218459295")) - a3426 = T(parse(BigFloat,"-0.246465780813629305833609291181891407799228103869305705137021")) - a3427 = T(parse(BigFloat,"-0.242715791581770239970282927959446515762745971386670541948576")) - a3428 = T(parse(BigFloat,"-0.205713839404845018859120755122929542277570094982808905393991")) - a3429 = T(parse(BigFloat,"-0.180392898478697766863635221946775437719620053641849228562435")) - a3430 = T(parse(BigFloat,"-0.218194354945556658327188241581352107093288824322187941141516")) + a1000 = T(0.0615255359769428227954562389614314714333423969064821107453940) + a1005 = T(0.00592232780324503308042990005798046524738389560444257136834990) + a1006 = T(0.470326159963841112217224303205894113455362530746108825010848) + a1007 = T(0.299688863848679000853981837096192399136831121671781279184194) + a1008 = T(-0.247656877593994914689992276329810825853958069263947095548189) + a1009 = T(0.110895029771437682893999851839061714522445173600678718208625) + + a1100 = T(0.0419700073362782579861792864787277787213483656543104611245994) + a1105 = T(-0.00317987696266205093901912847692712407988609169703103952205634) + a1106 = T(0.806397714906192077260821711520379506393543111567419750119748) + a1107 = T(0.0975983126412388979093522850684288851314672048003054550357187) + a1108 = T(0.778575578158398909027512446452927238999763460594181964958853) + a1109 = T(0.204890423831599428189499202098105603312029235081420653574829) + a1110 = T(-1.56261579627468188307070943950527825211462892236424360892806) + + a1200 = T(0.0437726782233730163574465242495339811688214967071614123256973) + a1208 = T(0.00624365027520195208794358628580933625281631216903095917201250) + a1209 = T(0.200043097109577314994435165469647856829066232218264969608768) + a1210 = T(-0.00805328367804983036823857162048902911923392887337029314844206) + a1211 = T(0.0211517528067396521915711903523399601316877825157550573051221) + + a1300 = T(0.0283499250363514563095023591920717312247137654896477097768495) + a1308 = T(0.00249163204855817407538949148805995149459884653585417680098222) + a1309 = T(0.0230138787854593149638399846373742768772087122638142234223658) + a1310 = T(-0.00322155956692977098724476092467120878189463604760620461043308) + a1311 = T(0.00988442549447664668946335414487885256040819982786014648129297) + a1312 = T(-0.0213010771328887351384307642875927384886634565429572466632092) + + a1400 = T(0.343511894290243001049432234735147943083353174980701426268122) + a1408 = T(0.210451912023627385609097011999010655788807405225626700040882) + a1409 = T(1.03427452057230411936482926828825709938667999698324740166559) + a1410 = T(0.00600303645864422487051240448206640574939078092406156945568306) + a1411 = T(0.855938125099619537578012106002407728915062652616416005816477) + a1412 = T(-0.977235005036766810872264852372525633013107656892839677696022) + a1413 = T(-0.660026980479294694616225013856327693720573981219974874776419) + + a1500 = T(-0.0143574001672168069538206399935076366657755954378399880691949) + a1508 = T(-0.0366253270049039970293685796848974791733119081733552207318285) + a1509 = T(0.0350254975636213681976849406979846524346789082471103574920148) + a1510 = T(0.0360946016362113508931786658758335239823689929864237671348749) + a1511 = T(-0.0265219967553681106351595946834601923649627012457464284442911) + a1512 = T(0.0445699011305698119638911537508839908104336323082226770910408) + a1513 = T(0.124343093331358243286225595741786448038973408895106741855721) + a1514 = T(0.00413829693239480694403512496204335960426192908674476033832967) + + a1600 = T(0.356032404425120290975609116398089176264106222379748802654822) + a1608 = T(-0.450192758947562595966821779075956175110645100214763601190349) + a1609 = T(0.430527907083710898626656292808782917793030154094709462877146) + a1610 = T(0.511973029011022237668556960394071692077125787030651386389972) + a1611 = T(0.908303638886404260390159124638110213997496214819904630546596) + a1612 = T(-1.23921093371933931757372469151534028854413889248605726186520) + a1613 = T(-0.649048661671761465141672348879062553905402831967191097656668) + a1614 = T(0.251708904586819292210480529948970541404887852931447491219418) + a1615 = T(0.779906470345586398810756795282334476023540593411550187024263) + + a1700 = T(0.0130935687406513066406881206418834980127470438213192487844956) + a1712 = T(-0.0000932053067985113945908461962767108237858631509684667142124826) + a1713 = T(0.0505374334262299359640090443138590726770942344716122381702746) + a1714 = T(8.04470341944487979109579109610197797641311868930865361048975e-7) + a1715 = T(0.000591726029494171190528755742777717259844340971924321528178248) + a1716 = T(-4.01614722154557337064691684906375587732264247950093804676867e-7) + + a1800 = T(0.0207926484466053012541944544000765652167255206144373407979758) + a1812 = T(0.000582695918800085915101902697837284108951406103029871570103075) + a1813 = T(-0.00801700732358815939083342186525852746640558465919633524655451) + a1814 = T(4.03847643847136940375170821743560570484117290330895506618968e-6) + a1815 = T(0.0854609998055506144225056114567535602510114622033622491802597) + a1816 = T(-2.04486480935804242706707569691004307904442837552677456232848e-6) + a1817 = T(0.105328578824431893399799402979093997354240904235172843146582) + + + a1900 = T(1.40153449795736021415446247355771306718486452917597731683689) + a1912 = T(-0.230252000984221261616272410367415621261130298274455611733277) + a1913 = T(-7.21106840466912905659582237106874247165856493509961561958267) + a1914 = T(0.00372901560694836335236995327852132340217759566678662385552634) + a1915 = T(-4.71415495727125020678778179392224757011323373221820091641216) + a1916 = T(-0.00176367657545349242053841995032797673574903886695600132759652) + a1917 = T(7.64130548038698765563029310880237651185173367813936997648198) + a1918 = T(3.50602043659751834989896082949744710968212949893375368243588) + + a2000 = T(11.9514650694120686799372385830716401674473610826553517297976) + a2012 = T(7.79480932108175968783516700231764388220284279598980948538579) + a2013 = T(-56.4501393867325792523560991120904281440468100061340556540132) + a2014 = T(0.0912376306930644901344530449290276645709607450403673704844997) + a2015 = T(-12.7336279925434886201945524309199275038162717529918963305155) + a2016 = T(-0.0396895921904719712313542810939736674712383070433147873009352) + a2017 = T(54.4392141883570886996225765155307791861438378423305337073797) + a2018 = T(-3.64411637921569236846406990361350645806721478409266709351203) + a2019 = T(-0.804503249910509910899030787958579499315694913210787878260459) + + a2100 = T(-148.809426507100488427838868268647625561930612082148597076690) + a2112 = T(-91.7295278291256484357935662402321623495228729036354276506427) + a2113 = T(707.656144971598359834575719286335716154821128966649565194286) + a2114 = T(-1.10563611857482440905296961311590930801338308942637769555540) + a2115 = T(176.134591883811372587859898076055660406999516762301689616841) + a2116 = T(0.491384824214880662268898345164454557416884631402764792538746) + a2117 = T(-684.278000449814944358237535610895081956077167893600278300805) + a2118 = T(27.9910604998398258984224332124380407446002518400668657974589) + a2119 = T(13.1939710030282333443670964371153238435064159623744975073252) + a2120 = T(1.25128781283980445450114974148056006317268830077396406361417) + + a2200 = T(-9.67307946948196763644126118433219395839951408571877262880482) + a2212 = T(-4.46990150858505531443846227701960360497830681408751431146712) + a2213 = T(45.5127128690952681968241950400052751178905907817398483534845) + a2214 = T(-0.0713085086183826912791492024438246129930559805352394367050813) + a2215 = T(11.2273614068412741582590624479939384207826800776794485051540) + a2216 = T(0.126244376717622724516237912909138809361786889819105426371393) + a2217 = T(-43.5439339549483313605810624907242107623814304467621407753424) + a2218 = T(0.787174307543058978398792994996550902064546091443233850464377) + a2219 = T(0.532264696744684215669300708603886690785395776821503851830821) + a2220 = T(0.422422733996325326010225127471388772575086538809603346825334) + a2221 = T(0.0859131249503067107308438031499859443441115056294154956487671) + + a2300 = T(-10.0664032447054702403396606900426891472202824757968765569183) + a2308 = T(-0.0366253270049039970293685796848974791733119081733552207318285) + a2309 = T(0.0350254975636213681976849406979846524346789082471103574920148) + a2310 = T(0.0360946016362113508931786658758335239823689929864237671348749) + a2311 = T(-0.0265219967553681106351595946834601923649627012457464284442911) + a2312 = T(-6.27088972181464143590553149478871603839356122957396018530209) + a2313 = T(48.2079237442562989090702103008195063923492593141636117832993) + a2314 = T(-0.0694471689136165640882395180583732834557754169149088630301342) + a2315 = T(12.6810690204850295698341370913609807066108483811412127009785) + a2316 = T(0.0119671168968323754838161435501011294100927813964199613229864) + a2317 = T(-46.7249764992482408003358268242662695593201321659795608950429) + a2318 = T(1.33029613326626711314710039298216591399033511191227101321435) + a2319 = T(1.00766787503398298353438903619926657771162717793661719708370) + a2320 = T(0.0209512051933665091664122388475480702892770753864487241177616) + a2321 = T(0.0210134706331264177317735424331396407424412188443757490871603) + a2322 = T(0.00952196014417121794175101542454575907376360233658356240547761) + + a2400 = T(-409.478081677743708772589097409370357624424341606752069725341) + a2408 = T(0.210451912023627385609097011999010655788807405225626700040882) + a2409 = T(1.03427452057230411936482926828825709938667999698324740166559) + a2410 = T(0.00600303645864422487051240448206640574939078092406156945568306) + a2411 = T(0.855938125099619537578012106002407728915062652616416005816477) + a2412 = T(-250.516998547447860492777657729316130386584050420782075966990) + a2413 = T(1946.42466652388427766053750328264758595829850895761428240231) + a2414 = T(-3.04503882102310365506105809086860882786950544097602101685174) + a2415 = T(490.626379528281713521208265299168083841598542274061671576230) + a2416 = T(1.56647589531270907115484067013597445739595615245966775329993) + a2417 = T(-1881.97428994011173362217267377035870619215906638453056643641) + a2418 = T(75.2592224724847175278837713643303149821620618914245864351135) + a2419 = T(34.5734356980331067622434344736554689696728644793551014989002) + a2420 = T(3.21147679440968961435417361847073755169022966748891627882572) + a2421 = T(-0.460408041738414391307201404237058848867245095265382820823055) + a2422 = T(-0.0870718339841810522431884137957986245724252047388936572215438) + a2423 = T(-7.39351814158303067567016952195521063999185773249132944724553) + + a2500 = T(3.43347475853550878921093496257596781120623891072008459930197) + a2508 = T(0.00249163204855817407538949148805995149459884653585417680098222) + a2509 = T(0.0230138787854593149638399846373742768772087122638142234223658) + a2510 = T(-0.00322155956692977098724476092467120878189463604760620461043308) + a2511 = T(0.00988442549447664668946335414487885256040819982786014648129297) + a2512 = T(2.16252799377922507788307841904757354045759225335732707916530) + a2513 = T(-16.2699864546457421328065640660139489006987552040228852402716) + a2514 = T(-0.128534502120524552843583417470935010538029037542654506231743) + a2515 = T(-8.98915042666504253089307820833379330486511746063552853023189) + a2516 = T(-0.00348595363232025333387080201851013650192401767250513765000963) + a2517 = T(15.7936194113339807536235187388695574135853387025139738341334) + a2518 = T(-0.574403330914095065628165482017335820148383663195675408024658) + a2519 = T(-0.345602039021393296692722496608124982535237228827655306030152) + a2520 = T(-0.00662241490206585091731619991383757781133067992707418687587487) + a2521 = T(-0.00777788129242204164032546458607364309759347209626759111946150) + a2522 = T(-0.00356084192402274913338827232697437364675240818791706587952939) + a2523 = T(4.79282506449930799649797749629840189457296934139359048988332) + a2524 = T(0.153725464873068577844576387402512082757034273069877432944621) + + a2600 = T(32.3038520871985442326994734440031535091364975047784630088983) + a2605 = T(-0.00317987696266205093901912847692712407988609169703103952205634) + a2606 = T(0.806397714906192077260821711520379506393543111567419750119748) + a2607 = T(0.0975983126412388979093522850684288851314672048003054550357187) + a2608 = T(0.778575578158398909027512446452927238999763460594181964958853) + a2609 = T(0.204890423831599428189499202098105603312029235081420653574829) + a2610 = T(-1.56261579627468188307070943950527825211462892236424360892806) + a2612 = T(16.3429891882310570648504243973927174708753353504154550405647) + a2613 = T(-154.544555293543621230730189631471036399316683669609116705323) + a2614 = T(1.56971088703334872692034283417621761466263593582497085955201) + a2615 = T(3.27685545087248131321429817269900731165522404974733504794135) + a2616 = T(-0.0503489245193653176348040727199783626534081095691632396802451) + a2617 = T(153.321151858041665070593767885914694011224363102594556731397) + a2618 = T(7.17568186327720495846766484814784143567826308034865369443637) + a2619 = T(-2.94036748675300481945917659896930989215320594380777597403592) + a2620 = T(-0.0665845946076803144470749676022628870281920493197256887985612) + a2621 = T(-0.0462346054990843661229248668562217261176966514016859284197145) + a2622 = T(-0.0204198733585679401539388228617269778848579774821581777675337) + a2623 = T(-53.3523106438735850515953441165998107974045090495791591218714) + a2624 = T(-1.35548714715078654978732186705996404017554501614191325114947) + a2625 = T(-1.57196275801232751882901735171459249177687219114442583461866) + + a2700 = T(-16.6451467486341512872031294403931758764560371130818978459405) + a2705 = T(0.00592232780324503308042990005798046524738389560444257136834990) + a2706 = T(0.470326159963841112217224303205894113455362530746108825010848) + a2707 = T(0.299688863848679000853981837096192399136831121671781279184194) + a2708 = T(-0.247656877593994914689992276329810825853958069263947095548189) + a2709 = T(0.110895029771437682893999851839061714522445173600678718208625) + a2711 = T(-0.491719043846229147070666628704194097678081907210673044988866) + a2712 = T(-11.4743154427289496968389492564352536350842454130853175250727) + a2713 = T(80.2593166576230272541702485886484400152793366623589989106256) + a2714 = T(-0.384132303980042847625312526759029103746926841342088219165648) + a2715 = T(7.28147667468107583471326950926136115767612581862877764249646) + a2716 = T(-0.132699384612248379510571708176035274836827341616751884314074) + a2717 = T(-81.0799832525730726674679289752255240006070716633632990308935) + a2718 = T(-1.25037492835620639521768185656179119962253747492403205797494) + a2719 = T(2.59263594969543681023776379504377324994226447359296887778718) + a2720 = T(-0.301440298346404539830163997260526875264431537275641495291993) + a2721 = T(0.221384460789832337451706451572773791695246839057318414301020) + a2722 = T(0.0827577274771892931955989870974693152996276435429809890551210) + a2723 = T(18.9960662040611520464672450037243263998175161412237156872211) + a2724 = T(0.269231946409639685623468015128334167460051910348912845121977) + a2725 = T(1.62674827447066537462989364929628933988125029284183680279020) + a2726 = T(0.491719043846229147070666628704194097678081907210673044988866) + + a2800 = T(0.0838479812409052664616968791372814085980533139224911131069335) + a2805 = T(-0.0117949367100973814319755056031295775367961960590736150777613) + a2806 = T(-0.247299020568812652339473838743194598325992840353340132697498) + a2807 = T(0.0978080858367729012259313014081291665503740655476733940756599) + a2808 = T(0.217590689243420631360008651767860318344168120024782176879989) + a2810 = T(0.137585606763325224865659632196787746647447222975084865975440) + a2811 = T(0.0439870229715046685058790092341545026046103890294261359042581) + a2813 = T(-0.513700813768193341957004456618630303738757363641964030086972) + a2814 = T(0.826355691151315508644211308399153458701423158616168576922372) + a2815 = T(25.7018139719811832625873882972519939511136556341960074626615) + a2823 = T(-25.7018139719811832625873882972519939511136556341960074626615) + a2824 = T(-0.826355691151315508644211308399153458701423158616168576922372) + a2825 = T(0.513700813768193341957004456618630303738757363641964030086972) + a2826 = T(-0.0439870229715046685058790092341545026046103890294261359042581) + a2827 = T(-0.137585606763325224865659632196787746647447222975084865975440) + + a2900 = T(0.124380526654094412881516420868799316268491466359671423163289) + a2904 = T(0.226120282197584301422238662979202901196752320742633143965145) + a2905 = T(0.0137885887618080880607695837016477814530969417491493385363543) + a2906 = T(-0.0672210133996684449749399507414305856950086341525382182856200) + a2909 = T(-0.856238975085428354755349769879501772112121597411563802855067) + a2910 = T(-1.96337522866858908928262850028093813988180440518267404553576) + a2911 = T(-0.232332822724119401237246257308921847250108199230419994978218) + a2913 = T(4.30660719086453349461668936876562947772432562053478092626764) + a2914 = T(-2.92722963249465482659787911202390446687687394950633612630592) + a2915 = T(-82.3131666397858944454492334105458707735761966428138676971041) + a2923 = T(82.3131666397858944454492334105458707735761966428138676971041) + a2924 = T(2.92722963249465482659787911202390446687687394950633612630592) + a2925 = T(-4.30660719086453349461668936876562947772432562053478092626764) + a2926 = T(0.232332822724119401237246257308921847250108199230419994978218) + a2927 = T(1.96337522866858908928262850028093813988180440518267404553576) + a2928 = T(0.856238975085428354755349769879501772112121597411563802855067) + + a3000 = T(0.103484561636679776672993546511910344499744798201971316606663) + a3003 = T(0.122068887306407222589644082868962077139592714834162134741275) + a3004 = T(0.482574490331246622475134780125688112865919023850168049679402) + a3005 = T(-0.0381409600015606999730886240005620205664113072478411477421970) + a3007 = T(-0.550499525310802324138388507020508177411414311000037561712836) + a3009 = T(-0.711915811585189227887648262043794387578291882406745570495765) + a3010 = T(-0.584129605671551340432988730158480872095335329645227595707052) + a3013 = T(2.11046308125864932128717300046622750300375054278936987850718) + a3014 = T(-0.0837494736739572135525742023001037992695260175335123517729291) + a3015 = T(5.10021499072320914075295969043344113107545060862804249161191) + a3023 = T(-5.10021499072320914075295969043344113107545060862804249161191) + a3024 = T(0.0837494736739572135525742023001037992695260175335123517729291) + a3025 = T(-2.11046308125864932128717300046622750300375054278936987850718) + a3027 = T(0.584129605671551340432988730158480872095335329645227595707052) + a3028 = T(0.711915811585189227887648262043794387578291882406745570495765) + a3029 = T(0.550499525310802324138388507020508177411414311000037561712836) + + a3100 = T(29//150) + a3102 = T(11//50) + a3103 = T(-2//25) + a3106 = T(0.109993425580724703919462404865068340845119058295846426463652) + a3107 = T(-0.254297048076270161384068506997153122141835626976703920846242) + a3109 = T(0.865570777116694254343770343821098281832847401233011859346737) + a3110 = T(3.32416449114093083106799552786572018336860092936986407160200) + a3113 = T(-12.0102223315977933882352385148661841260301942633996815127277) + a3114 = T(0.476601466242493239430442776862061899602963782003580209476163) + a3115 = T(-29.0243011221036390525802623213654099596251221332470910692353) + a3123 = T(29.0243011221036390525802623213654099596251221332470910692353) + a3124 = T(-0.476601466242493239430442776862061899602963782003580209476163) + a3125 = T(12.0102223315977933882352385148661841260301942633996815127277) + a3127 = T(-3.32416449114093083106799552786572018336860092936986407160200) + a3128 = T(-0.865570777116694254343770343821098281832847401233011859346737) + a3129 = T(0.254297048076270161384068506997153122141835626976703920846242) + a3130 = T(-0.109993425580724703919462404865068340845119058295846426463652) + + a3200 = T(-5//6) + a3201 = T(25//18) + a3204 = T(-3//4) + a3206 = T(-0.492529543718026304422682049114021320200214681580657784719074) + a3230 = T(0.492529543718026304422682049114021320200214681580657784719074) + a3231 = T(3//4) + + a3300 = T(1//9) + a3302 = T(-2//9) + a3332 = T(2//9) + + a3400 = T(0.285835140388971558796088842163836414852927537894596466840753) + a3401 = T(7//24) + a3402 = T(7//32) + a3404 = T(21//128) + a3406 = T(0.218194354945556658327188241581352107093288824322187941141516) + a3407 = T(0.180392898478697766863635221946775437719620053641849228562435) + a3409 = T(0.205713839404845018859120755122929542277570094982808905393991) + a3410 = T(0.242715791581770239970282927959446515762745971386670541948576) + a3411 = T(0.246465780813629305833609291181891407799228103869305705137021) + a3412 = T(-3.44991940790890824979834154601622662060370460614931644223924) + a3413 = T(0.228875562160036081760729060738458584294220372552740218459295) + a3414 = T(0.283290599702151415321527419056733335978436595493855789831434) + a3415 = T(3.21085125837766640960131490544236787005557320332238705967955) + a3416 = T(-0.223538777364845699920233756214162507964125230083674032084065) + a3417 = T(-0.707121157204419073518727286207487212130091231955206160635271) + a3418 = T(3.21123345150287080408174729202856500893260034443022374267639) + a3419 = T(1.40954348309669766030414474301123175769045945573548986335553) + a3420 = T(-0.151362053443742613121602276742518111090963026203676055891793) + a3421 = T(0.372350574527014276454724080214619984397121028202148298716575) + a3422 = T(0.252978746406361336722199907762141285915775728129414319261111) + a3423 = T(-3.21085125837766640960131490544236787005557320332238705967955) + a3424 = T(-0.283290599702151415321527419056733335978436595493855789831434) + a3425 = T(-0.228875562160036081760729060738458584294220372552740218459295) + a3426 = T(-0.246465780813629305833609291181891407799228103869305705137021) + a3427 = T(-0.242715791581770239970282927959446515762745971386670541948576) + a3428 = T(-0.205713839404845018859120755122929542277570094982808905393991) + a3429 = T(-0.180392898478697766863635221946775437719620053641849228562435) + a3430 = T(-0.218194354945556658327188241581352107093288824322187941141516) a3431 = T(-21//128) a3432 = T(-7//32) a3433 = T(-7//24) diff --git a/src/tableaus/high_order_rk_tableaus.jl b/src/tableaus/high_order_rk_tableaus.jl index 2edd35a61c..b30c3c1183 100644 --- a/src/tableaus/high_order_rk_tableaus.jl +++ b/src/tableaus/high_order_rk_tableaus.jl @@ -64,7 +64,7 @@ end On the Optimization of Some Nine-Stage Seventh-order Runge-Kutta Method, by M. Tanaka, S. Muramatsu and S. Yamashita, Information Processing Society of Japan, Vol. 33, No. 12 (1992) pages 1512-1526. """ -Base.@pure function TanYam7ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function TanYam7ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} c1 =T2(0.07816646510113846) c2 =T2(0.1172496976517077) c3 =T2(0.17587454647756157) @@ -302,7 +302,7 @@ end Cheap Error Estimation for Runge-Kutta methods, by Ch. Tsitouras and S.N. Papakostas, Siam Journal on Scientific Computing, Vol. 20, Issue 6, Nov 1999. """ -Base.@pure function TsitPap8ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function TsitPap8ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} c1 =T2(0.06338028169014084) c2 =T2(0.1027879458763643) @@ -664,7 +664,7 @@ struct DP8ConstantCache{T,T2} <: OrdinaryDiffEqConstantCache d716::T end -Base.@pure function DP8ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function DP8ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} c7 = T2(0.25) c8 = T2(0.3076923076923077) c9 = T2(0.6512820512820513) @@ -768,89 +768,89 @@ function DP8ConstantCache(T::Type,T2::Type) c4 = T2((6-sqrt(6))/10 * c6) c3 = T2(2//3 * c4) c2 = T2(2//3 * c3) - b1 = T(parse(BigFloat," 5.42937341165687622380535766363e-2")) - b6 = T(parse(BigFloat," 4.45031289275240888144113950566")) - b7 = T(parse(BigFloat," 1.89151789931450038304281599044")) - b8 = T(parse(BigFloat,"-5.8012039600105847814672114227")) - b9 = T(parse(BigFloat," 3.1116436695781989440891606237e-1")) - b10 = T(parse(BigFloat,"-1.52160949662516078556178806805e-1")) - b11 = T(parse(BigFloat," 2.01365400804030348374776537501e-1")) - b12 = T(parse(BigFloat," 4.47106157277725905176885569043e-2")) - # bhh1 = T(parse(BigFloat,"0.244094488188976377952755905512")) - # bhh2 = T(parse(BigFloat,"0.733846688281611857341361741547")) - # bhh3 = T(parse(BigFloat,"0.220588235294117647058823529412e-01")) - btilde1 = T(parse(BigFloat,"-1.898007540724076157147023288757e-1")) - btilde6 = T(parse(BigFloat," 4.45031289275240888144113950566")) - btilde7 = T(parse(BigFloat," 1.89151789931450038304281599044")) - btilde8 = T(parse(BigFloat,"-5.8012039600105847814672114227")) - btilde9 = T(parse(BigFloat,"-4.22682321323791962932445679177e-1")) - btilde10 = T(parse(BigFloat,"-1.52160949662516078556178806805e-1")) - btilde11 = T(parse(BigFloat," 2.01365400804030348374776537501e-1")) - btilde12 = T(parse(BigFloat,"2.26517921983608258118062039631e-2")) - er1 = T(parse(BigFloat," 0.1312004499419488073250102996e-01")) - er6 = T(parse(BigFloat,"-0.1225156446376204440720569753e+01")) - er7 = T(parse(BigFloat,"-0.4957589496572501915214079952")) - er8 = T(parse(BigFloat," 0.1664377182454986536961530415e+01")) - er9 = T(parse(BigFloat,"-0.3503288487499736816886487290")) - er10 = T(parse(BigFloat," 0.3341791187130174790297318841")) - er11 = T(parse(BigFloat," 0.8192320648511571246570742613e-01")) - er12 = T(parse(BigFloat,"-0.2235530786388629525884427845e-01")) - a0201 = T(parse(BigFloat," 5.26001519587677318785587544488e-2")) - a0301 = T(parse(BigFloat," 1.97250569845378994544595329183e-2")) - a0302 = T(parse(BigFloat," 5.91751709536136983633785987549e-2")) - a0401 = T(parse(BigFloat," 2.95875854768068491816892993775e-2")) - a0403 = T(parse(BigFloat," 8.87627564304205475450678981324e-2")) - a0501 = T(parse(BigFloat," 2.41365134159266685502369798665e-1")) - a0503 = T(parse(BigFloat,"-8.84549479328286085344864962717e-1")) - a0504 = T(parse(BigFloat," 9.24834003261792003115737966543e-1")) - a0601 = T(parse(BigFloat," 3.7037037037037037037037037037e-2")) - a0604 = T(parse(BigFloat," 1.70828608729473871279604482173e-1")) - a0605 = T(parse(BigFloat," 1.25467687566822425016691814123e-1")) - a0701 = T(parse(BigFloat," 3.7109375e-2")) - a0704 = T(parse(BigFloat," 1.70252211019544039314978060272e-1")) - a0705 = T(parse(BigFloat," 6.02165389804559606850219397283e-2")) - a0706 = T(parse(BigFloat,"-1.7578125e-2")) - a0801 = T(parse(BigFloat," 3.70920001185047927108779319836e-2")) - a0804 = T(parse(BigFloat," 1.70383925712239993810214054705e-1")) - a0805 = T(parse(BigFloat," 1.07262030446373284651809199168e-1")) - a0806 = T(parse(BigFloat,"-1.53194377486244017527936158236e-2")) - a0807 = T(parse(BigFloat," 8.27378916381402288758473766002e-3")) - a0901 = T(parse(BigFloat," 6.24110958716075717114429577812e-1")) - a0904 = T(parse(BigFloat,"-3.36089262944694129406857109825")) - a0905 = T(parse(BigFloat,"-8.68219346841726006818189891453e-1")) - a0906 = T(parse(BigFloat," 2.75920996994467083049415600797e1")) - a0907 = T(parse(BigFloat," 2.01540675504778934086186788979e1")) - a0908 = T(parse(BigFloat,"-4.34898841810699588477366255144e1")) - a1001 = T(parse(BigFloat," 4.77662536438264365890433908527e-1")) - a1004 = T(parse(BigFloat,"-2.48811461997166764192642586468e0")) - a1005 = T(parse(BigFloat,"-5.90290826836842996371446475743e-1")) - a1006 = T(parse(BigFloat," 2.12300514481811942347288949897e1")) - a1007 = T(parse(BigFloat," 1.52792336328824235832596922938e1")) - a1008 = T(parse(BigFloat,"-3.32882109689848629194453265587e1")) - a1009 = T(parse(BigFloat,"-2.03312017085086261358222928593e-2")) - a1101 = T(parse(BigFloat,"-9.3714243008598732571704021658e-1")) - a1104 = T(parse(BigFloat," 5.18637242884406370830023853209e0")) - a1105 = T(parse(BigFloat," 1.09143734899672957818500254654e0")) - a1106 = T(parse(BigFloat,"-8.14978701074692612513997267357e0")) - a1107 = T(parse(BigFloat,"-1.85200656599969598641566180701e1")) - a1108 = T(parse(BigFloat," 2.27394870993505042818970056734e1")) - a1109 = T(parse(BigFloat," 2.49360555267965238987089396762e0")) - a1110 = T(parse(BigFloat,"-3.0467644718982195003823669022e0")) - a1201 = T(parse(BigFloat," 2.27331014751653820792359768449e0")) - a1204 = T(parse(BigFloat," -1.05344954667372501984066689879e1")) - a1205 = T(parse(BigFloat," -2.00087205822486249909675718444e0")) - a1206 = T(parse(BigFloat," -1.79589318631187989172765950534e1")) - a1207 = T(parse(BigFloat," 2.79488845294199600508499808837e1")) - a1208 = T(parse(BigFloat," -2.85899827713502369474065508674e0")) - a1209 = T(parse(BigFloat," -8.87285693353062954433549289258e0")) - a1210 = T(parse(BigFloat," 1.23605671757943030647266201528e1")) - a1211 = T(parse(BigFloat," 6.43392746015763530355970484046e-1")) + b1 = T( 5.42937341165687622380535766363e-2) + b6 = T( 4.45031289275240888144113950566) + b7 = T( 1.89151789931450038304281599044) + b8 = T(-5.8012039600105847814672114227) + b9 = T( 3.1116436695781989440891606237e-1) + b10 = T(-1.52160949662516078556178806805e-1) + b11 = T( 2.01365400804030348374776537501e-1) + b12 = T( 4.47106157277725905176885569043e-2) + # bhh1 = T(0.244094488188976377952755905512) + # bhh2 = T(0.733846688281611857341361741547) + # bhh3 = T(0.220588235294117647058823529412e-01) + btilde1 = T(-1.898007540724076157147023288757e-1) + btilde6 = T( 4.45031289275240888144113950566) + btilde7 = T( 1.89151789931450038304281599044) + btilde8 = T(-5.8012039600105847814672114227) + btilde9 = T(-4.22682321323791962932445679177e-1) + btilde10 = T(-1.52160949662516078556178806805e-1) + btilde11 = T( 2.01365400804030348374776537501e-1) + btilde12 = T(2.26517921983608258118062039631e-2) + er1 = T( 0.1312004499419488073250102996e-01) + er6 = T(-0.1225156446376204440720569753e+01) + er7 = T(-0.4957589496572501915214079952) + er8 = T( 0.1664377182454986536961530415e+01) + er9 = T(-0.3503288487499736816886487290) + er10 = T( 0.3341791187130174790297318841) + er11 = T( 0.8192320648511571246570742613e-01) + er12 = T(-0.2235530786388629525884427845e-01) + a0201 = T( 5.26001519587677318785587544488e-2) + a0301 = T( 1.97250569845378994544595329183e-2) + a0302 = T( 5.91751709536136983633785987549e-2) + a0401 = T( 2.95875854768068491816892993775e-2) + a0403 = T( 8.87627564304205475450678981324e-2) + a0501 = T( 2.41365134159266685502369798665e-1) + a0503 = T(-8.84549479328286085344864962717e-1) + a0504 = T( 9.24834003261792003115737966543e-1) + a0601 = T( 3.7037037037037037037037037037e-2) + a0604 = T( 1.70828608729473871279604482173e-1) + a0605 = T( 1.25467687566822425016691814123e-1) + a0701 = T( 3.7109375e-2) + a0704 = T( 1.70252211019544039314978060272e-1) + a0705 = T( 6.02165389804559606850219397283e-2) + a0706 = T(-1.7578125e-2) + a0801 = T( 3.70920001185047927108779319836e-2) + a0804 = T( 1.70383925712239993810214054705e-1) + a0805 = T( 1.07262030446373284651809199168e-1) + a0806 = T(-1.53194377486244017527936158236e-2) + a0807 = T( 8.27378916381402288758473766002e-3) + a0901 = T( 6.24110958716075717114429577812e-1) + a0904 = T(-3.36089262944694129406857109825) + a0905 = T(-8.68219346841726006818189891453e-1) + a0906 = T( 2.75920996994467083049415600797e1) + a0907 = T( 2.01540675504778934086186788979e1) + a0908 = T(-4.34898841810699588477366255144e1) + a1001 = T( 4.77662536438264365890433908527e-1) + a1004 = T(-2.48811461997166764192642586468e0) + a1005 = T(-5.90290826836842996371446475743e-1) + a1006 = T( 2.12300514481811942347288949897e1) + a1007 = T( 1.52792336328824235832596922938e1) + a1008 = T(-3.32882109689848629194453265587e1) + a1009 = T(-2.03312017085086261358222928593e-2) + a1101 = T(-9.3714243008598732571704021658e-1) + a1104 = T( 5.18637242884406370830023853209e0) + a1105 = T( 1.09143734899672957818500254654e0) + a1106 = T(-8.14978701074692612513997267357e0) + a1107 = T(-1.85200656599969598641566180701e1) + a1108 = T( 2.27394870993505042818970056734e1) + a1109 = T( 2.49360555267965238987089396762e0) + a1110 = T(-3.0467644718982195003823669022e0) + a1201 = T( 2.27331014751653820792359768449e0) + a1204 = T( -1.05344954667372501984066689879e1) + a1205 = T( -2.00087205822486249909675718444e0) + a1206 = T( -1.79589318631187989172765950534e1) + a1207 = T( 2.79488845294199600508499808837e1) + a1208 = T( -2.85899827713502369474065508674e0) + a1209 = T( -8.87285693353062954433549289258e0) + a1210 = T( 1.23605671757943030647266201528e1) + a1211 = T( 6.43392746015763530355970484046e-1) c14,c15,c16,a1401,a1407,a1408,a1409,a1410,a1411,a1412,a1413,a1501,a1506,a1507,a1508,a1511,a1512,a1513,a1514,a1601,a1606,a1607,a1608,a1609,a1613,a1614,a1615 = DP8Interp(T,T2) d401,d406,d407,d408,d409,d410,d411,d412,d413,d414,d415,d416,d501,d506,d507,d508,d509,d510,d511,d512,d513,d514,d515,d516,d601,d606,d607,d608,d609,d610,d611,d612,d613,d614,d615,d616,d701,d706,d707,d708,d709,d710,d711,d712,d713,d714,d715,d716 = DP8Interp_polyweights(T) DP8ConstantCache(c7,c8,c9,c10,c11,c6,c5,c4,c3,c2,b1,b6,b7,b8,b9,b10,b11,b12,btilde1,btilde6,btilde7,btilde8,btilde9,btilde10,btilde11,btilde12,er1,er6,er7,er8,er9,er10,er11,er12,a0201,a0301,a0302,a0401,a0403,a0501,a0503,a0504,a0601,a0604,a0605,a0701,a0704,a0705,a0706,a0801,a0804,a0805,a0806,a0807,a0901,a0904,a0905,a0906,a0907,a0908,a1001,a1004,a1005,a1006,a1007,a1008,a1009,a1101,a1104,a1105,a1106,a1107,a1108,a1109,a1110,a1201,a1204,a1205,a1206,a1207,a1208,a1209,a1210,a1211,c14,c15,c16,a1401,a1407,a1408,a1409,a1410,a1411,a1412,a1413,a1501,a1506,a1507,a1508,a1511,a1512,a1513,a1514,a1601,a1606,a1607,a1608,a1609,a1613,a1614,a1615,d401,d406,d407,d408,d409,d410,d411,d412,d413,d414,d415,d416,d501,d506,d507,d508,d509,d510,d511,d512,d513,d514,d515,d516,d601,d606,d607,d608,d609,d610,d611,d612,d613,d614,d615,d616,d701,d706,d707,d708,d709,d710,d711,d712,d713,d714,d715,d716) end -Base.@pure function DP8Interp{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function DP8Interp(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} c14 = T2(0.1) c15 = T2(0.2) c16 = T2(0.7777777777777778) @@ -886,35 +886,35 @@ function DP8Interp(T::Type,T2::Type) c14 = T2(1//10) c15 = T2(2//10) c16 = T2(7//9) - a1401 = T(parse(BigFloat," 5.61675022830479523392909219681e-2")) - a1407 = T(parse(BigFloat," 2.53500210216624811088794765333e-1")) - a1408 = T(parse(BigFloat,"-2.46239037470802489917441475441e-1")) - a1409 = T(parse(BigFloat,"-1.24191423263816360469010140626e-1")) - a1410 = T(parse(BigFloat," 1.5329179827876569731206322685e-1")) - a1411 = T(parse(BigFloat," 8.20105229563468988491666602057e-3")) - a1412 = T(parse(BigFloat," 7.56789766054569976138603589584e-3")) - a1413 = T(parse(BigFloat,"-8.298e-3")) - a1501 = T(parse(BigFloat," 3.18346481635021405060768473261e-2")) - a1506 = T(parse(BigFloat," 2.83009096723667755288322961402e-2")) - a1507 = T(parse(BigFloat," 5.35419883074385676223797384372e-2")) - a1508 = T(parse(BigFloat,"-5.49237485713909884646569340306e-2")) - a1511 = T(parse(BigFloat,"-1.08347328697249322858509316994e-4")) - a1512 = T(parse(BigFloat," 3.82571090835658412954920192323e-4")) - a1513 = T(parse(BigFloat,"-3.40465008687404560802977114492e-4")) - a1514 = T(parse(BigFloat," 1.41312443674632500278074618366e-1")) - a1601 = T(parse(BigFloat,"-4.28896301583791923408573538692e-1")) - a1606 = T(parse(BigFloat,"-4.69762141536116384314449447206e0")) - a1607 = T(parse(BigFloat," 7.68342119606259904184240953878e0")) - a1608 = T(parse(BigFloat," 4.06898981839711007970213554331e0")) - a1609 = T(parse(BigFloat," 3.56727187455281109270669543021e-1")) - a1613 = T(parse(BigFloat,"-1.39902416515901462129418009734e-3")) - a1614 = T(parse(BigFloat," 2.9475147891527723389556272149e0")) - a1615 = T(parse(BigFloat,"-9.15095847217987001081870187138e0")) + a1401 = T( 5.61675022830479523392909219681e-2) + a1407 = T( 2.53500210216624811088794765333e-1) + a1408 = T(-2.46239037470802489917441475441e-1) + a1409 = T(-1.24191423263816360469010140626e-1) + a1410 = T( 1.5329179827876569731206322685e-1) + a1411 = T( 8.20105229563468988491666602057e-3) + a1412 = T( 7.56789766054569976138603589584e-3) + a1413 = T(-8.298e-3) + a1501 = T( 3.18346481635021405060768473261e-2) + a1506 = T( 2.83009096723667755288322961402e-2) + a1507 = T( 5.35419883074385676223797384372e-2) + a1508 = T(-5.49237485713909884646569340306e-2) + a1511 = T(-1.08347328697249322858509316994e-4) + a1512 = T( 3.82571090835658412954920192323e-4) + a1513 = T(-3.40465008687404560802977114492e-4) + a1514 = T( 1.41312443674632500278074618366e-1) + a1601 = T(-4.28896301583791923408573538692e-1) + a1606 = T(-4.69762141536116384314449447206e0) + a1607 = T( 7.68342119606259904184240953878e0) + a1608 = T( 4.06898981839711007970213554331e0) + a1609 = T( 3.56727187455281109270669543021e-1) + a1613 = T(-1.39902416515901462129418009734e-3) + a1614 = T( 2.9475147891527723389556272149e0) + a1615 = T(-9.15095847217987001081870187138e0) return c14,c15,c16,a1401,a1407,a1408,a1409,a1410,a1411,a1412,a1413,a1501,a1506,a1507,a1508,a1511,a1512,a1513,a1514,a1601,a1606,a1607,a1608,a1609,a1613,a1614,a1615 end -Base.@pure function DP8Interp_polyweights{T<:CompiledFloats}(::Type{T}) +Base.@pure function DP8Interp_polyweights(::Type{T}) where T<:CompiledFloats d401 = T(-8.428938276109013) d406 = T(0.5667149535193777) d407 = T(-3.0689499459498917) @@ -969,54 +969,54 @@ end function DP8Interp_polyweights(T::Type) - d401 = T(parse(BigFloat,"-0.84289382761090128651353491142e+01")) - d406 = T(parse(BigFloat," 0.56671495351937776962531783590e+00")) - d407 = T(parse(BigFloat,"-0.30689499459498916912797304727e+01")) - d408 = T(parse(BigFloat," 0.23846676565120698287728149680e+01")) - d409 = T(parse(BigFloat," 0.21170345824450282767155149946e+01")) - d410 = T(parse(BigFloat,"-0.87139158377797299206789907490e+00")) - d411 = T(parse(BigFloat," 0.22404374302607882758541771650e+01")) - d412 = T(parse(BigFloat," 0.63157877876946881815570249290e+00")) - d413 = T(parse(BigFloat,"-0.88990336451333310820698117400e-01")) - d414 = T(parse(BigFloat," 0.18148505520854727256656404962e+02")) - d415 = T(parse(BigFloat,"-0.91946323924783554000451984436e+01")) - d416 = T(parse(BigFloat,"-0.44360363875948939664310572000e+01")) - d501 = T(parse(BigFloat," 0.10427508642579134603413151009e+02")) - d506 = T(parse(BigFloat," 0.24228349177525818288430175319e+03")) - d507 = T(parse(BigFloat," 0.16520045171727028198505394887e+03")) - d508 = T(parse(BigFloat,"-0.37454675472269020279518312152e+03")) - d509 = T(parse(BigFloat,"-0.22113666853125306036270938578e+02")) - d510 = T(parse(BigFloat," 0.77334326684722638389603898808e+01")) - d511 = T(parse(BigFloat,"-0.30674084731089398182061213626e+02")) - d512 = T(parse(BigFloat,"-0.93321305264302278729567221706e+01")) - d513 = T(parse(BigFloat," 0.15697238121770843886131091075e+02")) - d514 = T(parse(BigFloat,"-0.31139403219565177677282850411e+02")) - d515 = T(parse(BigFloat,"-0.93529243588444783865713862664e+01")) - d516 = T(parse(BigFloat," 0.35816841486394083752465898540e+02")) - d601 = T(parse(BigFloat," 0.19985053242002433820987653617e+02")) - d606 = T(parse(BigFloat,"-0.38703730874935176555105901742e+03")) - d607 = T(parse(BigFloat,"-0.18917813819516756882830838328e+03")) - d608 = T(parse(BigFloat," 0.52780815920542364900561016686e+03")) - d609 = T(parse(BigFloat,"-0.11573902539959630126141871134e+02")) - d610 = T(parse(BigFloat," 0.68812326946963000169666922661e+01")) - d611 = T(parse(BigFloat,"-0.10006050966910838403183860980e+01")) - d612 = T(parse(BigFloat," 0.77771377980534432092869265740e+00")) - d613 = T(parse(BigFloat,"-0.27782057523535084065932004339e+01")) - d614 = T(parse(BigFloat,"-0.60196695231264120758267380846e+02")) - d615 = T(parse(BigFloat," 0.84320405506677161018159903784e+02")) - d616 = T(parse(BigFloat," 0.11992291136182789328035130030e+02")) - d701 = T(parse(BigFloat,"-0.25693933462703749003312586129e+02")) - d706 = T(parse(BigFloat,"-0.15418974869023643374053993627e+03")) - d707 = T(parse(BigFloat,"-0.23152937917604549567536039109e+03")) - d708 = T(parse(BigFloat," 0.35763911791061412378285349910e+03")) - d709 = T(parse(BigFloat," 0.93405324183624310003907691704e+02")) - d710 = T(parse(BigFloat,"-0.37458323136451633156875139351e+02")) - d711 = T(parse(BigFloat," 0.10409964950896230045147246184e+03")) - d712 = T(parse(BigFloat," 0.29840293426660503123344363579e+02")) - d713 = T(parse(BigFloat,"-0.43533456590011143754432175058e+02")) - d714 = T(parse(BigFloat," 0.96324553959188282948394950600e+02")) - d715 = T(parse(BigFloat,"-0.39177261675615439165231486172e+02")) - d716 = T(parse(BigFloat,"-0.14972683625798562581422125276e+03")) + d401 = T(-0.84289382761090128651353491142e+01) + d406 = T( 0.56671495351937776962531783590e+00) + d407 = T(-0.30689499459498916912797304727e+01) + d408 = T( 0.23846676565120698287728149680e+01) + d409 = T( 0.21170345824450282767155149946e+01) + d410 = T(-0.87139158377797299206789907490e+00) + d411 = T( 0.22404374302607882758541771650e+01) + d412 = T( 0.63157877876946881815570249290e+00) + d413 = T(-0.88990336451333310820698117400e-01) + d414 = T( 0.18148505520854727256656404962e+02) + d415 = T(-0.91946323924783554000451984436e+01) + d416 = T(-0.44360363875948939664310572000e+01) + d501 = T( 0.10427508642579134603413151009e+02) + d506 = T( 0.24228349177525818288430175319e+03) + d507 = T( 0.16520045171727028198505394887e+03) + d508 = T(-0.37454675472269020279518312152e+03) + d509 = T(-0.22113666853125306036270938578e+02) + d510 = T( 0.77334326684722638389603898808e+01) + d511 = T(-0.30674084731089398182061213626e+02) + d512 = T(-0.93321305264302278729567221706e+01) + d513 = T( 0.15697238121770843886131091075e+02) + d514 = T(-0.31139403219565177677282850411e+02) + d515 = T(-0.93529243588444783865713862664e+01) + d516 = T( 0.35816841486394083752465898540e+02) + d601 = T( 0.19985053242002433820987653617e+02) + d606 = T(-0.38703730874935176555105901742e+03) + d607 = T(-0.18917813819516756882830838328e+03) + d608 = T( 0.52780815920542364900561016686e+03) + d609 = T(-0.11573902539959630126141871134e+02) + d610 = T( 0.68812326946963000169666922661e+01) + d611 = T(-0.10006050966910838403183860980e+01) + d612 = T( 0.77771377980534432092869265740e+00) + d613 = T(-0.27782057523535084065932004339e+01) + d614 = T(-0.60196695231264120758267380846e+02) + d615 = T( 0.84320405506677161018159903784e+02) + d616 = T( 0.11992291136182789328035130030e+02) + d701 = T(-0.25693933462703749003312586129e+02) + d706 = T(-0.15418974869023643374053993627e+03) + d707 = T(-0.23152937917604549567536039109e+03) + d708 = T( 0.35763911791061412378285349910e+03) + d709 = T( 0.93405324183624310003907691704e+02) + d710 = T(-0.37458323136451633156875139351e+02) + d711 = T( 0.10409964950896230045147246184e+03) + d712 = T( 0.29840293426660503123344363579e+02) + d713 = T(-0.43533456590011143754432175058e+02) + d714 = T( 0.96324553959188282948394950600e+02) + d715 = T(-0.39177261675615439165231486172e+02) + d716 = T(-0.14972683625798562581422125276e+03) return d401,d406,d407,d408,d409,d410,d411,d412,d413,d414,d415,d416,d501,d506,d507,d508,d509,d510,d511,d512,d513,d514,d515,d516,d601,d606,d607,d608,d609,d610,d611,d612,d613,d614,d615,d616,d701,d706,d707,d708,d709,d710,d711,d712,d713,d714,d715,d716 end diff --git a/src/tableaus/low_order_rk_tableaus.jl b/src/tableaus/low_order_rk_tableaus.jl index 059970573a..e3e5b5666e 100644 --- a/src/tableaus/low_order_rk_tableaus.jl +++ b/src/tableaus/low_order_rk_tableaus.jl @@ -17,7 +17,7 @@ constructBogakiShampine3() Constructs the tableau object for the Bogakai-Shampine Order 2/3 method. """ -Base.@pure function BS3ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function BS3ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} a21 = T(0.5) a32 = T(0.75) a41 = T(0.2222222222222222) @@ -80,7 +80,7 @@ struct OwrenZen3ConstantCache{T,T2} <: OrdinaryDiffEqConstantCache r32::T end -Base.@pure function OwrenZen3ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function OwrenZen3ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} a21 = T(0.5217391304347826) a31 = T(-0.18133333333333335) a32 = T(0.9813333333333333) @@ -104,7 +104,7 @@ Base.@pure function OwrenZen3ConstantCache{T<:CompiledFloats,T2<:CompiledFloats} r13,r12,r23,r22,r33,r32) end -Base.@pure function OwrenZen3ConstantCache{T,T2}(::Type{T},::Type{T2}) +Base.@pure function OwrenZen3ConstantCache(::Type{T},::Type{T2}) where {T,T2} a21 = T(12//23) a31 = T(-68//375) a32 = T(368//375) @@ -168,7 +168,7 @@ struct OwrenZen4ConstantCache{T,T2} <: OrdinaryDiffEqConstantCache r62::T end -Base.@pure function OwrenZen4ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function OwrenZen4ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} a21 = T(0.16666666666666666) a31 = T(0.03214024835646457) a32 = T(0.26515704894083275) @@ -215,7 +215,7 @@ Base.@pure function OwrenZen4ConstantCache{T<:CompiledFloats,T2<:CompiledFloats} r54,r53,r52,r64,r63,r62) end -Base.@pure function OwrenZen4ConstantCache{T,T2}(::Type{T},::Type{T2}) +Base.@pure function OwrenZen4ConstantCache(::Type{T},::Type{T2}) where {T,T2} a21 = T(1//6) a31 = T(44//1369) a32 = T(363//1369) @@ -331,7 +331,7 @@ struct OwrenZen5ConstantCache{T,T2} <: OrdinaryDiffEqConstantCache r82::T end -Base.@pure function OwrenZen5ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function OwrenZen5ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} a21 = T(0.16666666666666666) a31 = T(0.0625) a32 = T(0.1875) @@ -412,7 +412,7 @@ Base.@pure function OwrenZen5ConstantCache{T<:CompiledFloats,T2<:CompiledFloats} r62,r75,r74,r73,r72,r85,r84,r83,r82) end -Base.@pure function OwrenZen5ConstantCache{T,T2}(::Type{T},::Type{T2}) +Base.@pure function OwrenZen5ConstantCache(::Type{T},::Type{T2}) where {T,T2} a21 = T(1//6) a31 = T(1//16) a32 = T(3//16) @@ -553,7 +553,7 @@ struct Tsit5ConstantCache{T,T2} <: OrdinaryDiffEqConstantCache r74::T end -Base.@pure function Tsit5ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function Tsit5ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} c1 = T2(0.161) c2 = T2(0.327) c3 = T2(0.9) @@ -604,43 +604,43 @@ function Tsit5ConstantCache(T::Type,T2::Type) c1 = T2(161//1000) c2 = T2(327//1000) c3 = T2(9//10) - c4 = T2(parse(BigFloat,".9800255409045096857298102862870245954942137979563024768854764293221195950761080302604")) + c4 = T2(.9800255409045096857298102862870245954942137979563024768854764293221195950761080302604) c5 = T2(1) c6 = T2(1) a21= T(161//1000) - a31= T(parse(BigFloat,"-.8480655492356988544426874250230774675121177393430391537369234245294192976164141156943e-2")) - a32= T(parse(BigFloat,".3354806554923569885444268742502307746751211773934303915373692342452941929761641411569")) - a41= T(parse(BigFloat,"2.897153057105493432130432594192938764924887287701866490314866693455023795137503079289")) - a42= T(parse(BigFloat,"-6.359448489975074843148159912383825625952700647415626703305928850207288721235210244366")) - a43= T(parse(BigFloat,"4.362295432869581411017727318190886861027813359713760212991062156752264926097707165077")) - a51= T(parse(BigFloat,"5.325864828439256604428877920840511317836476253097040101202360397727981648835607691791")) - a52= T(parse(BigFloat,"-11.74888356406282787774717033978577296188744178259862899288666928009020615663593781589")) - a53= T(parse(BigFloat,"7.495539342889836208304604784564358155658679161518186721010132816213648793440552049753")) - a54= T(parse(BigFloat,"-.9249506636175524925650207933207191611349983406029535244034750452930469056411389539635e-1")) - a61= T(parse(BigFloat,"5.861455442946420028659251486982647890394337666164814434818157239052507339770711679748")) - a62= T(parse(BigFloat,"-12.92096931784710929170611868178335939541780751955743459166312250439928519268343184452")) - a63= T(parse(BigFloat,"8.159367898576158643180400794539253485181918321135053305748355423955009222648673734986")) - a64= T(parse(BigFloat,"-.7158497328140099722453054252582973869127213147363544882721139659546372402303777878835e-1")) - a65= T(parse(BigFloat,"-.2826905039406838290900305721271224146717633626879770007617876201276764571291579142206e-1")) - a71= T(parse(BigFloat,".9646076681806522951816731316512876333711995238157997181903319145764851595234062815396e-1")) + a31= T(-.8480655492356988544426874250230774675121177393430391537369234245294192976164141156943e-2) + a32= T(.3354806554923569885444268742502307746751211773934303915373692342452941929761641411569) + a41= T(2.897153057105493432130432594192938764924887287701866490314866693455023795137503079289) + a42= T(-6.359448489975074843148159912383825625952700647415626703305928850207288721235210244366) + a43= T(4.362295432869581411017727318190886861027813359713760212991062156752264926097707165077) + a51= T(5.325864828439256604428877920840511317836476253097040101202360397727981648835607691791) + a52= T(-11.74888356406282787774717033978577296188744178259862899288666928009020615663593781589) + a53= T(7.495539342889836208304604784564358155658679161518186721010132816213648793440552049753) + a54= T(-.9249506636175524925650207933207191611349983406029535244034750452930469056411389539635e-1) + a61= T(5.861455442946420028659251486982647890394337666164814434818157239052507339770711679748) + a62= T(-12.92096931784710929170611868178335939541780751955743459166312250439928519268343184452) + a63= T(8.159367898576158643180400794539253485181918321135053305748355423955009222648673734986) + a64= T(-.7158497328140099722453054252582973869127213147363544882721139659546372402303777878835e-1) + a65= T(-.2826905039406838290900305721271224146717633626879770007617876201276764571291579142206e-1) + a71= T(.9646076681806522951816731316512876333711995238157997181903319145764851595234062815396e-1) a72= T(1//100) - a73= T(parse(BigFloat,".4798896504144995747752495322905965199130404621990332488332634944254542060153074523509")) - a74= T(parse(BigFloat,"1.379008574103741893192274821856872770756462643091360525934940067397245698027561293331")) - a75= T(parse(BigFloat,"-3.290069515436080679901047585711363850115683290894936158531296799594813811049925401677")) - a76= T(parse(BigFloat,"2.324710524099773982415355918398765796109060233222962411944060046314465391054716027841")) - # b1 = T(parse(BigFloat,".9468075576583945807478876255758922856117527357724631226139574065785592789071067303271e-1")) - # b2 = T(parse(BigFloat,".9183565540343253096776363936645313759813746240984095238905939532922955247253608687270e-2")) - # b3 = T(parse(BigFloat,".4877705284247615707855642599631228241516691959761363774365216240304071651579571959813")) - # b4 = T(parse(BigFloat,"1.234297566930478985655109673884237654035539930748192848315425833500484878378061439761")) - # b5 = T(parse(BigFloat,"-2.707712349983525454881109975059321670689605166938197378763992255714444407154902012702")) - # b6 = T(parse(BigFloat,"1.866628418170587035753719399566211498666255505244122593996591602841258328965767580089")) + a73= T(.4798896504144995747752495322905965199130404621990332488332634944254542060153074523509) + a74= T(1.379008574103741893192274821856872770756462643091360525934940067397245698027561293331) + a75= T(-3.290069515436080679901047585711363850115683290894936158531296799594813811049925401677) + a76= T(2.324710524099773982415355918398765796109060233222962411944060046314465391054716027841) + # b1 = T(.9468075576583945807478876255758922856117527357724631226139574065785592789071067303271e-1) + # b2 = T(.9183565540343253096776363936645313759813746240984095238905939532922955247253608687270e-2) + # b3 = T(.4877705284247615707855642599631228241516691959761363774365216240304071651579571959813) + # b4 = T(1.234297566930478985655109673884237654035539930748192848315425833500484878378061439761) + # b5 = T(-2.707712349983525454881109975059321670689605166938197378763992255714444407154902012702) + # b6 = T(1.866628418170587035753719399566211498666255505244122593996591602841258328965767580089) # b7 = T(1//66) - btilde1 = T(parse(BigFloat,"-1.780011052225771443378550607539534775944678804333659557637450799792588061629796e-03")) - btilde2 = T(parse(BigFloat,"-8.164344596567469032236360633546862401862537590159047610940604670770447527463931e-04")) - btilde3 = T(parse(BigFloat,"7.880878010261996010314727672526304238628733777103128603258129604952959142646516e-03")) - btilde4 = T(parse(BigFloat,"-1.44711007173262907537165147972635116720922712343167677619514233896760819649515e-01")) - btilde5 = T(parse(BigFloat,"5.823571654525552250199376106520421794260781239567387797673045438803694038950012e-01")) - btilde6 = T(parse(BigFloat,"-4.580821059291869466616365188325542974428047279788398179474684434732070620889539e-01")) + btilde1 = T(-1.780011052225771443378550607539534775944678804333659557637450799792588061629796e-03) + btilde2 = T(-8.164344596567469032236360633546862401862537590159047610940604670770447527463931e-04) + btilde3 = T(7.880878010261996010314727672526304238628733777103128603258129604952959142646516e-03) + btilde4 = T(-1.44711007173262907537165147972635116720922712343167677619514233896760819649515e-01) + btilde5 = T(5.823571654525552250199376106520421794260781239567387797673045438803694038950012e-01) + btilde6 = T(-4.580821059291869466616365188325542974428047279788398179474684434732070620889539e-01) btilde7 = T(1//66) r11,r12,r13,r14,r22,r23,r24,r32,r33,r34,r42,r43,r44,r52,r53,r54,r62,r63,r64,r72,r73,r74 = Tsit5Interp(T) @@ -703,30 +703,30 @@ simplifying assumption Ch. Tsitouras """ function Tsit5Interp(T::Type) - r11 = T(parse(BigFloat,"0.999999999999999974283372471559910888475488471328")) - r12 = T(parse(BigFloat,"-2.763706197274825911336735930481400260916070804192")) - r13 = T(parse(BigFloat,"2.91325546182191274375068099306808")) + r11 = T(0.999999999999999974283372471559910888475488471328) + r12 = T(-2.763706197274825911336735930481400260916070804192) + r13 = T(2.91325546182191274375068099306808) r14 = T(-1.0530884977290216) - r22 = T(parse(BigFloat,"0.13169999999999999727")) - r23 = T(parse(BigFloat,"-0.22339999999999999818")) + r22 = T(0.13169999999999999727) + r23 = T(-0.22339999999999999818) r24 = T(0.1017) - r32 = T(parse(BigFloat,"3.93029623689475152850687446709813398")) - r33 = T(parse(BigFloat,"-5.94103387213150473470249202589458001")) - r34 = T(parse(BigFloat,"2.490627285651252793")) + r32 = T(3.93029623689475152850687446709813398) + r33 = T(-5.94103387213150473470249202589458001) + r34 = T(2.490627285651252793) - r42 = T(parse(BigFloat,"-12.411077166933676983734381540685453484102414134010752")) - r43 = T(parse(BigFloat,"30.3381886302823215981729903691836576")) - r44 = T(parse(BigFloat,"-16.54810288924490272")) + r42 = T(-12.411077166933676983734381540685453484102414134010752) + r43 = T(30.3381886302823215981729903691836576) + r44 = T(-16.54810288924490272) - r52 = T(parse(BigFloat,"37.50931341651103919496903965334519631242339792120440212")) - r53 = T(parse(BigFloat,"-88.1789048947664011014276693541209817")) - r54 = T(parse(BigFloat,"47.37952196281928122")) + r52 = T(37.50931341651103919496903965334519631242339792120440212) + r53 = T(-88.1789048947664011014276693541209817) + r54 = T(47.37952196281928122) - r62 = T(parse(BigFloat,"-27.896526289197287805948263144598643896")) - r63 = T(parse(BigFloat,"65.09189467479367152629021928716553658")) - r64 = T(parse(BigFloat,"-34.87065786149660974")) + r62 = T(-27.896526289197287805948263144598643896) + r63 = T(65.09189467479367152629021928716553658) + r64 = T(-34.87065786149660974) r72 = T(1.5) r73 = T(-4) @@ -866,7 +866,7 @@ end An Efficient Runge-Kutta (4,5) Pair by P.Bogacki and L.F.Shampine Computers and Mathematics with Applications, Vol. 32, No. 6, 1996, pages 15 to 28 """ -Base.@pure function BS5ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function BS5ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} c1 =T2(0.16666666666666666) c2 =T2(0.2222222222222222) c3 =T2(0.42857142857142855) @@ -999,7 +999,7 @@ Used in the lazy construction of the dense output k9, k10, k11 are not computed until called in the dense routine """ -Base.@pure function BS5Interp{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function BS5Interp(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} c6 = T2(0.5) c7 = T2(0.8333333333333334) @@ -1092,7 +1092,7 @@ Note that RKSuite has an error: r081 should be 0 and r011 should be 1. This is pretty easy to spot since the first order interpolation is linear from y₀. """ -function BS5Interp_polyweights{T<:CompiledFloats}(::Type{T}) +function BS5Interp_polyweights(::Type{T}) where T<:CompiledFloats r016 = T(-11.547607240534195) r015 = T(36.89579791207878) r014 = T(-45.470343197183475) @@ -1269,7 +1269,7 @@ struct DP5ConstantCache{T,T2} <: OrdinaryDiffEqConstantCache d7::T end -Base.@pure function DP5ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function DP5ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} a21 = T(0.2) a31 = T(0.075) a32 = T(0.225) @@ -1312,7 +1312,7 @@ Base.@pure function DP5ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Typ DP5ConstantCache(a21,a31,a32,a41,a42,a43,a51,a52,a53,a54,a61,a62,a63,a64,a65,a71,a73,a74,a75,a76,btilde1,btilde3,btilde4,btilde5,btilde6,btilde7,c1,c2,c3,c4,c5,c6,d1,d3,d4,d5,d6,d7) end -Base.@pure function DP5_dense_ds{T<:CompiledFloats}(::Type{T}) +Base.@pure function DP5_dense_ds(::Type{T}) where T<:CompiledFloats d1 = T(-1.1270175653862835) d3 = T(2.675424484351598) d4 = T(-5.685526961588504) diff --git a/src/tableaus/rkn_tableaus.jl b/src/tableaus/rkn_tableaus.jl index 381566c50c..096449a423 100644 --- a/src/tableaus/rkn_tableaus.jl +++ b/src/tableaus/rkn_tableaus.jl @@ -9,7 +9,7 @@ struct IRKN3ConstantCache{T,T2} <: OrdinaryDiffEqConstantCache bbar2::T end -Base.@pure function IRKN3ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function IRKN3ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} bconst1 = T(1.5) bconst2 = T(-0.5) c1 = T2(0.5) @@ -49,7 +49,7 @@ struct IRKN4ConstantCache{T,T2} <: OrdinaryDiffEqConstantCache bbar3::T end -Base.@pure function IRKN4ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function IRKN4ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} bconst1 = T(1.5) bconst2 = T(-0.5) c1 = T2(0.25) @@ -101,7 +101,7 @@ struct Nystrom5VelocityIndependentConstantCache{T,T2} <: OrdinaryDiffEqConstantC b4::T end -function Nystrom5VelocityIndependentConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +function Nystrom5VelocityIndependentConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} c1 = T2(0.2) c2 = T2(0.6666666666666666) # c3 = T2(1) @@ -198,7 +198,7 @@ function ERKN4ConstantCache(T::Type,T2::Type) ERKN4ConstantCache(c1, c2, c3, a21, a31, a32, a41, a42, a43, b1, b2, b3, b4, bp1, bp2, bp3, bp4, btilde1, btilde2, btilde3, btilde4, bptilde1, bptilde2, bptilde3, bptilde4) end -Base.@pure function ERKN4ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function ERKN4ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} ERKN4ConstantCache( T2(0.25), T2(0.7), @@ -284,7 +284,7 @@ function ERKN5ConstantCache(T::Type,T2::Type) ERKN5ConstantCache(c1, c2, c3, a21, a31, a32, a41, a42, a43, b1, b2, b3, b4, bp1, bp2, bp3, bp4, btilde1, btilde2, btilde3, btilde4) end -Base.@pure function ERKN5ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function ERKN5ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} ERKN5ConstantCache( T2(0.5), T2(0.2714285714285714), @@ -398,7 +398,7 @@ struct DPRKN6ConstantCache{T,T2} <: OrdinaryDiffEqConstantCache rp61::T end -Base.@pure function DPRKN6ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function DPRKN6ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} c1 = T2(0.12929590313670442) c2 = T2(0.25859180627340883) c3 = T2(0.67029708261548) @@ -754,7 +754,7 @@ function DPRKN8ConstantCache(T::Type,T2::Type) DPRKN8ConstantCache(c1, c2, c3, c4, c5, c6, c7, c8, a21, a31, a32, a41, a42, a43, a51, a52, a53, a54, a61, a62, a63, a64, a65, a71, a72, a73, a74, a75, a76, a81, a82, a83, a84, a85, a86, a87, a91, a93, a94, a95, a96, a97, b1, b3, b4, b5, b6, b7, bp1, bp3, bp4, bp5, bp6, bp7, bp8, btilde1, btilde3, btilde4, btilde5, btilde6, btilde7, bptilde1, bptilde3, bptilde4, bptilde5, bptilde6, bptilde7, bptilde8, bptilde9) end -Base.@pure function DPRKN8ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function DPRKN8ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} DPRKN8ConstantCache( T2(0.05), T2(0.1), @@ -1292,7 +1292,7 @@ function DPRKN12ConstantCache(T::Type,T2::Type) DPRKN12ConstantCache(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, a21, a31, a32, a41, a42, a43, a51, a53, a54, a61, a63, a64, a65, a71, a73, a74, a75, a76, a81, a84, a85, a86, a87, a91, a93, a94, a95, a96, a97, a98, a101, a103, a104, a105, a106, a107, a108, a109, a111, a113, a114, a115, a116, a117, a118, a119, a1110, a121, a123, a124, a125, a126, a127, a128, a129, a1210, a1211, a131, a133, a134, a135, a136, a137, a138, a139, a1310, a1311, a1312, a141, a143, a144, a145, a146, a147, a148, a149, a1410, a1411, a1412, a1413, a151, a153, a154, a155, a156, a157, a158, a159, a1510, a1511, a1512, a1513, a1514, a161, a163, a164, a165, a166, a167, a168, a169, a1610, a1611, a1612, a1613, a1614, a1615, a171, a173, a174, a175, a176, a177, a178, a179, a1710, a1711, a1712, a1713, a1714, a1715, b1, b7, b8, b9, b10, b11, b12, b13, b14, b15, bp1, bp7, bp8, bp9, bp10, bp11, bp12, bp13, bp14, bp15, bp16, bp17, btilde1, btilde7, btilde8, btilde9, btilde10, btilde11, btilde12, btilde13, btilde14, btilde15, bptilde1, bptilde7, bptilde8, bptilde9, bptilde10, bptilde11, bptilde12, bptilde13, bptilde14, bptilde15, bptilde16, bptilde17) end -Base.@pure function DPRKN12ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function DPRKN12ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} DPRKN12ConstantCache( T2(2.0e-2), T2(4.0e-2), diff --git a/src/tableaus/sdirk_tableaus.jl b/src/tableaus/sdirk_tableaus.jl index 249ec0736c..1752f63ee8 100644 --- a/src/tableaus/sdirk_tableaus.jl +++ b/src/tableaus/sdirk_tableaus.jl @@ -185,7 +185,7 @@ dt = c2 ((1 + (-4θ + 3θ^2)) + (6θ*(1-θ)/c2)*γ) ((-2θ + 3θ^2) + (6θ*(1-θ)/c2)*γ) =# -Base.@pure function KenCarp3Tableau{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function KenCarp3Tableau(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} γ = T(0.435866521508459) a31 = T(0.2576482460664272) a32 = -T(0.09351476757488625) diff --git a/src/tableaus/symplectic_tableaus.jl b/src/tableaus/symplectic_tableaus.jl index ee80444424..e85678b88d 100644 --- a/src/tableaus/symplectic_tableaus.jl +++ b/src/tableaus/symplectic_tableaus.jl @@ -81,7 +81,7 @@ Base.@pure function CandyRoz4ConstantCache(T,T2) Symplectic4ConstantCache{T,T2}(a1,a2,a3,a4,b1,b2,b3,b4) end -Base.@pure function McAte4ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function McAte4ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} a1 =T( 0.515352837431122936) a2 =T(-0.085782019412973646) a3 =T( 0.441583023616466524) @@ -94,14 +94,14 @@ Base.@pure function McAte4ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(:: end Base.@pure function McAte4ConstantCache(T::Type,T2::Type) - a1 =T(parse(BigFloat,"0.515352837431122936")) - a2 =T(parse(BigFloat,"-0.085782019412973646")) - a3 =T(parse(BigFloat," 0.441583023616466524")) - a4 =T(parse(BigFloat," 0.128846158365384185")) - b1 =T(parse(BigFloat," 0.134496199277431089")) - b2 =T(parse(BigFloat,"-0.224819803079420806")) - b3 =T(parse(BigFloat," 0.756320000515668291")) - b4 =T(parse(BigFloat," 0.334003603286321425")) + a1 =T(0.515352837431122936) + a2 =T(-0.085782019412973646) + a3 =T( 0.441583023616466524) + a4 =T( 0.128846158365384185) + b1 =T( 0.134496199277431089) + b2 =T(-0.224819803079420806) + b3 =T( 0.756320000515668291) + b4 =T( 0.334003603286321425) Symplectic4ConstantCache{T,T2}(a1,a2,a3,a4,b1,b2,b3,b4) end @@ -135,7 +135,7 @@ end # Broken # http://epubs.siam.org/doi/pdf/10.1137/0916010 # On the numerical integration of ordinary differential equations by symmetric composition methods -Base.@pure function McAte42ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function McAte42ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} a1 =T(0.40518861839525227722) a2 =T(-0.28714404081652408900) a3 = 1 - 2a1 - 2a2 @@ -150,8 +150,8 @@ Base.@pure function McAte42ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(: end Base.@pure function McAte42ConstantCache(T::Type,T2::Type) - a1 =T(parse(BigFloat,"0.40518861839525227722")) - a2 =T(parse(BigFloat,"-0.28714404081652408900")) + a1 =T(0.40518861839525227722) + a2 =T(-0.28714404081652408900) a3 = 1 - 2a1 - 2a2 a4 = a2 a5 = a1 @@ -178,7 +178,7 @@ struct Symplectic5ConstantCache{T,T2} <: OrdinaryDiffEqConstantCache b6::T end -Base.@pure function McAte5ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function McAte5ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} a1=T(0.339839625839110000) a2=T(-0.088601336903027329) a3=T(0.5858564768259621188) @@ -195,18 +195,18 @@ Base.@pure function McAte5ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(:: end Base.@pure function McAte5ConstantCache(T::Type,T2::Type) - a1=T(parse(BigFloat,"0.339839625839110000")) - a2=T(parse(BigFloat,"-0.088601336903027329")) - a3=T(parse(BigFloat,"0.5858564768259621188")) - a4=T(parse(BigFloat,"-0.603039356536491888")) - a5=T(parse(BigFloat,"0.3235807965546976394")) - a6=T(parse(BigFloat,"0.4423637942197494587")) - b1=T(parse(BigFloat,"0.1193900292875672758")) - b2=T(parse(BigFloat,"0.6989273703824752308")) - b3=T(parse(BigFloat,"-0.1713123582716007754")) - b4=T(parse(BigFloat,"0.4012695022513534480")) - b5=T(parse(BigFloat,"0.0107050818482359840")) - b6=T(parse(BigFloat,"-0.0589796254980311632")) + a1=T(0.339839625839110000) + a2=T(-0.088601336903027329) + a3=T(0.5858564768259621188) + a4=T(-0.603039356536491888) + a5=T(0.3235807965546976394) + a6=T(0.4423637942197494587) + b1=T(0.1193900292875672758) + b2=T(0.6989273703824752308) + b3=T(-0.1713123582716007754) + b4=T(0.4012695022513534480) + b5=T(0.0107050818482359840) + b6=T(-0.0589796254980311632) Symplectic5ConstantCache{T,T2}(a1,a2,a3,a4,a5,a6,b1,b2,b3,b4,b5,b6) end @@ -272,7 +272,7 @@ struct Symplectic62ConstantCache{T,T2} <: OrdinaryDiffEqConstantCache b10::T end -Base.@pure function KahanLi6ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function KahanLi6ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} a1=T(0.39216144400731413927925056) a2=T(0.33259913678935943859974864) a3=T(-0.70624617255763935980996482) @@ -297,11 +297,11 @@ Base.@pure function KahanLi6ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}( end Base.@pure function KahanLi6ConstantCache(T::Type,T2::Type) - a1=T(parse(BigFloat,"0.39216144400731413927925056")) - a2=T(parse(BigFloat,"0.33259913678935943859974864")) - a3=T(parse(BigFloat,"-0.70624617255763935980996482")) - a4=T(parse(BigFloat,"0.08221359629355080023149045")) - a5=T(parse(BigFloat,"0.79854399093482996339895035")) + a1=T(0.39216144400731413927925056) + a2=T(0.33259913678935943859974864) + a3=T(-0.70624617255763935980996482) + a4=T(0.08221359629355080023149045) + a5=T(0.79854399093482996339895035) a6= a4 a7= a3 a8= a2 @@ -355,7 +355,7 @@ struct McAte8ConstantCache{T,T2} <: OrdinaryDiffEqConstantCache b16::T end -Base.@pure function McAte8ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function McAte8ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} a1=T(0.74167036435061295344822780) a2=T(-0.40910082580003159399730010) a3=T(0.19075471029623837995387626) @@ -393,14 +393,14 @@ Base.@pure function McAte8ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(:: end Base.@pure function McAte8ConstantCache(T::Type,T2::Type) - a1=T(parse(BigFloat,"0.74167036435061295344822780")) - a2=T(parse(BigFloat,"-0.40910082580003159399730010")) - a3=T(parse(BigFloat,"0.19075471029623837995387626")) - a4=T(parse(BigFloat,"-0.57386247111608226665638773")) - a5=T(parse(BigFloat,"0.29906418130365592384446354")) - a6=T(parse(BigFloat,"0.33462491824529818378495798")) - a7=T(parse(BigFloat,"0.31529309239676659663205666")) - a8=T(parse(BigFloat,"-0.79688793935291635401978884")) + a1=T(0.74167036435061295344822780) + a2=T(-0.40910082580003159399730010) + a3=T(0.19075471029623837995387626) + a4=T(-0.57386247111608226665638773) + a5=T(0.29906418130365592384446354) + a6=T(0.33462491824529818378495798) + a7=T(0.31529309239676659663205666) + a8=T(-0.79688793935291635401978884) a9=a7 a10=a6 a11=a5 @@ -468,7 +468,7 @@ struct KahanLi8ConstantCache{T,T2} <: OrdinaryDiffEqConstantCache b18::T end -Base.@pure function KahanLi8ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function KahanLi8ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} a1=T(0.13020248308889008087881763) a2=T(0.56116298177510838456196441) a3=T(-0.38947496264484728640807860) @@ -510,15 +510,15 @@ Base.@pure function KahanLi8ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}( end Base.@pure function KahanLi8ConstantCache(T::Type,T2::Type) - a1=T(parse(BigFlaot,"0.13020248308889008087881763")) - a2=T(parse(BigFlaot,"0.56116298177510838456196441")) - a3=T(parse(BigFlaot,"-0.38947496264484728640807860")) - a4=T(parse(BigFlaot,"0.15884190655515560089621075")) - a5=T(parse(BigFlaot,"-0.39590389413323757733623154")) - a6=T(parse(BigFlaot,"0.18453964097831570709183254")) - a7=T(parse(BigFlaot,"0.25837438768632204729397911")) - a8=T(parse(BigFlaot,"0.29501172360931029887096624")) - a9=T(parse(BigFlaot,"-0.60550853383003451169892108")) + a1=T(0.13020248308889008087881763) + a2=T(0.56116298177510838456196441) + a3=T(-0.38947496264484728640807860) + a4=T(0.15884190655515560089621075) + a5=T(-0.39590389413323757733623154) + a6=T(0.18453964097831570709183254) + a7=T(0.25837438768632204729397911) + a8=T(0.29501172360931029887096624) + a9=T(-0.60550853383003451169892108) a10=a8 a11=a7 a12=a6 @@ -625,7 +625,7 @@ struct SofSpa10ConstantCache{T,T2} <: OrdinaryDiffEqConstantCache b36::T end -Base.@pure function SofSpa10ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function SofSpa10ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} a1=T(0.07879572252168641926390768) a2=T(0.31309610341510852776481247) a3=T(0.02791838323507806610952027) @@ -707,24 +707,24 @@ Base.@pure function SofSpa10ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}( end Base.@pure function SofSpa10ConstantCache(T::Type,T2::Type) - a1=T(parse(BigFloat,"0.07879572252168641926390768")) - a2=T(parse(BigFloat,"0.31309610341510852776481247")) - a3=T(parse(BigFloat,"0.02791838323507806610952027")) - a4=T(parse(BigFloat,"-0.22959284159390709415121340")) - a5=T(parse(BigFloat,"0.13096206107716486317465686")) - a6=T(parse(BigFloat,"-0.26973340565451071434460973")) - a7=T(parse(BigFloat,"0.07497334315589143566613711")) - a8=T(parse(BigFloat,"0.11199342399981020488957508")) - a9=T(parse(BigFloat,"0.36613344954622675119314812")) - a10=T(parse(BigFloat,"-0.39910563013603589787862981")) - a11=T(parse(BigFloat,"0.10308739852747107731580277")) - a12=T(parse(BigFloat,"0.41143087395589023782070412")) - a13=T(parse(BigFloat,"-0.00486636058313526176219566")) - a14=T(parse(BigFloat,"-0.39203335370863990644808194")) - a15=T(parse(BigFloat,"0.05194250296244964703718290")) - a16=T(parse(BigFloat,"0.05066509075992449633587434")) - a17=T(parse(BigFloat,"0.04967437063972987905456880")) - a18=T(parse(BigFloat,"0.04931773575959453791768001")) + a1=T(0.07879572252168641926390768) + a2=T(0.31309610341510852776481247) + a3=T(0.02791838323507806610952027) + a4=T(-0.22959284159390709415121340) + a5=T(0.13096206107716486317465686) + a6=T(-0.26973340565451071434460973) + a7=T(0.07497334315589143566613711) + a8=T(0.11199342399981020488957508) + a9=T(0.36613344954622675119314812) + a10=T(-0.39910563013603589787862981) + a11=T(0.10308739852747107731580277) + a12=T(0.41143087395589023782070412) + a13=T(-0.00486636058313526176219566) + a14=T(-0.39203335370863990644808194) + a15=T(0.05194250296244964703718290) + a16=T(0.05066509075992449633587434) + a17=T(0.04967437063972987905456880) + a18=T(0.04931773575959453791768001) a19=a17 a20=a16 a21=a15 diff --git a/src/tableaus/verner_tableaus.jl b/src/tableaus/verner_tableaus.jl index a8a6ce42f9..e2ffefe63b 100644 --- a/src/tableaus/verner_tableaus.jl +++ b/src/tableaus/verner_tableaus.jl @@ -129,7 +129,7 @@ end From Verner's Website """ -Base.@pure function Vern6ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function Vern6ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} c1 =T2(0.06) c2 =T2(0.09593333333333333) c3 =T2(0.1439) @@ -243,7 +243,7 @@ function Vern6ConstantCache(T::Type,T2::Type) Vern6ConstantCache(c1,c2,c3,c4,c5,c6,a21,a31,a32,a41,a43,a51,a53,a54,a61,a63,a64,a65,a71,a73,a74,a75,a76,a81,a83,a84,a85,a86,a87,a91,a94,a95,a96,a97,a98,btilde1,btilde4,btilde5,btilde6,btilde7,btilde8,btilde9,c10,a1001,a1004,a1005,a1006,a1007,a1008,a1009,c11,a1101,a1102,a1103,a1104,a1105,a1106,a1107,a1108,a1109,a1110,c12,a1201,a1202,a1203,a1204,a1205,a1206,a1207,a1208,a1209,a1210,a1211,r011,r012,r013,r014,r015,r016,r042,r043,r044,r045,r046,r052,r053,r054,r055,r056,r062,r063,r064,r065,r066,r072,r073,r074,r075,r076,r082,r083,r084,r085,r086,r092,r093,r094,r095,r096,r102,r103,r104,r105,r106,r112,r113,r114,r115,r116,r122,r123,r124,r125,r126) end -Base.@pure function Vern6Interp{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function Vern6Interp(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} # Extra stages for Order 5 c10 = T2(0.5) a1001 = T(0.016524159013572806) @@ -321,7 +321,7 @@ end Coefficients for the polynomial bᵢΘ = ri1*Θ + ri2*Θ^2 + ri3*Θ^3 + ... """ -Base.@pure function Vern6Interp_polyweights{T<:CompiledFloats}(::Type{T}) +Base.@pure function Vern6Interp_polyweights(::Type{T}) where T<:CompiledFloats r011 = T(1) r012 = T(-7.778593856495576) r013 = T(27.0524385722671) @@ -635,7 +635,7 @@ struct Vern7ConstantCache{T,T2} <: OrdinaryDiffEqConstantCache r167::T end -Base.@pure function Vern7ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function Vern7ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} c2 = T2(0.005) c3 = T2(0.10888888888888888) c4 = T2(0.16333333333333333) @@ -775,7 +775,7 @@ function Vern7ConstantCache(T::Type,T2::Type) Vern7ConstantCache(c2,c3,c4,c5,c6,c7,c8,a021,a031,a032,a041,a043,a051,a053,a054,a061,a063,a064,a065,a071,a073,a074,a075,a076,a081,a083,a084,a085,a086,a087,a091,a093,a094,a095,a096,a097,a098,a101,a103,a104,a105,a106,a107,b1,b4,b5,b6,b7,b8,b9,btilde1,btilde4,btilde5,btilde6,btilde7,btilde8,btilde9,btilde10,c11,a1101,a1104,a1105,a1106,a1107,a1108,a1109,c12,a1201,a1204,a1205,a1206,a1207,a1208,a1209,a1211,c13,a1301,a1304,a1305,a1306,a1307,a1308,a1309,a1311,a1312,c14,a1401,a1404,a1405,a1406,a1407,a1408,a1409,a1411,a1412,a1413,c15,a1501,a1504,a1505,a1506,a1507,a1508,a1509,a1511,a1512,a1513,c16,a1601,a1604,a1605,a1606,a1607,a1608,a1609,a1611,a1612,a1613,r011,r012,r013,r014,r015,r016,r017,r042,r043,r044,r045,r046,r047,r052,r053,r054,r055,r056,r057,r062,r063,r064,r065,r066,r067,r072,r073,r074,r075,r076,r077,r082,r083,r084,r085,r086,r087,r092,r093,r094,r095,r096,r097,r112,r113,r114,r115,r116,r117,r122,r123,r124,r125,r126,r127,r132,r133,r134,r135,r136,r137,r142,r143,r144,r145,r146,r147,r152,r153,r154,r155,r156,r157,r162,r163,r164,r165,r166,r167) end -Base.@pure function Vern7Interp{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function Vern7Interp(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} c11 = T2(1) a1101 = T(0.04715561848627222) a1104 = T(0.25750564298434153) @@ -841,69 +841,69 @@ end function Vern7Interp(T::Type,T2::Type) c11 = T2(1) - a1101 = T(parse(BigFloat," .4715561848627222170431765108838175679569e-1")) - a1104 = T(parse(BigFloat," .2575056429843415189596436101037687580986")) - a1105 = T(parse(BigFloat," .2621665397741262047713863095764527711129")) - a1106 = T(parse(BigFloat," .1521609265673855740323133199165117535523")) - a1107 = T(parse(BigFloat," .4939969170032484246907175893227876844296")) - a1108 = T(parse(BigFloat,"-.2943031171403250441557244744092703429139")) - a1109 = T(parse(BigFloat," .8131747232495109999734599440136761892478e-1")) + a1101 = T( .4715561848627222170431765108838175679569e-1) + a1104 = T( .2575056429843415189596436101037687580986) + a1105 = T( .2621665397741262047713863095764527711129) + a1106 = T( .1521609265673855740323133199165117535523) + a1107 = T( .4939969170032484246907175893227876844296) + a1108 = T(-.2943031171403250441557244744092703429139) + a1109 = T( .8131747232495109999734599440136761892478e-1) c12 = T2(29//100) - a1201 = T(parse(BigFloat," .5232227691599689815470932256735029887614e-1")) - a1204 = T(parse(BigFloat," .2249586182670571550244187743667190903405")) - a1205 = T(parse(BigFloat," .1744370924877637539031751304611402542578e-1")) - a1206 = T(parse(BigFloat,"-.7669379876829393188009028209348812321417e-2")) - a1207 = T(parse(BigFloat," .3435896044073284645684381456417912794447e-1")) - a1208 = T(parse(BigFloat,"-.4102097230093949839125144540100346681769e-1")) - a1209 = T(parse(BigFloat," .2565113300520561655297104906598973655221e-1")) - a1211 = T(parse(BigFloat,"-.160443457e-1")) + a1201 = T( .5232227691599689815470932256735029887614e-1) + a1204 = T( .2249586182670571550244187743667190903405) + a1205 = T( .1744370924877637539031751304611402542578e-1) + a1206 = T(-.7669379876829393188009028209348812321417e-2) + a1207 = T( .3435896044073284645684381456417912794447e-1) + a1208 = T(-.4102097230093949839125144540100346681769e-1) + a1209 = T( .2565113300520561655297104906598973655221e-1) + a1211 = T(-.160443457e-1) c13 = T2(1//8) - a1301 = T(parse(BigFloat," .5305334125785908638834747243817578898946e-1")) - a1304 = T(parse(BigFloat," .1219530101140188607092225622195251463666")) - a1305 = T(parse(BigFloat," .1774684073760249704011573985936092552347e-1")) - a1306 = T(parse(BigFloat,"-.5928372667681494328907467430302313286925e-3")) - a1307 = T(parse(BigFloat," .8381833970853750873624781948796072714855e-2")) - a1308 = T(parse(BigFloat,"-.1293369259698611956700998079778496462996e-1")) - a1309 = T(parse(BigFloat," .9412056815253860804791356641605087829772e-2")) - a1311 = T(parse(BigFloat,"-.5353253107275676032399320754008272222345e-2")) - a1312 = T(parse(BigFloat,"-.6666729992455811078380186481263955324311e-1")) + a1301 = T( .5305334125785908638834747243817578898946e-1) + a1304 = T( .1219530101140188607092225622195251463666) + a1305 = T( .1774684073760249704011573985936092552347e-1) + a1306 = T(-.5928372667681494328907467430302313286925e-3) + a1307 = T( .8381833970853750873624781948796072714855e-2) + a1308 = T(-.1293369259698611956700998079778496462996e-1) + a1309 = T( .9412056815253860804791356641605087829772e-2) + a1311 = T(-.5353253107275676032399320754008272222345e-2) + a1312 = T(-.6666729992455811078380186481263955324311e-1) c14 = T2(1//4) - a1401 = T(parse(BigFloat," .3887903257436303686399931060834951327899e-1")) - a1404 = T(parse(BigFloat,"-.2440320330830131517910045090190069290791e-2")) - a1405 = T(parse(BigFloat,"-.1392891721467262281273220992320214734208e-2")) - a1406 = T(parse(BigFloat,"-.4744629155868013465038358934145339168472e-3")) - a1407 = T(parse(BigFloat," .3920793241315951369383517310870803393356e-3")) - a1408 = T(parse(BigFloat,"-.4055473328512800136385880031750264996936e-3")) - a1409 = T(parse(BigFloat," .1989709314771672628794304728258886009267e-3")) - a1411 = T(parse(BigFloat,"-.1027819879317916884712606136811051029682e-3")) - a1412 = T(parse(BigFloat," .3385661513870266715302548402957613704604e-1")) - a1413 = T(parse(BigFloat," .1814893063199928004309543737509423302792")) + a1401 = T( .3887903257436303686399931060834951327899e-1) + a1404 = T(-.2440320330830131517910045090190069290791e-2) + a1405 = T(-.1392891721467262281273220992320214734208e-2) + a1406 = T(-.4744629155868013465038358934145339168472e-3) + a1407 = T( .3920793241315951369383517310870803393356e-3) + a1408 = T(-.4055473328512800136385880031750264996936e-3) + a1409 = T( .1989709314771672628794304728258886009267e-3) + a1411 = T(-.1027819879317916884712606136811051029682e-3) + a1412 = T( .3385661513870266715302548402957613704604e-1) + a1413 = T( .1814893063199928004309543737509423302792) c15 = T2(53//100) - a1501 = T(parse(BigFloat," .5723681204690012909606837582140921695189e-1")) - a1504 = T(parse(BigFloat," .2226594806676118099285816235023183680020")) - a1505 = T(parse(BigFloat," .1234486420018689904911221497830317287757")) - a1506 = T(parse(BigFloat," .4006332526666490875113688731927762275433e-1")) - a1507 = T(parse(BigFloat,"-.5269894848581452066926326838943832327366e-1")) - a1508 = T(parse(BigFloat," .4765971214244522856887315416093212596338e-1")) - a1509 = T(parse(BigFloat,"-.2138895885042213036387863538386958914368e-1")) - a1511 = T(parse(BigFloat," .1519389106403640165459624646184297766866e-1")) - a1512 = T(parse(BigFloat," .1206054671628965554251364472502413614358")) - a1513 = T(parse(BigFloat,"-.2277942301618737288237298052574548913451e-1")) + a1501 = T( .5723681204690012909606837582140921695189e-1) + a1504 = T( .2226594806676118099285816235023183680020) + a1505 = T( .1234486420018689904911221497830317287757) + a1506 = T( .4006332526666490875113688731927762275433e-1) + a1507 = T(-.5269894848581452066926326838943832327366e-1) + a1508 = T( .4765971214244522856887315416093212596338e-1) + a1509 = T(-.2138895885042213036387863538386958914368e-1) + a1511 = T( .1519389106403640165459624646184297766866e-1) + a1512 = T( .1206054671628965554251364472502413614358) + a1513 = T(-.2277942301618737288237298052574548913451e-1) c16 = T2(79//100) - a1601 = T(parse(BigFloat," .5137203880275681426595607279552927584506e-1")) - a1604 = T(parse(BigFloat," .5414214473439405582401399378307410450482")) - a1605 = T(parse(BigFloat," .3503998066921840081154745647747846804810")) - a1606 = T(parse(BigFloat," .1419311226969218216861835872156617148040")) - a1607 = T(parse(BigFloat," .1052737747842942254816302629823570359198")) - a1608 = T(parse(BigFloat,"-.3108184780587401700842726199589213259835e-1")) - a1609 = T(parse(BigFloat,"-.7401883149519145061791854716430279714483e-2")) - a1611 = T(parse(BigFloat,"-.6377932504865363437569726480040013149706e-2")) - a1612 = T(parse(BigFloat,"-.1732549590836186403386348310205265959935")) - a1613 = T(parse(BigFloat,"-.1822815677762202619429607513861847306420")) + a1601 = T( .5137203880275681426595607279552927584506e-1) + a1604 = T( .5414214473439405582401399378307410450482) + a1605 = T( .3503998066921840081154745647747846804810) + a1606 = T( .1419311226969218216861835872156617148040) + a1607 = T( .1052737747842942254816302629823570359198) + a1608 = T(-.3108184780587401700842726199589213259835e-1) + a1609 = T(-.7401883149519145061791854716430279714483e-2) + a1611 = T(-.6377932504865363437569726480040013149706e-2) + a1612 = T(-.1732549590836186403386348310205265959935) + a1613 = T(-.1822815677762202619429607513861847306420) return c11,a1101,a1104,a1105,a1106,a1107,a1108,a1109,c12,a1201,a1204,a1205,a1206,a1207,a1208,a1209,a1211,c13,a1301,a1304,a1305,a1306,a1307,a1308,a1309,a1311,a1312,c14,a1401,a1404,a1405,a1406,a1407,a1408,a1409,a1411,a1412,a1413,c15,a1501,a1504,a1505,a1506,a1507,a1508,a1509,a1511,a1512,a1513,c16,a1601,a1604,a1605,a1606,a1607,a1608,a1609,a1611,a1612,a1613 end -Base.@pure function Vern7Interp_polyweights{T<:CompiledFloats}(::Type{T}) +Base.@pure function Vern7Interp_polyweights(::Type{T}) where T<:CompiledFloats r011 = T(1) r012 = T(-8.413387198332767) r013 = T(33.675508884490895) @@ -987,85 +987,85 @@ Base.@pure function Vern7Interp_polyweights{T<:CompiledFloats}(::Type{T}) end function Vern7Interp_polyweights(T::Type) - r011 = T(parse(BigFloat," 1")) - r012 = T(parse(BigFloat,"-8.413387198332767469319987751201351965810")) - r013 = T(parse(BigFloat," 33.67550888449089654479469983556967202215")) - r014 = T(parse(BigFloat,"-70.80159089484886164618905961010838757357")) - r015 = T(parse(BigFloat," 80.64695108301297872968868805293298389704")) - r016 = T(parse(BigFloat,"-47.19413969837521580145883430419406103536")) - r017 = T(parse(BigFloat," 11.13381344253924186418881142808952641234")) - r042 = T(parse(BigFloat," 8.754921980674397160629587282876763437696")) - r043 = T(parse(BigFloat,"-88.45968286997709426134300934922618655402")) - r044 = T(parse(BigFloat," 346.9017638429916309499891288356321692825")) - r045 = T(parse(BigFloat,"-629.2580030059837046812187141184986252218")) - r046 = T(parse(BigFloat," 529.6773755604192983874116479833480529304")) - r047 = T(parse(BigFloat,"-167.3588698651401860365089970240284051167")) - r052 = T(parse(BigFloat," 8.913387586637921662996190126913331844214")) - r053 = T(parse(BigFloat,"-90.06081846893217794712014609702916991513")) - r054 = T(parse(BigFloat," 353.1807459217057824951538014683541349020")) - r055 = T(parse(BigFloat,"-640.6476819744374433668701027882567716886")) - r056 = T(parse(BigFloat," 539.2646279047155261551781390920363285084")) - r057 = T(parse(BigFloat,"-170.3880944299154827945664954924414008798")) - r062 = T(parse(BigFloat," 5.173312029847800338889849068990984974299")) - r063 = T(parse(BigFloat,"-52.27111590005538823385270070373176751689")) - r064 = T(parse(BigFloat," 204.9853867374073094711024260808085419491")) - r065 = T(parse(BigFloat,"-371.8306118563602890875634623992262437796")) - r066 = T(parse(BigFloat," 312.9880934374529000210073972654145891826")) - r067 = T(parse(BigFloat,"-98.89290352172494693555119599233959305606")) - r072 = T(parse(BigFloat," 16.79537744079695986364946329034055578253")) - r073 = T(parse(BigFloat,"-169.7004000005972744435739149730966805754")) - r074 = T(parse(BigFloat," 665.4937727009246303131700313781960584913")) - r075 = T(parse(BigFloat,"-1207.163889233600728395392916633015853882")) - r076 = T(parse(BigFloat," 1016.129151581854603280159105697386989470")) - r077 = T(parse(BigFloat,"-321.0600155723749421933210511704882816019")) - r082 = T(parse(BigFloat,"-10.00599753609866476866352971232058330270")) - r083 = T(parse(BigFloat," 101.1005433052275068199636113246449312792")) - r084 = T(parse(BigFloat,"-396.4739151237843754958939772727577263768")) - r085 = T(parse(BigFloat," 719.1787707014182914108130834128646525498")) - r086 = T(parse(BigFloat,"-605.3681033918824350795711030652978269725")) - r087 = T(parse(BigFloat," 191.2743989279793520691961908384572824802")) - r092 = T(parse(BigFloat," 2.764708833638599139713222853969606774131")) - r093 = T(parse(BigFloat,"-27.93460263739046178114640484830267988046")) - r094 = T(parse(BigFloat," 109.5477918613789217803046856340175757800")) - r095 = T(parse(BigFloat,"-198.7128113064482116421691972646370773711")) - r096 = T(parse(BigFloat," 167.2663357164031670694252647113936863857")) - r097 = T(parse(BigFloat,"-52.85010499525706346613022509203974406942")) - r112 = T(parse(BigFloat,"-2.169632028016350481156919876642428429100")) - r113 = T(parse(BigFloat," 22.01669603756987625585768587320929912766")) - r114 = T(parse(BigFloat,"-86.90152427798948350846176288615482496306")) - r115 = T(parse(BigFloat," 159.2238897386147443720253338471077193471")) - r116 = T(parse(BigFloat,"-135.9618306534587908363115231453760181702")) - r117 = T(parse(BigFloat," 43.79240118328000419804718618785625308759")) - r122 = T(parse(BigFloat,"-4.890070188793803933769786966428026149549")) - r123 = T(parse(BigFloat," 22.75407737425176120799532459991506803585")) - r124 = T(parse(BigFloat,"-30.78034218537730965082079824005797506535")) - r125 = T(parse(BigFloat,"-2.797194317207249021142015125037024035537")) - r126 = T(parse(BigFloat," 31.36945663750840183161406140272783187147")) - r127 = T(parse(BigFloat,"-15.65592732038180043387678567111987465689")) - r132 = T(parse(BigFloat," 10.86217092955196715517224349929627754387")) - r133 = T(parse(BigFloat,"-50.54297141782710697188187875653305700081")) - r134 = T(parse(BigFloat," 68.37148040407511827604242008548181691494")) - r135 = T(parse(BigFloat," 6.213326521632409162585500428935637861213")) - r136 = T(parse(BigFloat,"-69.68006323194158104163196358466588618336")) - r137 = T(parse(BigFloat," 34.77605679450919341971367832748521086414")) - r142 = T(parse(BigFloat,"-11.37286691922922915922346687401389055763")) - r143 = T(parse(BigFloat," 130.7905807824671644130452602841032046030")) - r144 = T(parse(BigFloat,"-488.6511367778560207543260583489312609826")) - r145 = T(parse(BigFloat," 832.2148793276440873476229585070779183432")) - r146 = T(parse(BigFloat,"-664.7743368554426242883314487337054193624")) - r147 = T(parse(BigFloat," 201.7928804424166224412127551654694479565")) - r152 = T(parse(BigFloat,"-5.919778732715006698693070786679427540601")) - r153 = T(parse(BigFloat," 63.27679965889218829298274978013773800731")) - r154 = T(parse(BigFloat,"-265.4326820887379575820873554556433306580")) - r155 = T(parse(BigFloat," 520.1009254140610824835871087519714692468")) - r156 = T(parse(BigFloat,"-467.4121095339020118993777963241667608460")) - r157 = T(parse(BigFloat," 155.3868452824017054035883640343803117904")) - r162 = T(parse(BigFloat,"-10.49214619796182281022379415510181241136")) - r163 = T(parse(BigFloat," 105.3553852518801101042787230303396283676")) - r164 = T(parse(BigFloat,"-409.4397501198893846479834816688367917005")) - r165 = T(parse(BigFloat," 732.8314489076540326880337353277812147333")) - r166 = T(parse(BigFloat,"-606.3044574733512377981129469949015057785")) - r167 = T(parse(BigFloat," 188.0495196316683024640077644607192667895")) + r011 = T( 1) + r012 = T(-8.413387198332767469319987751201351965810) + r013 = T( 33.67550888449089654479469983556967202215) + r014 = T(-70.80159089484886164618905961010838757357) + r015 = T( 80.64695108301297872968868805293298389704) + r016 = T(-47.19413969837521580145883430419406103536) + r017 = T( 11.13381344253924186418881142808952641234) + r042 = T( 8.754921980674397160629587282876763437696) + r043 = T(-88.45968286997709426134300934922618655402) + r044 = T( 346.9017638429916309499891288356321692825) + r045 = T(-629.2580030059837046812187141184986252218) + r046 = T( 529.6773755604192983874116479833480529304) + r047 = T(-167.3588698651401860365089970240284051167) + r052 = T( 8.913387586637921662996190126913331844214) + r053 = T(-90.06081846893217794712014609702916991513) + r054 = T( 353.1807459217057824951538014683541349020) + r055 = T(-640.6476819744374433668701027882567716886) + r056 = T( 539.2646279047155261551781390920363285084) + r057 = T(-170.3880944299154827945664954924414008798) + r062 = T( 5.173312029847800338889849068990984974299) + r063 = T(-52.27111590005538823385270070373176751689) + r064 = T( 204.9853867374073094711024260808085419491) + r065 = T(-371.8306118563602890875634623992262437796) + r066 = T( 312.9880934374529000210073972654145891826) + r067 = T(-98.89290352172494693555119599233959305606) + r072 = T( 16.79537744079695986364946329034055578253) + r073 = T(-169.7004000005972744435739149730966805754) + r074 = T( 665.4937727009246303131700313781960584913) + r075 = T(-1207.163889233600728395392916633015853882) + r076 = T( 1016.129151581854603280159105697386989470) + r077 = T(-321.0600155723749421933210511704882816019) + r082 = T(-10.00599753609866476866352971232058330270) + r083 = T( 101.1005433052275068199636113246449312792) + r084 = T(-396.4739151237843754958939772727577263768) + r085 = T( 719.1787707014182914108130834128646525498) + r086 = T(-605.3681033918824350795711030652978269725) + r087 = T( 191.2743989279793520691961908384572824802) + r092 = T( 2.764708833638599139713222853969606774131) + r093 = T(-27.93460263739046178114640484830267988046) + r094 = T( 109.5477918613789217803046856340175757800) + r095 = T(-198.7128113064482116421691972646370773711) + r096 = T( 167.2663357164031670694252647113936863857) + r097 = T(-52.85010499525706346613022509203974406942) + r112 = T(-2.169632028016350481156919876642428429100) + r113 = T( 22.01669603756987625585768587320929912766) + r114 = T(-86.90152427798948350846176288615482496306) + r115 = T( 159.2238897386147443720253338471077193471) + r116 = T(-135.9618306534587908363115231453760181702) + r117 = T( 43.79240118328000419804718618785625308759) + r122 = T(-4.890070188793803933769786966428026149549) + r123 = T( 22.75407737425176120799532459991506803585) + r124 = T(-30.78034218537730965082079824005797506535) + r125 = T(-2.797194317207249021142015125037024035537) + r126 = T( 31.36945663750840183161406140272783187147) + r127 = T(-15.65592732038180043387678567111987465689) + r132 = T( 10.86217092955196715517224349929627754387) + r133 = T(-50.54297141782710697188187875653305700081) + r134 = T( 68.37148040407511827604242008548181691494) + r135 = T( 6.213326521632409162585500428935637861213) + r136 = T(-69.68006323194158104163196358466588618336) + r137 = T( 34.77605679450919341971367832748521086414) + r142 = T(-11.37286691922922915922346687401389055763) + r143 = T( 130.7905807824671644130452602841032046030) + r144 = T(-488.6511367778560207543260583489312609826) + r145 = T( 832.2148793276440873476229585070779183432) + r146 = T(-664.7743368554426242883314487337054193624) + r147 = T( 201.7928804424166224412127551654694479565) + r152 = T(-5.919778732715006698693070786679427540601) + r153 = T( 63.27679965889218829298274978013773800731) + r154 = T(-265.4326820887379575820873554556433306580) + r155 = T( 520.1009254140610824835871087519714692468) + r156 = T(-467.4121095339020118993777963241667608460) + r157 = T( 155.3868452824017054035883640343803117904) + r162 = T(-10.49214619796182281022379415510181241136) + r163 = T( 105.3553852518801101042787230303396283676) + r164 = T(-409.4397501198893846479834816688367917005) + r165 = T( 732.8314489076540326880337353277812147333) + r166 = T(-606.3044574733512377981129469949015057785) + r167 = T( 188.0495196316683024640077644607192667895) return r011,r012,r013,r014,r015,r016,r017,r042,r043,r044,r045,r046,r047,r052,r053,r054,r055,r056,r057,r062,r063,r064,r065,r066,r067,r072,r073,r074,r075,r076,r077,r082,r083,r084,r085,r086,r087,r092,r093,r094,r095,r096,r097,r112,r113,r114,r115,r116,r117,r122,r123,r124,r125,r126,r127,r132,r133,r134,r135,r136,r137,r142,r143,r144,r145,r146,r147,r152,r153,r154,r155,r156,r157,r162,r163,r164,r165,r166,r167 end @@ -1364,7 +1364,7 @@ struct Vern8ConstantCache{T,T2} <: OrdinaryDiffEqConstantCache r218::T end -Base.@pure function Vern8ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function Vern8ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} c2 = T2(0.05) c3 = T2(0.1065625) c4 = T2(0.15984375) @@ -1564,7 +1564,7 @@ function Vern8ConstantCache(T::Type,T2::Type) Vern8ConstantCache(c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,a0201,a0301,a0302,a0401,a0403,a0501,a0503,a0504,a0601,a0604,a0605,a0701,a0704,a0705,a0706,a0801,a0804,a0805,a0806,a0807,a0901,a0904,a0905,a0906,a0907,a0908,a1001,a1004,a1005,a1006,a1007,a1008,a1009,a1101,a1104,a1105,a1106,a1107,a1108,a1109,a1110,a1201,a1204,a1205,a1206,a1207,a1208,a1209,a1210,a1211,a1301,a1304,a1305,a1306,a1307,a1308,a1309,a1310,b1,b6,b7,b8,b9,b10,b11,b12,btilde1,btilde6,btilde7,btilde8,btilde9,btilde10,btilde11,btilde12,btilde13,c14,a1401,a1406,a1407,a1408,a1409,a1410,a1411,a1412,c15,a1501,a1506,a1507,a1508,a1509,a1510,a1511,a1512,a1514,c16,a1601,a1606,a1607,a1608,a1609,a1610,a1611,a1612,a1614,a1615,c17,a1701,a1706,a1707,a1708,a1709,a1710,a1711,a1712,a1714,a1715,a1716,c18,a1801,a1806,a1807,a1808,a1809,a1810,a1811,a1812,a1814,a1815,a1816,a1817,c19,a1901,a1906,a1907,a1908,a1909,a1910,a1911,a1912,a1914,a1915,a1916,a1917,c20,a2001,a2006,a2007,a2008,a2009,a2010,a2011,a2012,a2014,a2015,a2016,a2017,c21,a2101,a2106,a2107,a2108,a2109,a2110,a2111,a2112,a2114,a2115,a2116,a2117,r011,r012,r013,r014,r015,r016,r017,r018,r062,r063,r064,r065,r066,r067,r068,r072,r073,r074,r075,r076,r077,r078,r082,r083,r084,r085,r086,r087,r088,r092,r093,r094,r095,r096,r097,r098,r102,r103,r104,r105,r106,r107,r108,r112,r113,r114,r115,r116,r117,r118,r122,r123,r124,r125,r126,r127,r128,r142,r143,r144,r145,r146,r147,r148,r152,r153,r154,r155,r156,r157,r158,r162,r163,r164,r165,r166,r167,r168,r172,r173,r174,r175,r176,r177,r178,r182,r183,r184,r185,r186,r187,r188,r192,r193,r194,r195,r196,r197,r198,r202,r203,r204,r205,r206,r207,r208,r212,r213,r214,r215,r216,r217,r218) end -function Vern8Interp{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +function Vern8Interp(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} c14 = T2(1) a1401 = T(0.04427989419007951) a1406 = T(0.3541049391724449) @@ -1664,103 +1664,103 @@ end function Vern8Interp(T::Type,T2::Type) c14 = T2(1) - a1401 = T(parse(BigFloat," .4427989419007951074716746668098518862111e-1")) - a1406 = T(parse(BigFloat," .3541049391724448744815552028733568354121")) - a1407 = T(parse(BigFloat," .2479692154956437828667629415370663023884")) - a1408 = T(parse(BigFloat,"-15.69420203883808405099207034271191213468")) - a1409 = T(parse(BigFloat," 25.08406496555856261343930031237186278518")) - a1410 = T(parse(BigFloat,"-31.73836778626027646833156112007297739997")) - a1411 = T(parse(BigFloat," 22.93828327398878395231483560344797018313")) - a1412 = T(parse(BigFloat,"-.2361324633071542145259900641263517600737")) - c15 = T2(parse(BigFloat," .3110177634953863863927417318829099695921")) - a1501 = T(parse(BigFloat," .4620700646754963101730413150238116432863e-1")) - a1506 = T(parse(BigFloat," .4503904160842480866828520384400679697151e-1")) - a1507 = T(parse(BigFloat," .2336816697713424410788701065340221126565")) - a1508 = T(parse(BigFloat," 37.83901368421067410780338220861855254153")) - a1509 = T(parse(BigFloat,"-15.94911328945424610266139490307397370835")) - a1510 = T(parse(BigFloat," 23.02836835181610285142510596329590091940")) - a1511 = T(parse(BigFloat,"-44.85578507769412524816130998016948002745")) - a1512 = T(parse(BigFloat,"-.6379858768647444009509067402330140781326e-1")) - a1514 = T(parse(BigFloat,"-.1259503554386166268241032464519842162533e-1")) + a1401 = T( .4427989419007951074716746668098518862111e-1) + a1406 = T( .3541049391724448744815552028733568354121) + a1407 = T( .2479692154956437828667629415370663023884) + a1408 = T(-15.69420203883808405099207034271191213468) + a1409 = T( 25.08406496555856261343930031237186278518) + a1410 = T(-31.73836778626027646833156112007297739997) + a1411 = T( 22.93828327398878395231483560344797018313) + a1412 = T(-.2361324633071542145259900641263517600737) + c15 = T2( .3110177634953863863927417318829099695921) + a1501 = T( .4620700646754963101730413150238116432863e-1) + a1506 = T( .4503904160842480866828520384400679697151e-1) + a1507 = T( .2336816697713424410788701065340221126565) + a1508 = T( 37.83901368421067410780338220861855254153) + a1509 = T(-15.94911328945424610266139490307397370835) + a1510 = T( 23.02836835181610285142510596329590091940) + a1511 = T(-44.85578507769412524816130998016948002745) + a1512 = T(-.6379858768647444009509067402330140781326e-1) + a1514 = T(-.1259503554386166268241032464519842162533e-1) c16 = T2(69//400) - a1601 = T(parse(BigFloat," .5037946855482040993065158747220696112586e-1")) - a1606 = T(parse(BigFloat," .4109836131046079339916530614028848248545e-1")) - a1607 = T(parse(BigFloat," .1718054153348195783296309209549424619697")) - a1608 = T(parse(BigFloat," 4.61410531998151886974342237185977124648")) - a1609 = T(parse(BigFloat,"-1.791667883085396449712744996746836471721")) - a1610 = T(parse(BigFloat," 2.531658930485041408462243518792913614971")) - a1611 = T(parse(BigFloat,"-5.32497786020573071925718815977276269909")) - a1612 = T(parse(BigFloat,"-.3065532595385634734924449496356513113607e-1")) - a1614 = T(parse(BigFloat,"-.5254479979429613570549519094377878106127e-2")) - a1615 = T(parse(BigFloat,"-.8399194644224792997538653464258058697156e-1")) + a1601 = T( .5037946855482040993065158747220696112586e-1) + a1606 = T( .4109836131046079339916530614028848248545e-1) + a1607 = T( .1718054153348195783296309209549424619697) + a1608 = T( 4.61410531998151886974342237185977124648) + a1609 = T(-1.791667883085396449712744996746836471721) + a1610 = T( 2.531658930485041408462243518792913614971) + a1611 = T(-5.32497786020573071925718815977276269909) + a1612 = T(-.3065532595385634734924449496356513113607e-1) + a1614 = T(-.5254479979429613570549519094377878106127e-2) + a1615 = T(-.8399194644224792997538653464258058697156e-1) c17 = T2(7846//10000) - a1701 = T(parse(BigFloat," .4082897132997079620207118756242653796386e-1")) - a1706 = T(parse(BigFloat," .4244479514247632218892086657732332485609")) - a1707 = T(parse(BigFloat," .2326091531275234539465100096964845486081")) - a1708 = T(parse(BigFloat," 2.677982520711806062780528871014035962908")) - a1709 = T(parse(BigFloat," .7420826657338945216477607044022963622057")) - a1710 = T(parse(BigFloat," .1460377847941461193920992339731312296021")) - a1711 = T(parse(BigFloat,"-3.579344509890565218033356743825917680543")) - a1712 = T(parse(BigFloat," .1138844389600173704531638716149985665239")) - a1714 = T(parse(BigFloat," .1267790651033190047378693537615687232109e-1")) - a1715 = T(parse(BigFloat,"-.7443436349946674429752785032561552478382e-1")) - a1716 = T(parse(BigFloat," .4782748079757851554575511473876987663388e-1")) + a1701 = T( .4082897132997079620207118756242653796386e-1) + a1706 = T( .4244479514247632218892086657732332485609) + a1707 = T( .2326091531275234539465100096964845486081) + a1708 = T( 2.677982520711806062780528871014035962908) + a1709 = T( .7420826657338945216477607044022963622057) + a1710 = T( .1460377847941461193920992339731312296021) + a1711 = T(-3.579344509890565218033356743825917680543) + a1712 = T( .1138844389600173704531638716149985665239) + a1714 = T( .1267790651033190047378693537615687232109e-1) + a1715 = T(-.7443436349946674429752785032561552478382e-1) + a1716 = T( .4782748079757851554575511473876987663388e-1) c18 = T2(37//100) - a1801 = T(parse(BigFloat," .5212682393668413629928136927994514676607e-1")) - a1806 = T(parse(BigFloat," .5392508396744797718209106862347065628649e-1")) - a1807 = T(parse(BigFloat," .1660758097434640828541930599928251901718e-1")) - a1808 = T(parse(BigFloat,"-4.454485757926779655418936993298463071587")) - a1809 = T(parse(BigFloat," 6.835218278632146381711296817968152631469")) - a1810 = T(parse(BigFloat,"-8.711334822181993739847172734848837971169")) - a1811 = T(parse(BigFloat," 6.491635839232917053651267142703105653517")) - a1812 = T(parse(BigFloat,"-.7072551809844346422069985227700294651922e-1")) - a1814 = T(parse(BigFloat,"-.1854031491993216429111842937941202966440e-1")) - a1815 = T(parse(BigFloat," .2350402105435384645116542087045962190647e-1")) - a1816 = T(parse(BigFloat," .2344795103407822090556377813402774776461")) - a1817 = T(parse(BigFloat,"-.8241072501152898885823089698097768766651e-1")) + a1801 = T( .5212682393668413629928136927994514676607e-1) + a1806 = T( .5392508396744797718209106862347065628649e-1) + a1807 = T( .1660758097434640828541930599928251901718e-1) + a1808 = T(-4.454485757926779655418936993298463071587) + a1809 = T( 6.835218278632146381711296817968152631469) + a1810 = T(-8.711334822181993739847172734848837971169) + a1811 = T( 6.491635839232917053651267142703105653517) + a1812 = T(-.7072551809844346422069985227700294651922e-1) + a1814 = T(-.1854031491993216429111842937941202966440e-1) + a1815 = T( .2350402105435384645116542087045962190647e-1) + a1816 = T( .2344795103407822090556377813402774776461) + a1817 = T(-.8241072501152898885823089698097768766651e-1) c19 = T2(1//2) - a1901 = T(parse(BigFloat," .5020102870355713598699964419977883461362e-1")) - a1906 = T(parse(BigFloat," .1552209034795498114932226104700567642339")) - a1907 = T(parse(BigFloat," .1264268424089234914713091134864747506300")) - a1908 = T(parse(BigFloat,"-5.14920630353984701704917414605721854951")) - a1909 = T(parse(BigFloat," 8.46834099903692926607453176331494311551")) - a1910 = T(parse(BigFloat,"-10.66213068108149527544209836207095498430")) - a1911 = T(parse(BigFloat," 7.54183322495972836290996201569018333903")) - a1912 = T(parse(BigFloat,"-.743696811383214243944066492459357053774e-1")) - a1914 = T(parse(BigFloat,"-.2055887686618382619339821759221121764364e-1")) - a1915 = T(parse(BigFloat," .775379526471029807261782993777862395844e-1")) - a1916 = T(parse(BigFloat," .1046259220352544296313761971333987587377")) - a1917 = T(parse(BigFloat,"-.1179213306451979352145022687063013455111")) + a1901 = T( .5020102870355713598699964419977883461362e-1) + a1906 = T( .1552209034795498114932226104700567642339) + a1907 = T( .1264268424089234914713091134864747506300) + a1908 = T(-5.14920630353984701704917414605721854951) + a1909 = T( 8.46834099903692926607453176331494311551) + a1910 = T(-10.66213068108149527544209836207095498430) + a1911 = T( 7.54183322495972836290996201569018333903) + a1912 = T(-.743696811383214243944066492459357053774e-1) + a1914 = T(-.2055887686618382619339821759221121764364e-1) + a1915 = T( .775379526471029807261782993777862395844e-1) + a1916 = T( .1046259220352544296313761971333987587377) + a1917 = T(-.1179213306451979352145022687063013455111) c20 = T2(7//10) - a2001 = T(parse(BigFloat," .3737341446457825692757506548800094134977e-1")) - a2006 = T(parse(BigFloat," .3504930705338316406767087468339071089224")) - a2007 = T(parse(BigFloat," .4922652819373025433298989824173484805373")) - a2008 = T(parse(BigFloat," 8.553695439359312242284304421725315855379")) - a2009 = T(parse(BigFloat,"-10.35317299030591348532574006719207803272")) - a2010 = T(parse(BigFloat," 13.83320427252914990351082875460544773493")) - a2011 = T(parse(BigFloat,"-12.28092433078461863729523583784519048012")) - a2012 = T(parse(BigFloat," .1719151595656509762746810113378644307112")) - a2014 = T(parse(BigFloat," .3641583114314496380113822384214528216140e-1")) - a2015 = T(parse(BigFloat," .2961920580288763054890146412520723429115e-1")) - a2016 = T(parse(BigFloat,"-.2651793938627067002647615623738425030047")) - a2017 = T(parse(BigFloat," .942950396173806655317007970358739475630e-1")) + a2001 = T( .3737341446457825692757506548800094134977e-1) + a2006 = T( .3504930705338316406767087468339071089224) + a2007 = T( .4922652819373025433298989824173484805373) + a2008 = T( 8.553695439359312242284304421725315855379) + a2009 = T(-10.35317299030591348532574006719207803272) + a2010 = T( 13.83320427252914990351082875460544773493) + a2011 = T(-12.28092433078461863729523583784519048012) + a2012 = T( .1719151595656509762746810113378644307112) + a2014 = T( .3641583114314496380113822384214528216140e-1) + a2015 = T( .2961920580288763054890146412520723429115e-1) + a2016 = T(-.2651793938627067002647615623738425030047) + a2017 = T( .942950396173806655317007970358739475630e-1) c21 = T2(9//10) - a2101 = T(parse(BigFloat," .3939058345528250943410670634923521987132e-1")) - a2106 = T(parse(BigFloat," .3558516141234424183136697322755323715063")) - a2107 = T(parse(BigFloat," .4197382225952610029372225526720065366258")) - a2108 = T(parse(BigFloat," .872044977807194166293172525204036071060")) - a2109 = T(parse(BigFloat," .898952083487659486126627160171417043611")) - a2110 = T(parse(BigFloat,"-.630580616105988359023456649527853470403")) - a2111 = T(parse(BigFloat,"-1.121887220595483550736681645425215081433")) - a2112 = T(parse(BigFloat," .4298219512400197176967511031829197714867e-1")) - a2114 = T(parse(BigFloat," .1332557566873915707013495891889190564164e-1")) - a2115 = T(parse(BigFloat," .1876227053964148034446101291928097773800e-1")) - a2116 = T(parse(BigFloat,"-.1859411132922105570515379368592596513699")) - a2117 = T(parse(BigFloat," .1773614271924602745226064729836361000042")) + a2101 = T( .3939058345528250943410670634923521987132e-1) + a2106 = T( .3558516141234424183136697322755323715063) + a2107 = T( .4197382225952610029372225526720065366258) + a2108 = T( .872044977807194166293172525204036071060) + a2109 = T( .898952083487659486126627160171417043611) + a2110 = T(-.630580616105988359023456649527853470403) + a2111 = T(-1.121887220595483550736681645425215081433) + a2112 = T( .4298219512400197176967511031829197714867e-1) + a2114 = T( .1332557566873915707013495891889190564164e-1) + a2115 = T( .1876227053964148034446101291928097773800e-1) + a2116 = T(-.1859411132922105570515379368592596513699) + a2117 = T( .1773614271924602745226064729836361000042) return c14,a1401,a1406,a1407,a1408,a1409,a1410,a1411,a1412,c15,a1501,a1506,a1507,a1508,a1509,a1510,a1511,a1512,a1514,c16,a1601,a1606,a1607,a1608,a1609,a1610,a1611,a1612,a1614,a1615,c17,a1701,a1706,a1707,a1708,a1709,a1710,a1711,a1712,a1714,a1715,a1716,c18,a1801,a1806,a1807,a1808,a1809,a1810,a1811,a1812,a1814,a1815,a1816,a1817,c19,a1901,a1906,a1907,a1908,a1909,a1910,a1911,a1912,a1914,a1915,a1916,a1917,c20,a2001,a2006,a2007,a2008,a2009,a2010,a2011,a2012,a2014,a2015,a2016,a2017,c21,a2101,a2106,a2107,a2108,a2109,a2110,a2111,a2112,a2114,a2115,a2116,a2117 end -Base.@pure function Vern8Interp_polyweights{T<:CompiledFloats}(::Type{T}) +Base.@pure function Vern8Interp_polyweights(::Type{T}) where T<:CompiledFloats r011 = T(1) r012 = T(-10.039154650554519) r013 = T(53.79210495862331) @@ -1878,119 +1878,119 @@ Base.@pure function Vern8Interp_polyweights{T<:CompiledFloats}(::Type{T}) end function Vern8Interp_polyweights(T::Type) - r011 = T(parse(BigFloat," 1")) - r012 = T(parse(BigFloat,"-10.03915465055451898280745009553727015838")) - r013 = T(parse(BigFloat," 53.79210495862331394937504547285261606206")) - r014 = T(parse(BigFloat,"-165.0579057235472167092186792753028629327")) - r015 = T(parse(BigFloat," 298.0264565434610102489744601822776142620")) - r016 = T(parse(BigFloat,"-311.9125448707900689751032283191627986699")) - r017 = T(parse(BigFloat," 174.6059852691171542761046061351126284335")) - r018 = T(parse(BigFloat,"-40.37066163211959429657758663355894180800")) - r062 = T(parse(BigFloat," 158.1976739121776138067531004299642556045")) - r063 = T(parse(BigFloat,"-1543.961417219490013383329186557376850919")) - r064 = T(parse(BigFloat," 6241.398747828780065219699818963300847515")) - r065 = T(parse(BigFloat,"-13136.51615640610824674042591770724411138")) - r066 = T(parse(BigFloat," 15106.94849316959941770760848348143558467")) - r067 = T(parse(BigFloat,"-8996.489626298230413000758717864256649583")) - r068 = T(parse(BigFloat," 2170.776389952444021264933974457050280938")) - r072 = T(parse(BigFloat," 110.7811520079778201620910891542159716196")) - r073 = T(parse(BigFloat,"-1081.190514535617748557462051373884811281")) - r074 = T(parse(BigFloat," 4370.666940459977376891679103587685016930")) - r075 = T(parse(BigFloat,"-9199.113723922197066947453657458673365167")) - r076 = T(parse(BigFloat," 10578.94920962985483690180716390515207397")) - r077 = T(parse(BigFloat,"-6299.975594978841008450271944308599363057")) - r078 = T(parse(BigFloat," 1520.130500554341433782477059435641543286")) - r082 = T(parse(BigFloat,"-7011.442038211314089634068023254940106045")) - r083 = T(parse(BigFloat," 68429.55220744077890209519664603903716349")) - r084 = T(parse(BigFloat,"-276623.5714822198169288202316196287008724")) - r085 = T(parse(BigFloat," 582220.4545548494658856503006312634684934")) - r086 = T(parse(BigFloat,"-669551.5244611245601905652331468068626208")) - r087 = T(parse(BigFloat," 398731.3087623332757943809792249308827732")) - r088 = T(parse(BigFloat,"-96210.47174510666745715793578288559674281")) - r092 = T(parse(BigFloat," 11206.39756984814734031374482605836502113")) - r093 = T(parse(BigFloat,"-109371.0485495066182770525095928736321803")) - r094 = T(parse(BigFloat," 442127.8393698154661543505844693555049508")) - r095 = T(parse(BigFloat,"-930563.7629864562145364082427559715712707")) - r096 = T(parse(BigFloat," 1070145.133585590072636708771436125254933")) - r097 = T(parse(BigFloat,"-637292.8058429046904373075590712408701797")) - r098 = T(parse(BigFloat," 153773.3309185793956820086499888593205888")) - r102 = T(parse(BigFloat,"-14179.23164045568390825368995504736244876")) - r103 = T(parse(BigFloat," 138385.0093196357218693716546019209270760")) - r104 = T(parse(BigFloat,"-559415.5490240869974273158302752589638112")) - r105 = T(parse(BigFloat," 1177423.794699250413603625249340565972051")) - r106 = T(parse(BigFloat,"-1354033.322790821429356166591306087001182")) - r107 = T(parse(BigFloat," 806353.8938825050195016379699232308969498")) - r108 = T(parse(BigFloat,"-194566.3328138133045593670938904445416121")) - r112 = T(parse(BigFloat," 10247.76176792174468727263230424253072668")) - r113 = T(parse(BigFloat,"-100015.0532637523107509874155382267979521")) - r114 = T(parse(BigFloat," 404306.6240143429367125014776377339233105")) - r115 = T(parse(BigFloat,"-850959.9711689702682710993795157496434280")) - r116 = T(parse(BigFloat," 978601.0462088684697300958464199995189771")) - r117 = T(parse(BigFloat,"-582776.4729907748855939796622931794117500")) - r118 = T(parse(BigFloat," 140619.0037156383022701488158207833280861")) - r122 = T(parse(BigFloat,"-105.4930397685096787379931952745881034169")) - r123 = T(parse(BigFloat," 1029.580139580310194120073236423148130618")) - r124 = T(parse(BigFloat,"-4162.034181876452751021493197688100770349")) - r125 = T(parse(BigFloat," 8759.996193602336131526447045580160767641")) - r126 = T(parse(BigFloat,"-10073.96555688604885441046004449728532151")) - r127 = T(parse(BigFloat," 5999.247741473950186438936812025268574829")) - r128 = T(parse(BigFloat,"-1447.567428588892382130036646632729629570")) - r142 = T(parse(BigFloat,"-14.86361337326743122469601010648237947608")) - r143 = T(parse(BigFloat," 145.7635936489486611601020590400812969906")) - r144 = T(parse(BigFloat,"-587.6557063401913588520708808169444817103")) - r145 = T(parse(BigFloat," 1227.372151254555709980234511427063838550")) - r146 = T(parse(BigFloat,"-1394.493105740553645217117387304216418608")) - r147 = T(parse(BigFloat," 816.8562950730668774494805290335070403105")) - r148 = T(parse(BigFloat,"-192.9796145225588132959328212730088960570")) - r152 = T(parse(BigFloat," 14.34968575290546223276673100484047073648")) - r153 = T(parse(BigFloat,"-150.2949344481665658851785896351738227010")) - r154 = T(parse(BigFloat," 629.4812425700290706612346725243246098946")) - r155 = T(parse(BigFloat,"-1352.518207309060677914698908083510085133")) - r156 = T(parse(BigFloat," 1575.896933708880305858556996706058962503")) - r157 = T(parse(BigFloat,"-946.7876580472948045886633971120598201035")) - r158 = T(parse(BigFloat," 229.8729377727072096359824945955196848017")) - r162 = T(parse(BigFloat,"-102.5452470111040085560664290210906322518")) - r163 = T(parse(BigFloat," 1074.032661264680594125263250545103109541")) - r164 = T(parse(BigFloat,"-4498.377917100410634753487685261882069653")) - r165 = T(parse(BigFloat," 9665.320624003280508099125255751992581938")) - r166 = T(parse(BigFloat,"-11261.62224831288113545795903649800929060")) - r167 = T(parse(BigFloat," 6765.902468760784366342575368188597359812")) - r168 = T(parse(BigFloat,"-1642.710341604349689799450723704711058784")) - r172 = T(parse(BigFloat,"-38.13206313286473398334122725888547021750")) - r173 = T(parse(BigFloat," 399.3854658292328681862496726489289700594")) - r174 = T(parse(BigFloat,"-1672.748720491971752312231602599596419744")) - r175 = T(parse(BigFloat," 3594.107254858566583822606674735752304040")) - r176 = T(parse(BigFloat,"-4187.701556802926199931725021751236897492")) - r177 = T(parse(BigFloat," 2515.941280649063720613355430002270532846")) - r178 = T(parse(BigFloat,"-610.8516609091004863949139257772330194915")) - r182 = T(parse(BigFloat,"-66.38279583069588062871084016403504860018")) - r183 = T(parse(BigFloat," 595.8297683881103280237377269355990794854")) - r184 = T(parse(BigFloat,"-2188.737060092971609278770563269347103559")) - r185 = T(parse(BigFloat," 4213.839795282852421559730676511794767863")) - r186 = T(parse(BigFloat,"-4484.035731929196864370162258757955490985")) - r187 = T(parse(BigFloat," 2500.648251425346544829791147364129986790")) - r188 = T(parse(BigFloat,"-571.1622272434449401356158886201861909946")) - r192 = T(parse(BigFloat,"-90.41887573173058787343992868450872085904")) - r193 = T(parse(BigFloat," 931.9503884048153706496188381219698380844")) - r194 = T(parse(BigFloat,"-3962.898377713156165984683269799703910403")) - r195 = T(parse(BigFloat," 8733.317420025551238329244389917866097896")) - r196 = T(parse(BigFloat,"-10445.90818988766053535212385670877957360")) - r197 = T(parse(BigFloat," 6426.218942917598693647793004359979629852")) - r198 = T(parse(BigFloat,"-1592.261308015418013416409177206823360972")) - r202 = T(parse(BigFloat,"-59.73884363038871206457816967313835076801")) - r203 = T(parse(BigFloat," 544.8870146891724527559861176467523778088")) - r204 = T(parse(BigFloat,"-2090.430374926312850791322527518588562537")) - r205 = T(parse(BigFloat," 4194.418982707226648046953315742901721971")) - r206 = T(parse(BigFloat,"-4603.369436819628073439413527693451638704")) - r207 = T(parse(BigFloat," 2619.201413559297614510795648037620577207")) - r208 = T(parse(BigFloat,"-604.9687555793670790184208565420961249773")) - r212 = T(parse(BigFloat,"-59.20053764683937384859682230934791521325")) - r213 = T(parse(BigFloat," 571.7660156218088014286377638724659591261")) - r214 = T(parse(BigFloat,"-2308.949564445360683785335401047607870804")) - r215 = T(parse(BigFloat," 4881.234110686139058221334453291392021952")) - r216 = T(parse(BigFloat,"-5660.118807771202003386701685793459298252")) - r217 = T(parse(BigFloat," 3408.706689037421803199133730396931709513")) - r218 = T(parse(BigFloat,"-833.4379054819676018284720384103746063216")) + r011 = T( 1) + r012 = T(-10.03915465055451898280745009553727015838) + r013 = T( 53.79210495862331394937504547285261606206) + r014 = T(-165.0579057235472167092186792753028629327) + r015 = T( 298.0264565434610102489744601822776142620) + r016 = T(-311.9125448707900689751032283191627986699) + r017 = T( 174.6059852691171542761046061351126284335) + r018 = T(-40.37066163211959429657758663355894180800) + r062 = T( 158.1976739121776138067531004299642556045) + r063 = T(-1543.961417219490013383329186557376850919) + r064 = T( 6241.398747828780065219699818963300847515) + r065 = T(-13136.51615640610824674042591770724411138) + r066 = T( 15106.94849316959941770760848348143558467) + r067 = T(-8996.489626298230413000758717864256649583) + r068 = T( 2170.776389952444021264933974457050280938) + r072 = T( 110.7811520079778201620910891542159716196) + r073 = T(-1081.190514535617748557462051373884811281) + r074 = T( 4370.666940459977376891679103587685016930) + r075 = T(-9199.113723922197066947453657458673365167) + r076 = T( 10578.94920962985483690180716390515207397) + r077 = T(-6299.975594978841008450271944308599363057) + r078 = T( 1520.130500554341433782477059435641543286) + r082 = T(-7011.442038211314089634068023254940106045) + r083 = T( 68429.55220744077890209519664603903716349) + r084 = T(-276623.5714822198169288202316196287008724) + r085 = T( 582220.4545548494658856503006312634684934) + r086 = T(-669551.5244611245601905652331468068626208) + r087 = T( 398731.3087623332757943809792249308827732) + r088 = T(-96210.47174510666745715793578288559674281) + r092 = T( 11206.39756984814734031374482605836502113) + r093 = T(-109371.0485495066182770525095928736321803) + r094 = T( 442127.8393698154661543505844693555049508) + r095 = T(-930563.7629864562145364082427559715712707) + r096 = T( 1070145.133585590072636708771436125254933) + r097 = T(-637292.8058429046904373075590712408701797) + r098 = T( 153773.3309185793956820086499888593205888) + r102 = T(-14179.23164045568390825368995504736244876) + r103 = T( 138385.0093196357218693716546019209270760) + r104 = T(-559415.5490240869974273158302752589638112) + r105 = T( 1177423.794699250413603625249340565972051) + r106 = T(-1354033.322790821429356166591306087001182) + r107 = T( 806353.8938825050195016379699232308969498) + r108 = T(-194566.3328138133045593670938904445416121) + r112 = T( 10247.76176792174468727263230424253072668) + r113 = T(-100015.0532637523107509874155382267979521) + r114 = T( 404306.6240143429367125014776377339233105) + r115 = T(-850959.9711689702682710993795157496434280) + r116 = T( 978601.0462088684697300958464199995189771) + r117 = T(-582776.4729907748855939796622931794117500) + r118 = T( 140619.0037156383022701488158207833280861) + r122 = T(-105.4930397685096787379931952745881034169) + r123 = T( 1029.580139580310194120073236423148130618) + r124 = T(-4162.034181876452751021493197688100770349) + r125 = T( 8759.996193602336131526447045580160767641) + r126 = T(-10073.96555688604885441046004449728532151) + r127 = T( 5999.247741473950186438936812025268574829) + r128 = T(-1447.567428588892382130036646632729629570) + r142 = T(-14.86361337326743122469601010648237947608) + r143 = T( 145.7635936489486611601020590400812969906) + r144 = T(-587.6557063401913588520708808169444817103) + r145 = T( 1227.372151254555709980234511427063838550) + r146 = T(-1394.493105740553645217117387304216418608) + r147 = T( 816.8562950730668774494805290335070403105) + r148 = T(-192.9796145225588132959328212730088960570) + r152 = T( 14.34968575290546223276673100484047073648) + r153 = T(-150.2949344481665658851785896351738227010) + r154 = T( 629.4812425700290706612346725243246098946) + r155 = T(-1352.518207309060677914698908083510085133) + r156 = T( 1575.896933708880305858556996706058962503) + r157 = T(-946.7876580472948045886633971120598201035) + r158 = T( 229.8729377727072096359824945955196848017) + r162 = T(-102.5452470111040085560664290210906322518) + r163 = T( 1074.032661264680594125263250545103109541) + r164 = T(-4498.377917100410634753487685261882069653) + r165 = T( 9665.320624003280508099125255751992581938) + r166 = T(-11261.62224831288113545795903649800929060) + r167 = T( 6765.902468760784366342575368188597359812) + r168 = T(-1642.710341604349689799450723704711058784) + r172 = T(-38.13206313286473398334122725888547021750) + r173 = T( 399.3854658292328681862496726489289700594) + r174 = T(-1672.748720491971752312231602599596419744) + r175 = T( 3594.107254858566583822606674735752304040) + r176 = T(-4187.701556802926199931725021751236897492) + r177 = T( 2515.941280649063720613355430002270532846) + r178 = T(-610.8516609091004863949139257772330194915) + r182 = T(-66.38279583069588062871084016403504860018) + r183 = T( 595.8297683881103280237377269355990794854) + r184 = T(-2188.737060092971609278770563269347103559) + r185 = T( 4213.839795282852421559730676511794767863) + r186 = T(-4484.035731929196864370162258757955490985) + r187 = T( 2500.648251425346544829791147364129986790) + r188 = T(-571.1622272434449401356158886201861909946) + r192 = T(-90.41887573173058787343992868450872085904) + r193 = T( 931.9503884048153706496188381219698380844) + r194 = T(-3962.898377713156165984683269799703910403) + r195 = T( 8733.317420025551238329244389917866097896) + r196 = T(-10445.90818988766053535212385670877957360) + r197 = T( 6426.218942917598693647793004359979629852) + r198 = T(-1592.261308015418013416409177206823360972) + r202 = T(-59.73884363038871206457816967313835076801) + r203 = T( 544.8870146891724527559861176467523778088) + r204 = T(-2090.430374926312850791322527518588562537) + r205 = T( 4194.418982707226648046953315742901721971) + r206 = T(-4603.369436819628073439413527693451638704) + r207 = T( 2619.201413559297614510795648037620577207) + r208 = T(-604.9687555793670790184208565420961249773) + r212 = T(-59.20053764683937384859682230934791521325) + r213 = T( 571.7660156218088014286377638724659591261) + r214 = T(-2308.949564445360683785335401047607870804) + r215 = T( 4881.234110686139058221334453291392021952) + r216 = T(-5660.118807771202003386701685793459298252) + r217 = T( 3408.706689037421803199133730396931709513) + r218 = T(-833.4379054819676018284720384103746063216) return r011,r012,r013,r014,r015,r016,r017,r018,r062,r063,r064,r065,r066,r067,r068,r072,r073,r074,r075,r076,r077,r078,r082,r083,r084,r085,r086,r087,r088,r092,r093,r094,r095,r096,r097,r098,r102,r103,r104,r105,r106,r107,r108,r112,r113,r114,r115,r116,r117,r118,r122,r123,r124,r125,r126,r127,r128,r142,r143,r144,r145,r146,r147,r148,r152,r153,r154,r155,r156,r157,r158,r162,r163,r164,r165,r166,r167,r168,r172,r173,r174,r175,r176,r177,r178,r182,r183,r184,r185,r186,r187,r188,r192,r193,r194,r195,r196,r197,r198,r202,r203,r204,r205,r206,r207,r208,r212,r213,r214,r215,r216,r217,r218 end @@ -2396,7 +2396,7 @@ end """ From Verner's Webiste """ -Base.@pure function Vern9ConstantCache{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function Vern9ConstantCache(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} c1 =T2(0.03462) c2 =T2(0.09702435063878045) c3 =T2(0.14553652595817068) @@ -2644,7 +2644,7 @@ function Vern9ConstantCache(T::Type,T2::Type) Vern9ConstantCache(c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,a0201,a0301,a0302,a0401,a0403,a0501,a0503,a0504,a0601,a0604,a0605,a0701,a0704,a0705,a0706,a0801,a0806,a0807,a0901,a0906,a0907,a0908,a1001,a1006,a1007,a1008,a1009,a1101,a1106,a1107,a1108,a1109,a1110,a1201,a1206,a1207,a1208,a1209,a1210,a1211,a1301,a1306,a1307,a1308,a1309,a1310,a1311,a1312,a1401,a1406,a1407,a1408,a1409,a1410,a1411,a1412,a1413,a1501,a1506,a1507,a1508,a1509,a1510,a1511,a1512,a1513,a1514,a1601,a1606,a1607,a1608,a1609,a1610,a1611,a1612,a1613,b1,b8,b9,b10,b11,b12,b13,b14,b15,btilde1,btilde8,btilde9,btilde10,btilde11,btilde12,btilde13,btilde14,btilde15,btilde16,c17,a1701,a1708,a1709,a1710,a1711,a1712,a1713,a1714,a1715,c18,a1801,a1808,a1809,a1810,a1811,a1812,a1813,a1814,a1815,a1817,c19,a1901,a1908,a1909,a1910,a1911,a1912,a1913,a1914,a1915,a1917,a1918,c20,a2001,a2008,a2009,a2010,a2011,a2012,a2013,a2014,a2015,a2017,a2018,a2019,c21,a2101,a2108,a2109,a2110,a2111,a2112,a2113,a2114,a2115,a2117,a2118,a2119,a2120,c22,a2201,a2208,a2209,a2210,a2211,a2212,a2213,a2214,a2215,a2217,a2218,a2219,a2220,a2221,c23,a2301,a2308,a2309,a2310,a2311,a2312,a2313,a2314,a2315,a2317,a2318,a2319,a2320,a2321,c24,a2401,a2408,a2409,a2410,a2411,a2412,a2413,a2414,a2415,a2417,a2418,a2419,a2420,a2421,c25,a2501,a2508,a2509,a2510,a2511,a2512,a2513,a2514,a2515,a2517,a2518,a2519,a2520,a2521,c26,a2601,a2608,a2609,a2610,a2611,a2612,a2613,a2614,a2615,a2617,a2618,a2619,a2620,a2621,r011,r012,r013,r014,r015,r016,r017,r018,r019,r082,r083,r084,r085,r086,r087,r088,r089,r092,r093,r094,r095,r096,r097,r098,r099,r102,r103,r104,r105,r106,r107,r108,r109,r112,r113,r114,r115,r116,r117,r118,r119,r122,r123,r124,r125,r126,r127,r128,r129,r132,r133,r134,r135,r136,r137,r138,r139,r142,r143,r144,r145,r146,r147,r148,r149,r152,r153,r154,r155,r156,r157,r158,r159,r172,r173,r174,r175,r176,r177,r178,r179,r182,r183,r184,r185,r186,r187,r188,r189,r192,r193,r194,r195,r196,r197,r198,r199,r202,r203,r204,r205,r206,r207,r208,r209,r212,r213,r214,r215,r216,r217,r218,r219,r222,r223,r224,r225,r226,r227,r228,r229,r232,r233,r234,r235,r236,r237,r238,r239,r242,r243,r244,r245,r246,r247,r248,r249,r252,r253,r254,r255,r256,r257,r258,r259,r262,r263,r264,r265,r266,r267,r268,r269) end -Base.@pure function Vern9Interp{T<:CompiledFloats,T2<:CompiledFloats}(::Type{T},::Type{T2}) +Base.@pure function Vern9Interp(::Type{T},::Type{T2}) where {T<:CompiledFloats,T2<:CompiledFloats} # FIVE ADDITIONAL STAGES FOR INTERPOLANT OF ORDER 8 c17 = T2(1) a1701 = T(0.014611976858423152) @@ -2789,146 +2789,146 @@ end function Vern9Interp(T::Type,T2::Type) # FIVE ADDITIONAL STAGES FOR INTERPOLANT OF ORDER 8 c17 = T2(1) - a1701 = T(parse(BigFloat," .1461197685842315252051541915018784713459e-1")) - a1708 = T(parse(BigFloat,"-.3915211862331339089410228267288242030810")) - a1709 = T(parse(BigFloat," .2310932500289506415909675644868993669908")) - a1710 = T(parse(BigFloat," .1274766769992852382560589467488989175618")) - a1711 = T(parse(BigFloat," .2246434176204157731566981937082069688984")) - a1712 = T(parse(BigFloat," .5684352689748512932705226972873692126743")) - a1713 = T(parse(BigFloat," .5825871557215827200814768021863420902155e-1")) - a1714 = T(parse(BigFloat," .1364317403482215641609022744494239843327")) - a1715 = T(parse(BigFloat," .3057013983082797397721005067920369646664e-1")) - c18 = T2(parse(BigFloat," .7404185470631561083004100761798676215811")) - a1801 = T(parse(BigFloat," .1549973668189559302279946863304789372788e-1")) - a1808 = T(parse(BigFloat," .3355153219059635054403439303177105512242")) - a1809 = T(parse(BigFloat," .2003613944191860651552622660712101217322")) - a1810 = T(parse(BigFloat," .1252060659283549312946162355194540994211")) - a1811 = T(parse(BigFloat," .2298676393184206750544046308957155868736")) - a1812 = T(parse(BigFloat,"-.2020250653476181447824906889122391003637")) - a1813 = T(parse(BigFloat," .5917103230665456601422111997583025339897e-1")) - a1814 = T(parse(BigFloat,"-.2651834783047638681693835956996437528251e-1")) - a1815 = T(parse(BigFloat,"-.2384094602130971415278110567256446033405e-1")) - a1817 = T(parse(BigFloat," .2718171570208501807097257892166705118335e-1")) + a1701 = T( .1461197685842315252051541915018784713459e-1) + a1708 = T(-.3915211862331339089410228267288242030810) + a1709 = T( .2310932500289506415909675644868993669908) + a1710 = T( .1274766769992852382560589467488989175618) + a1711 = T( .2246434176204157731566981937082069688984) + a1712 = T( .5684352689748512932705226972873692126743) + a1713 = T( .5825871557215827200814768021863420902155e-1) + a1714 = T( .1364317403482215641609022744494239843327) + a1715 = T( .3057013983082797397721005067920369646664e-1) + c18 = T2( .7404185470631561083004100761798676215811) + a1801 = T( .1549973668189559302279946863304789372788e-1) + a1808 = T( .3355153219059635054403439303177105512242) + a1809 = T( .2003613944191860651552622660712101217322) + a1810 = T( .1252060659283549312946162355194540994211) + a1811 = T( .2298676393184206750544046308957155868736) + a1812 = T(-.2020250653476181447824906889122391003637) + a1813 = T( .5917103230665456601422111997583025339897e-1) + a1814 = T(-.2651834783047638681693835956996437528251e-1) + a1815 = T(-.2384094602130971415278110567256446033405e-1) + a1817 = T( .2718171570208501807097257892166705118335e-1) c19 = T2(888//1000) - a1901 = T(parse(BigFloat," .1302453943114338366054520296881099431474e-1")) - a1908 = T(parse(BigFloat,"-.7452850902413112085299330666038981625179")) - a1909 = T(parse(BigFloat," .2643867896429300961465132150322749722129")) - a1910 = T(parse(BigFloat," .1313961758372753932588328082078842388890")) - a1911 = T(parse(BigFloat," .2167253815122927263092467187957410643315")) - a1912 = T(parse(BigFloat," .8734117564076052559016338094938888451419")) - a1913 = T(parse(BigFloat," .1185905643935776688228545787724340848142e-1")) - a1914 = T(parse(BigFloat," .5876002941689550612992712203494447529933e-1")) - a1915 = T(parse(BigFloat," .3266518630202087866399279690939423159022e-2")) - a1917 = T(parse(BigFloat,"-.8959308648417929824525368306101792182274e-2")) - a1918 = T(parse(BigFloat," .6941415157202692219907482080827253287034e-1")) + a1901 = T( .1302453943114338366054520296881099431474e-1) + a1908 = T(-.7452850902413112085299330666038981625179) + a1909 = T( .2643867896429300961465132150322749722129) + a1910 = T( .1313961758372753932588328082078842388890) + a1911 = T( .2167253815122927263092467187957410643315) + a1912 = T( .8734117564076052559016338094938888451419) + a1913 = T( .1185905643935776688228545787724340848142e-1) + a1914 = T( .5876002941689550612992712203494447529933e-1) + a1915 = T( .3266518630202087866399279690939423159022e-2) + a1917 = T(-.8959308648417929824525368306101792182274e-2) + a1918 = T( .6941415157202692219907482080827253287034e-1) c20 = T2(696//1000) - a2001 = T(parse(BigFloat," .1397089996925942721283716334050740168797e-1")) - a2008 = T(parse(BigFloat,"-.4665765335957674596054673402956853940520")) - a2009 = T(parse(BigFloat," .2416372787216257077935214889875485248580")) - a2010 = T(parse(BigFloat," .1290363341345674735721677437066933999929")) - a2011 = T(parse(BigFloat," .2216700671735105311080225734522323922813")) - a2012 = T(parse(BigFloat," .6257275123364644931771253383573999863003")) - a2013 = T(parse(BigFloat," .4355312415679284117869124964829805160429e-1")) - a2014 = T(parse(BigFloat," .1011962491667290833450024852274278874501")) - a2015 = T(parse(BigFloat," .1808582254679721049279369742685497400353e-1")) - a2017 = T(parse(BigFloat,"-.2079875587689169691156509689282083267654e-1")) - a2018 = T(parse(BigFloat,"-.9022232517086218976198252891464664868640e-1")) - a2019 = T(parse(BigFloat,"-.1212796735622254216011467740438097427634")) + a2001 = T( .1397089996925942721283716334050740168797e-1) + a2008 = T(-.4665765335957674596054673402956853940520) + a2009 = T( .2416372787216257077935214889875485248580) + a2010 = T( .1290363341345674735721677437066933999929) + a2011 = T( .2216700671735105311080225734522323922813) + a2012 = T( .6257275123364644931771253383573999863003) + a2013 = T( .4355312415679284117869124964829805160429e-1) + a2014 = T( .1011962491667290833450024852274278874501) + a2015 = T( .1808582254679721049279369742685497400353e-1) + a2017 = T(-.2079875587689169691156509689282083267654e-1) + a2018 = T(-.9022232517086218976198252891464664868640e-1) + a2019 = T(-.1212796735622254216011467740438097427634) c21 = T2(487//1000) - a2101 = T(parse(BigFloat," .1604638888318112738641232352800290501904e-1")) - a2108 = T(parse(BigFloat," .9517712399458336651642257453589397190702e-1")) - a2109 = T(parse(BigFloat," .1359187264655317806136927180199100622471")) - a2110 = T(parse(BigFloat," .1237765280959854006935081364365637515893")) - a2111 = T(parse(BigFloat," .2335656264102966047058755123098072346246")) - a2112 = T(parse(BigFloat,"-.9051508172625873314662090873741762206189e-1")) - a2113 = T(parse(BigFloat,"-.2537574270006131028513276914038326155331e-1")) - a2114 = T(parse(BigFloat,"-.1359631696887162048002744757083947500478")) - a2115 = T(parse(BigFloat,"-.4679214284145113075088049469061349990847e-1")) - a2117 = T(parse(BigFloat," .5177958859391748239949773879090325427473e-1")) - a2118 = T(parse(BigFloat," .9672595677476773313884172931875718705561e-1")) - a2119 = T(parse(BigFloat," .1477312690340742769720989417101989769314")) - a2120 = T(parse(BigFloat,"-.1150750712958503934434410263732282100773")) + a2101 = T( .1604638888318112738641232352800290501904e-1) + a2108 = T( .9517712399458336651642257453589397190702e-1) + a2109 = T( .1359187264655317806136927180199100622471) + a2110 = T( .1237765280959854006935081364365637515893) + a2111 = T( .2335656264102966047058755123098072346246) + a2112 = T(-.9051508172625873314662090873741762206189e-1) + a2113 = T(-.2537574270006131028513276914038326155331e-1) + a2114 = T(-.1359631696887162048002744757083947500478) + a2115 = T(-.4679214284145113075088049469061349990847e-1) + a2117 = T( .5177958859391748239949773879090325427473e-1) + a2118 = T( .9672595677476773313884172931875718705561e-1) + a2119 = T( .1477312690340742769720989417101989769314) + a2120 = T(-.1150750712958503934434410263732282100773) # FIVE ADDITIONAL STAGES FOR INTERPOLANT OF ORDER 9 c22 = T2(1//40) - a2201 = T(parse(BigFloat," .1802918623893620731908165792176564180038e-1")) - a2208 = T(parse(BigFloat," .6983601042028873702545973390560096201728e-1")) - a2209 = T(parse(BigFloat,"-.2541247660791663512384395986842781657182e-1")) - a2210 = T(parse(BigFloat," .8487827035463274491721441398893680307535e-2")) - a2211 = T(parse(BigFloat,"-.2427525516089801645451101966852425715128e-2")) - a2212 = T(parse(BigFloat,"-.1047839752893819879012607694745789515746")) - a2213 = T(parse(BigFloat,"-.1473147795248041942353840372690095884761e-1")) - a2214 = T(parse(BigFloat,"-.3916338390816177165706892282751065537530e-1")) - a2215 = T(parse(BigFloat,"-.1005657343293959419073236542225421561652e-1")) - a2217 = T(parse(BigFloat," .1102510392204834322538452331445716455061e-1")) - a2218 = T(parse(BigFloat," .5092830749095398308703438556315975226108e-2")) - a2219 = T(parse(BigFloat," .4759715599420644505591133410826632557391e-1")) - a2220 = T(parse(BigFloat," .3386307003288382751110965442296681690349e-1")) - a2221 = T(parse(BigFloat," .2764422831404797700452373965825845732168e-1")) + a2201 = T( .1802918623893620731908165792176564180038e-1) + a2208 = T( .6983601042028873702545973390560096201728e-1) + a2209 = T(-.2541247660791663512384395986842781657182e-1) + a2210 = T( .8487827035463274491721441398893680307535e-2) + a2211 = T(-.2427525516089801645451101966852425715128e-2) + a2212 = T(-.1047839752893819879012607694745789515746) + a2213 = T(-.1473147795248041942353840372690095884761e-1) + a2214 = T(-.3916338390816177165706892282751065537530e-1) + a2215 = T(-.1005657343293959419073236542225421561652e-1) + a2217 = T( .1102510392204834322538452331445716455061e-1) + a2218 = T( .5092830749095398308703438556315975226108e-2) + a2219 = T( .4759715599420644505591133410826632557391e-1) + a2220 = T( .3386307003288382751110965442296681690349e-1) + a2221 = T( .2764422831404797700452373965825845732168e-1) c23 = T2(15//100) - a2301 = T(parse(BigFloat," .1677431640522778042988664067637191163626e-1")) - a2308 = T(parse(BigFloat," .6220437408820475326702539861577894278533")) - a2309 = T(parse(BigFloat,"-.2060859809768841878234097076241307428139")) - a2310 = T(parse(BigFloat," .1156394989766058889629372195583391792474")) - a2311 = T(parse(BigFloat," .2664101793378358946544219293685167025971e-1")) - a2312 = T(parse(BigFloat,"-.9376810793418770527505892794460093668860")) - a2313 = T(parse(BigFloat,"-.1367806466702160302637074581619101741312")) - a2314 = T(parse(BigFloat,"-.3678480995268296672182605288991379118419")) - a2315 = T(parse(BigFloat,"-.9547871314402478902820445838193201497337e-1")) - a2317 = T(parse(BigFloat," .1013492018422369748729008873270013785313")) - a2318 = T(parse(BigFloat,"-.8911323084568593396468400926074881389560e-1")) - a2319 = T(parse(BigFloat," .4664140988974760478895528270623735057521")) - a2320 = T(parse(BigFloat," .4502736292354579812232681662308722738519")) - a2321 = T(parse(BigFloat," .1838522463326818655346135218242696774099")) + a2301 = T( .1677431640522778042988664067637191163626e-1) + a2308 = T( .6220437408820475326702539861577894278533) + a2309 = T(-.2060859809768841878234097076241307428139) + a2310 = T( .1156394989766058889629372195583391792474) + a2311 = T( .2664101793378358946544219293685167025971e-1) + a2312 = T(-.9376810793418770527505892794460093668860) + a2313 = T(-.1367806466702160302637074581619101741312) + a2314 = T(-.3678480995268296672182605288991379118419) + a2315 = T(-.9547871314402478902820445838193201497337e-1) + a2317 = T( .1013492018422369748729008873270013785313) + a2318 = T(-.8911323084568593396468400926074881389560e-1) + a2319 = T( .4664140988974760478895528270623735057521) + a2320 = T( .4502736292354579812232681662308722738519) + a2321 = T( .1838522463326818655346135218242696774099) c24 = T2(32//100) - a2401 = T(parse(BigFloat," .1071149731491444187554380927165768658192e-1")) - a2408 = T(parse(BigFloat,"-.7094336118221108191937165464264324417735e-1")) - a2409 = T(parse(BigFloat," .1002164900340091596740582334112699697590")) - a2410 = T(parse(BigFloat," .1383453980468025108839271214703390659581")) - a2411 = T(parse(BigFloat," .1796330633578163411338104055485109917477")) - a2412 = T(parse(BigFloat," .9048246545576180974879274948815422276563e-1")) - a2413 = T(parse(BigFloat,"-.5460662294523338383345981122023862069115e-2")) - a2414 = T(parse(BigFloat,"-.3000457905119619782973021046143166498567e-1")) - a2415 = T(parse(BigFloat,"-.1145192026962799093665613252151017277867e-1")) - a2417 = T(parse(BigFloat," .1003394686109385076849515422360600302176e-1")) - a2418 = T(parse(BigFloat,"-.9506485282809046129031027932806241113157e-1")) - a2419 = T(parse(BigFloat," .4853358804093591445756711642658478691640e-1")) - a2420 = T(parse(BigFloat," .8013325919783924638483373011297347396327e-1")) - a2421 = T(parse(BigFloat,"-.1251643326835242045676140618774248455713")) + a2401 = T( .1071149731491444187554380927165768658192e-1) + a2408 = T(-.7094336118221108191937165464264324417735e-1) + a2409 = T( .1002164900340091596740582334112699697590) + a2410 = T( .1383453980468025108839271214703390659581) + a2411 = T( .1796330633578163411338104055485109917477) + a2412 = T( .9048246545576180974879274948815422276563e-1) + a2413 = T(-.5460662294523338383345981122023862069115e-2) + a2414 = T(-.3000457905119619782973021046143166498567e-1) + a2415 = T(-.1145192026962799093665613252151017277867e-1) + a2417 = T( .1003394686109385076849515422360600302176e-1) + a2418 = T(-.9506485282809046129031027932806241113157e-1) + a2419 = T( .4853358804093591445756711642658478691640e-1) + a2420 = T( .8013325919783924638483373011297347396327e-1) + a2421 = T(-.1251643326835242045676140618774248455713) c25 = T2(78//100) - a2501 = T(parse(BigFloat," .1410172088869221367153586187761994182069e-1")) - a2508 = T(parse(BigFloat,"-.3713379753704491105936205420001801316029")) - a2509 = T(parse(BigFloat," .2231265548117180273161442520179150684520")) - a2510 = T(parse(BigFloat," .1287005345918120122888629169443916280865")) - a2511 = T(parse(BigFloat," .2224600659675494761192249831098918110654")) - a2512 = T(parse(BigFloat," .5382853042550701952740528638168708946100")) - a2513 = T(parse(BigFloat," .5417202616988763101781128062036252796548e-1")) - a2514 = T(parse(BigFloat," .1256968791308743925752109039299467082975")) - a2515 = T(parse(BigFloat," .2784492789002054061504430663197543089132e-1")) - a2517 = T(parse(BigFloat,"-.3077409246205059733390460511525401688205e-1")) - a2518 = T(parse(BigFloat," .8569805293689777608077303071761466118035e-2")) - a2519 = T(parse(BigFloat,"-.1535174690587044615794997685221990516897")) - a2520 = T(parse(BigFloat,"-.2179957030548196497189489878038029238243e-1")) - a2521 = T(parse(BigFloat," .1447128819737186799295514239727801525027e-1")) + a2501 = T( .1410172088869221367153586187761994182069e-1) + a2508 = T(-.3713379753704491105936205420001801316029) + a2509 = T( .2231265548117180273161442520179150684520) + a2510 = T( .1287005345918120122888629169443916280865) + a2511 = T( .2224600659675494761192249831098918110654) + a2512 = T( .5382853042550701952740528638168708946100) + a2513 = T( .5417202616988763101781128062036252796548e-1) + a2514 = T( .1256968791308743925752109039299467082975) + a2515 = T( .2784492789002054061504430663197543089132e-1) + a2517 = T(-.3077409246205059733390460511525401688205e-1) + a2518 = T( .8569805293689777608077303071761466118035e-2) + a2519 = T(-.1535174690587044615794997685221990516897) + a2520 = T(-.2179957030548196497189489878038029238243e-1) + a2521 = T( .1447128819737186799295514239727801525027e-1) c26 = T2(96//100) - a2601 = T(parse(BigFloat," .1424600411735646609296566581447532773183e-1")) - a2608 = T(parse(BigFloat,"-.3767107393295407091303982522049390741260")) - a2609 = T(parse(BigFloat," .2252399780730421480874737297000189000070")) - a2610 = T(parse(BigFloat," .1283603076292529988314451246143633426068")) - a2611 = T(parse(BigFloat," .2230238705261692544876826347415151339678")) - a2612 = T(parse(BigFloat," .5463127827750747224899202176094949607118")) - a2613 = T(parse(BigFloat," .5526190791375779994553849469706124289752e-1")) - a2614 = T(parse(BigFloat," .1285613508749982456581494397108686240388")) - a2615 = T(parse(BigFloat," .2857250681296406482698934635829147899039e-1")) - a2617 = T(parse(BigFloat,"-.2398761886357108720930416967644499057175e-1")) - a2618 = T(parse(BigFloat," .5556224458910509454379297181908734648749e-1")) - a2619 = T(parse(BigFloat,"-.1740675650762838674257930398070760254668e-1")) - a2620 = T(parse(BigFloat,"-.3815462365996979065575121886854199471011e-1")) - a2621 = T(parse(BigFloat," .1111878504898917877407531966545730451506e-1")) + a2601 = T( .1424600411735646609296566581447532773183e-1) + a2608 = T(-.3767107393295407091303982522049390741260) + a2609 = T( .2252399780730421480874737297000189000070) + a2610 = T( .1283603076292529988314451246143633426068) + a2611 = T( .2230238705261692544876826347415151339678) + a2612 = T( .5463127827750747224899202176094949607118) + a2613 = T( .5526190791375779994553849469706124289752e-1) + a2614 = T( .1285613508749982456581494397108686240388) + a2615 = T( .2857250681296406482698934635829147899039e-1) + a2617 = T(-.2398761886357108720930416967644499057175e-1) + a2618 = T( .5556224458910509454379297181908734648749e-1) + a2619 = T(-.1740675650762838674257930398070760254668e-1) + a2620 = T(-.3815462365996979065575121886854199471011e-1) + a2621 = T( .1111878504898917877407531966545730451506e-1) return c17,a1701,a1708,a1709,a1710,a1711,a1712,a1713,a1714,a1715,c18,a1801,a1808,a1809,a1810,a1811,a1812,a1813,a1814,a1815,a1817,c19,a1901,a1908,a1909,a1910,a1911,a1912,a1913,a1914,a1915,a1917,a1918,c20,a2001,a2008,a2009,a2010,a2011,a2012,a2013,a2014,a2015,a2017,a2018,a2019,c21,a2101,a2108,a2109,a2110,a2111,a2112,a2113,a2114,a2115,a2117,a2118,a2119,a2120,c22,a2201,a2208,a2209,a2210,a2211,a2212,a2213,a2214,a2215,a2217,a2218,a2219,a2220,a2221,c23,a2301,a2308,a2309,a2310,a2311,a2312,a2313,a2314,a2315,a2317,a2318,a2319,a2320,a2321,c24,a2401,a2408,a2409,a2410,a2411,a2412,a2413,a2414,a2415,a2417,a2418,a2419,a2420,a2421,c25,a2501,a2508,a2509,a2510,a2511,a2512,a2513,a2514,a2515,a2517,a2518,a2519,a2520,a2521,c26,a2601,a2608,a2609,a2610,a2611,a2612,a2613,a2614,a2615,a2617,a2618,a2619,a2620,a2621 end -Base.@pure function Vern9Interp_polyweights{T<:CompiledFloats}(::Type{T}) +Base.@pure function Vern9Interp_polyweights(::Type{T}) where T<:CompiledFloats r011 = T(1) r012 = T(-28.330488700617398) r013 = T(257.6535452078578) @@ -3087,157 +3087,157 @@ end function Vern9Interp_polyweights(T::Type) r011 = T(1) - r012 = T(parse(BigFloat,"-28.33048870061739823290767301658881994700")) - r013 = T(parse(BigFloat," 257.6535452078577977252092979905248156497")) - r014 = T(parse(BigFloat,"-1152.154455743457311528752964691951881858")) - r015 = T(parse(BigFloat," 2909.390878345408890936564599116550031880")) - r016 = T(parse(BigFloat,"-4355.005172868188498048946108887283528629")) - r017 = T(parse(BigFloat," 3834.083497036262189455855371796461857871")) - r018 = T(parse(BigFloat,"-1835.419052683407081215583427992189311730")) - r019 = T(parse(BigFloat," 368.7958613829998340610814211036270246107")) - r082 = T(parse(BigFloat," 2.649656243770091212685381903551424676261")) - r083 = T(parse(BigFloat,"-96.30312807816005963630382777245983513008")) - r084 = T(parse(BigFloat," 869.3095462492795755338599928089438369769")) - r085 = T(parse(BigFloat,"-3395.688567551074115525201961265641584358")) - r086 = T(parse(BigFloat," 6796.933987158715680563278170147156885480")) - r087 = T(parse(BigFloat,"-7340.848417712071304684606060804637321789")) - r088 = T(parse(BigFloat," 4082.848896992365666259441580054990759905")) - r089 = T(parse(BigFloat,"-919.2934944890586676320942978986329899642")) - r092 = T(parse(BigFloat,"-1.563945181928732780647121505551017046606")) - r093 = T(parse(BigFloat," 56.84239739272860000194549791973820565214")) - r094 = T(parse(BigFloat,"-513.1052300304284642178552372517916694426")) - r095 = T(parse(BigFloat," 2004.286702110323162741493515173880535381")) - r096 = T(parse(BigFloat,"-4011.853305913929339500285683507736138334")) - r097 = T(parse(BigFloat," 4332.895839278586189971336003691596594090")) - r098 = T(parse(BigFloat,"-2409.879347937144606091337260195738587773")) - r099 = T(parse(BigFloat," 542.6079835318221405169412532400889768401")) - r102 = T(parse(BigFloat,"-.8627103334967223830653368770735555216700")) - r103 = T(parse(BigFloat," 31.35565375185173442495465167501846267906")) - r104 = T(parse(BigFloat,"-283.0413682227354209126847112083546012674")) - r105 = T(parse(BigFloat," 1105.613463426006937052739159664962261462")) - r106 = T(parse(BigFloat,"-2213.036200678452629288185991597653042989")) - r107 = T(parse(BigFloat," 2390.131097754120588994847482867886207858")) - r108 = T(parse(BigFloat,"-1329.348266146873716496636094950745123424")) - r109 = T(parse(BigFloat," 299.3158071265785138462868993727082901209")) - r112 = T(parse(BigFloat,"-1.520295337901214839055193576160469820911")) - r113 = T(parse(BigFloat," 55.25592121120227100440616045452813504748")) - r114 = T(parse(BigFloat,"-498.7844190970740738969945498750124435385")) - r115 = T(parse(BigFloat," 1948.346888525776056658403461666308795237")) - r116 = T(parse(BigFloat,"-3899.882136407551390287649940376076923682")) - r117 = T(parse(BigFloat," 4211.964345158858030803618536151121927765")) - r118 = T(parse(BigFloat,"-2342.619408856117128087568672414857706561")) - r119 = T(parse(BigFloat," 527.4637482204278644179968961638568925209")) - r122 = T(parse(BigFloat,"-3.846938844125523400516071820264700141179")) - r123 = T(parse(BigFloat," 139.8189840986840520353362018994734906611")) - r124 = T(parse(BigFloat,"-1262.118687621600386514715930156791825893")) - r125 = T(parse(BigFloat," 4930.075848057311658057235318456802793199")) - r126 = T(parse(BigFloat,"-9868.219486069539059368988308801366826185")) - r127 = T(parse(BigFloat," 10657.90892434886730229746304583865145121")) - r128 = T(parse(BigFloat,"-5927.738759872814112912292792695856187255")) - r129 = T(parse(BigFloat," 1334.688551172190921099749059976639173619")) - r132 = T(parse(BigFloat,"-.3942713061200141454309326713125653612517")) - r133 = T(parse(BigFloat," 14.32999476067649707020689155180345562459")) - r134 = T(parse(BigFloat,"-129.3540665994558117853022852051786116929")) - r135 = T(parse(BigFloat," 505.2816077002517600897861155496606850457")) - r136 = T(parse(BigFloat,"-1011.390080139433268878243655218566636574")) - r137 = T(parse(BigFloat," 1092.325051781891697669369143688906543465")) - r138 = T(parse(BigFloat,"-607.5317019302810290917918493845279272648")) - r139 = T(parse(BigFloat," 136.7917244480423273434147193694336909663")) - r142 = T(parse(BigFloat,"-.9233145622082101394378429409444333268499")) - r143 = T(parse(BigFloat," 33.55834582309798808260613735851232640640")) - r144 = T(parse(BigFloat,"-302.9246397549735936661321348695774835448")) - r145 = T(parse(BigFloat," 1183.281306967867553342903125095128753568")) - r146 = T(parse(BigFloat,"-2368.498986790111516106072390247333149007")) - r147 = T(parse(BigFloat," 2558.034559755808027369106332027405169828")) - r148 = T(parse(BigFloat,"-1422.733175577880214903071122439856598476")) - r149 = T(parse(BigFloat," 320.3423358787481875842587982911148385364")) - r152 = T(parse(BigFloat,"-.2068862802930053801253649628830330891017")) - r153 = T(parse(BigFloat," 7.519388975651662772174695012120581518594")) - r154 = T(parse(BigFloat,"-67.87605708082904058354114755731111898667")) - r155 = T(parse(BigFloat," 265.1367996984150421661637988925923843021")) - r156 = T(parse(BigFloat,"-530.7074807559025368587558119659212235622")) - r157 = T(parse(BigFloat," 573.1765495641490277116961329189087439579")) - r158 = T(parse(BigFloat,"-318.7905688834868978004500126002971837241")) - r159 = T(parse(BigFloat," 71.77882490212657594681492031347005327988")) - r172 = T(parse(BigFloat,"-.4472441906744099441704338175964823026105")) - r173 = T(parse(BigFloat," 16.44684676010503791623763886833381020592")) - r174 = T(parse(BigFloat,"-154.4086105921295528355180056633078150675")) - r175 = T(parse(BigFloat," 641.8986298540248497333509289273669726482")) - r176 = T(parse(BigFloat,"-1391.939225687982391028602609567895699003")) - r177 = T(parse(BigFloat," 1643.890568302952013019278202625162156841")) - r178 = T(parse(BigFloat,"-1004.065297223317845596795060426393517046")) - r179 = T(parse(BigFloat," 248.6243327770222987362193390543305737239")) - r182 = T(parse(BigFloat,"-.1507876007899797948720901584434839156279")) - r183 = T(parse(BigFloat," 5.527328824824632235316362126620825363280")) - r184 = T(parse(BigFloat,"-51.33833743084618751433903968701557585387")) - r185 = T(parse(BigFloat," 209.6022002703280347991393999433060881829")) - r186 = T(parse(BigFloat,"-442.7692650421825928714839983614217797969")) - r187 = T(parse(BigFloat," 505.0579312588052893780948070449787925777")) - r188 = T(parse(BigFloat,"-295.6336410615619366143935619944592839974")) - r189 = T(parse(BigFloat," 69.70457078142274038253812108643441743987")) - r192 = T(parse(BigFloat,"-.6413652207435296452288504944964177537185")) - r193 = T(parse(BigFloat," 23.51013248624684600263471193689787394701")) - r194 = T(parse(BigFloat,"-218.3642683246972281497485359238725613162")) - r195 = T(parse(BigFloat," 891.5292818535365634586829868055833114383")) - r196 = T(parse(BigFloat,"-1883.290177206007885518558760085145850658")) - r197 = T(parse(BigFloat," 2148.230954488399755970660772306573864434")) - r198 = T(parse(BigFloat,"-1257.458401521712336970840850120592935471")) - r199 = T(parse(BigFloat," 296.4838434449778148523985255750527153802")) - r202 = T(parse(BigFloat," 1.810729313444845732964058528284532356045")) - r203 = T(parse(BigFloat,"-66.37479657295337371220255196726289169374")) - r204 = T(parse(BigFloat," 616.4952025401106511929691356878863855003")) - r205 = T(parse(BigFloat,"-2517.003030777322559684753470471663859295")) - r206 = T(parse(BigFloat," 5316.984175781033401491488704359579721604")) - r207 = T(parse(BigFloat,"-6064.976140789574108556866601189158423779")) - r208 = T(parse(BigFloat," 3550.109538888391317555902194852386816092")) - r209 = T(parse(BigFloat,"-837.0456783831301740195014698000522807852")) - r212 = T(parse(BigFloat,".5176008760353717918864555990277480363987e-1")) - r213 = T(parse(BigFloat,"-1.897337862580348756406065418550014243949")) - r214 = T(parse(BigFloat," 17.62264820793629244181715147639285955422")) - r215 = T(parse(BigFloat,"-71.94907400242465946110661282550878163878")) - r216 = T(parse(BigFloat," 151.9871383765666045085018751235590550206")) - r217 = T(parse(BigFloat,"-173.3686498747860565970136435029707518663")) - r218 = T(parse(BigFloat," 101.4806461521468075879782291473158292931")) - r219 = T(parse(BigFloat,"-23.92713108446217690295957956014097092250")) - r222 = T(parse(BigFloat," 31.32178255668799909977422939838912846070")) - r223 = T(parse(BigFloat,"-355.6570858339106059687054319211280026146")) - r224 = T(parse(BigFloat," 1752.685282489515979253875884672206842255")) - r225 = T(parse(BigFloat,"-4708.092293138363367969732154806019707156")) - r226 = T(parse(BigFloat," 7370.900776193488713149861391844801840850")) - r227 = T(parse(BigFloat,"-6716.504964764565347011489385051202629762")) - r228 = T(parse(BigFloat," 3303.940398161185772296756776169088470785")) - r229 = T(parse(BigFloat,"-678.5938956640391428503413103061359428182")) - r232 = T(parse(BigFloat,"-2.719607334185924760747802644504744092917")) - r233 = T(parse(BigFloat," 86.64045615858264001154848875638486632034")) - r234 = T(parse(BigFloat,"-454.1926030939030807863651114984001402596")) - r235 = T(parse(BigFloat," 1014.749221100543425314268817989377200147")) - r236 = T(parse(BigFloat,"-1133.583456714543865890388885909333783663")) - r237 = T(parse(BigFloat," 610.4671827718666569168001429679645990946")) - r238 = T(parse(BigFloat,"-109.0233499449543802317396567002119357593")) - r239 = T(parse(BigFloat,"-12.33784294340547057337599296127606178639")) - r242 = T(parse(BigFloat," 3.177214801432923432265738869490200556403")) - r243 = T(parse(BigFloat,"-113.8098697715142983214434051918276259885")) - r244 = T(parse(BigFloat," 978.0935981825675014833003847211971070224")) - r245 = T(parse(BigFloat,"-3575.129377623670076451027372711378100786")) - r246 = T(parse(BigFloat," 6764.361519838450570830405988615992045681")) - r247 = T(parse(BigFloat,"-6987.161043852012362644872233028628887679")) - r248 = T(parse(BigFloat," 3751.905762789571137088934326513342858381")) - r249 = T(parse(BigFloat,"-821.4378043648253954175634277881875971878")) - r252 = T(parse(BigFloat," .8772843083465530069477626269697233842708")) - r253 = T(parse(BigFloat,"-31.51810423988375104361582759389916060143")) - r254 = T(parse(BigFloat," 273.1229151353221133842213845530391043248")) - r255 = T(parse(BigFloat,"-993.2198643101781966584366870874238565290")) - r256 = T(parse(BigFloat," 1787.888078312663987193988385659681964836")) - r257 = T(parse(BigFloat,"-1677.394835799640950953367739332661886275")) - r258 = T(parse(BigFloat," 781.3579535062687952504707744453846824540")) - r259 = T(parse(BigFloat,"-141.1134269128985501802080532710905715931")) - r262 = T(parse(BigFloat," 1.719427581798715782378897599231938082126")) - r263 = T(parse(BigFloat,"-62.89867309250732184389962568482931880335")) - r264 = T(parse(BigFloat," 580.3335507873980391019057196688995930872")) - r265 = T(parse(BigFloat,"-2348.110620506760958600472968113883922730")) - r266 = T(parse(BigFloat," 4921.119298612906015908637628774963068611")) - r267 = T(parse(BigFloat,"-5597.912448707916639109910311016358007839")) - r268 = T(parse(BigFloat," 3288.597775149621789973016480733216881572")) - r269 = T(parse(BigFloat,"-782.8483098245396412116558219612402319811")) + r012 = T(-28.33048870061739823290767301658881994700) + r013 = T( 257.6535452078577977252092979905248156497) + r014 = T(-1152.154455743457311528752964691951881858) + r015 = T( 2909.390878345408890936564599116550031880) + r016 = T(-4355.005172868188498048946108887283528629) + r017 = T( 3834.083497036262189455855371796461857871) + r018 = T(-1835.419052683407081215583427992189311730) + r019 = T( 368.7958613829998340610814211036270246107) + r082 = T( 2.649656243770091212685381903551424676261) + r083 = T(-96.30312807816005963630382777245983513008) + r084 = T( 869.3095462492795755338599928089438369769) + r085 = T(-3395.688567551074115525201961265641584358) + r086 = T( 6796.933987158715680563278170147156885480) + r087 = T(-7340.848417712071304684606060804637321789) + r088 = T( 4082.848896992365666259441580054990759905) + r089 = T(-919.2934944890586676320942978986329899642) + r092 = T(-1.563945181928732780647121505551017046606) + r093 = T( 56.84239739272860000194549791973820565214) + r094 = T(-513.1052300304284642178552372517916694426) + r095 = T( 2004.286702110323162741493515173880535381) + r096 = T(-4011.853305913929339500285683507736138334) + r097 = T( 4332.895839278586189971336003691596594090) + r098 = T(-2409.879347937144606091337260195738587773) + r099 = T( 542.6079835318221405169412532400889768401) + r102 = T(-.8627103334967223830653368770735555216700) + r103 = T( 31.35565375185173442495465167501846267906) + r104 = T(-283.0413682227354209126847112083546012674) + r105 = T( 1105.613463426006937052739159664962261462) + r106 = T(-2213.036200678452629288185991597653042989) + r107 = T( 2390.131097754120588994847482867886207858) + r108 = T(-1329.348266146873716496636094950745123424) + r109 = T( 299.3158071265785138462868993727082901209) + r112 = T(-1.520295337901214839055193576160469820911) + r113 = T( 55.25592121120227100440616045452813504748) + r114 = T(-498.7844190970740738969945498750124435385) + r115 = T( 1948.346888525776056658403461666308795237) + r116 = T(-3899.882136407551390287649940376076923682) + r117 = T( 4211.964345158858030803618536151121927765) + r118 = T(-2342.619408856117128087568672414857706561) + r119 = T( 527.4637482204278644179968961638568925209) + r122 = T(-3.846938844125523400516071820264700141179) + r123 = T( 139.8189840986840520353362018994734906611) + r124 = T(-1262.118687621600386514715930156791825893) + r125 = T( 4930.075848057311658057235318456802793199) + r126 = T(-9868.219486069539059368988308801366826185) + r127 = T( 10657.90892434886730229746304583865145121) + r128 = T(-5927.738759872814112912292792695856187255) + r129 = T( 1334.688551172190921099749059976639173619) + r132 = T(-.3942713061200141454309326713125653612517) + r133 = T( 14.32999476067649707020689155180345562459) + r134 = T(-129.3540665994558117853022852051786116929) + r135 = T( 505.2816077002517600897861155496606850457) + r136 = T(-1011.390080139433268878243655218566636574) + r137 = T( 1092.325051781891697669369143688906543465) + r138 = T(-607.5317019302810290917918493845279272648) + r139 = T( 136.7917244480423273434147193694336909663) + r142 = T(-.9233145622082101394378429409444333268499) + r143 = T( 33.55834582309798808260613735851232640640) + r144 = T(-302.9246397549735936661321348695774835448) + r145 = T( 1183.281306967867553342903125095128753568) + r146 = T(-2368.498986790111516106072390247333149007) + r147 = T( 2558.034559755808027369106332027405169828) + r148 = T(-1422.733175577880214903071122439856598476) + r149 = T( 320.3423358787481875842587982911148385364) + r152 = T(-.2068862802930053801253649628830330891017) + r153 = T( 7.519388975651662772174695012120581518594) + r154 = T(-67.87605708082904058354114755731111898667) + r155 = T( 265.1367996984150421661637988925923843021) + r156 = T(-530.7074807559025368587558119659212235622) + r157 = T( 573.1765495641490277116961329189087439579) + r158 = T(-318.7905688834868978004500126002971837241) + r159 = T( 71.77882490212657594681492031347005327988) + r172 = T(-.4472441906744099441704338175964823026105) + r173 = T( 16.44684676010503791623763886833381020592) + r174 = T(-154.4086105921295528355180056633078150675) + r175 = T( 641.8986298540248497333509289273669726482) + r176 = T(-1391.939225687982391028602609567895699003) + r177 = T( 1643.890568302952013019278202625162156841) + r178 = T(-1004.065297223317845596795060426393517046) + r179 = T( 248.6243327770222987362193390543305737239) + r182 = T(-.1507876007899797948720901584434839156279) + r183 = T( 5.527328824824632235316362126620825363280) + r184 = T(-51.33833743084618751433903968701557585387) + r185 = T( 209.6022002703280347991393999433060881829) + r186 = T(-442.7692650421825928714839983614217797969) + r187 = T( 505.0579312588052893780948070449787925777) + r188 = T(-295.6336410615619366143935619944592839974) + r189 = T( 69.70457078142274038253812108643441743987) + r192 = T(-.6413652207435296452288504944964177537185) + r193 = T( 23.51013248624684600263471193689787394701) + r194 = T(-218.3642683246972281497485359238725613162) + r195 = T( 891.5292818535365634586829868055833114383) + r196 = T(-1883.290177206007885518558760085145850658) + r197 = T( 2148.230954488399755970660772306573864434) + r198 = T(-1257.458401521712336970840850120592935471) + r199 = T( 296.4838434449778148523985255750527153802) + r202 = T( 1.810729313444845732964058528284532356045) + r203 = T(-66.37479657295337371220255196726289169374) + r204 = T( 616.4952025401106511929691356878863855003) + r205 = T(-2517.003030777322559684753470471663859295) + r206 = T( 5316.984175781033401491488704359579721604) + r207 = T(-6064.976140789574108556866601189158423779) + r208 = T( 3550.109538888391317555902194852386816092) + r209 = T(-837.0456783831301740195014698000522807852) + r212 = T(.5176008760353717918864555990277480363987e-1) + r213 = T(-1.897337862580348756406065418550014243949) + r214 = T( 17.62264820793629244181715147639285955422) + r215 = T(-71.94907400242465946110661282550878163878) + r216 = T( 151.9871383765666045085018751235590550206) + r217 = T(-173.3686498747860565970136435029707518663) + r218 = T( 101.4806461521468075879782291473158292931) + r219 = T(-23.92713108446217690295957956014097092250) + r222 = T( 31.32178255668799909977422939838912846070) + r223 = T(-355.6570858339106059687054319211280026146) + r224 = T( 1752.685282489515979253875884672206842255) + r225 = T(-4708.092293138363367969732154806019707156) + r226 = T( 7370.900776193488713149861391844801840850) + r227 = T(-6716.504964764565347011489385051202629762) + r228 = T( 3303.940398161185772296756776169088470785) + r229 = T(-678.5938956640391428503413103061359428182) + r232 = T(-2.719607334185924760747802644504744092917) + r233 = T( 86.64045615858264001154848875638486632034) + r234 = T(-454.1926030939030807863651114984001402596) + r235 = T( 1014.749221100543425314268817989377200147) + r236 = T(-1133.583456714543865890388885909333783663) + r237 = T( 610.4671827718666569168001429679645990946) + r238 = T(-109.0233499449543802317396567002119357593) + r239 = T(-12.33784294340547057337599296127606178639) + r242 = T( 3.177214801432923432265738869490200556403) + r243 = T(-113.8098697715142983214434051918276259885) + r244 = T( 978.0935981825675014833003847211971070224) + r245 = T(-3575.129377623670076451027372711378100786) + r246 = T( 6764.361519838450570830405988615992045681) + r247 = T(-6987.161043852012362644872233028628887679) + r248 = T( 3751.905762789571137088934326513342858381) + r249 = T(-821.4378043648253954175634277881875971878) + r252 = T( .8772843083465530069477626269697233842708) + r253 = T(-31.51810423988375104361582759389916060143) + r254 = T( 273.1229151353221133842213845530391043248) + r255 = T(-993.2198643101781966584366870874238565290) + r256 = T( 1787.888078312663987193988385659681964836) + r257 = T(-1677.394835799640950953367739332661886275) + r258 = T( 781.3579535062687952504707744453846824540) + r259 = T(-141.1134269128985501802080532710905715931) + r262 = T( 1.719427581798715782378897599231938082126) + r263 = T(-62.89867309250732184389962568482931880335) + r264 = T( 580.3335507873980391019057196688995930872) + r265 = T(-2348.110620506760958600472968113883922730) + r266 = T( 4921.119298612906015908637628774963068611) + r267 = T(-5597.912448707916639109910311016358007839) + r268 = T( 3288.597775149621789973016480733216881572) + r269 = T(-782.8483098245396412116558219612402319811) return r011,r012,r013,r014,r015,r016,r017,r018,r019,r082,r083,r084,r085,r086,r087,r088,r089,r092,r093,r094,r095,r096,r097,r098,r099,r102,r103,r104,r105,r106,r107,r108,r109,r112,r113,r114,r115,r116,r117,r118,r119,r122,r123,r124,r125,r126,r127,r128,r129,r132,r133,r134,r135,r136,r137,r138,r139,r142,r143,r144,r145,r146,r147,r148,r149,r152,r153,r154,r155,r156,r157,r158,r159,r172,r173,r174,r175,r176,r177,r178,r179,r182,r183,r184,r185,r186,r187,r188,r189,r192,r193,r194,r195,r196,r197,r198,r199,r202,r203,r204,r205,r206,r207,r208,r209,r212,r213,r214,r215,r216,r217,r218,r219,r222,r223,r224,r225,r226,r227,r228,r229,r232,r233,r234,r235,r236,r237,r238,r239,r242,r243,r244,r245,r246,r247,r248,r249,r252,r253,r254,r255,r256,r257,r258,r259,r262,r263,r264,r265,r266,r267,r268,r269 end diff --git a/test/check_error.jl b/test/check_error.jl index 9afca96f42..30e4a93b52 100644 --- a/test/check_error.jl +++ b/test/check_error.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, Base.Test +using OrdinaryDiffEq, Test f_ec(u,p,t) = exp(u) u0 = 0.0 # explosion time is 1.0 diff --git a/test/complex_tests.jl b/test/complex_tests.jl index 9c992ee458..be9f597058 100644 --- a/test/complex_tests.jl +++ b/test/complex_tests.jl @@ -1,10 +1,9 @@ # Solve the Landau-Zener problem i ψ' = H(t) ψ, with H(t) = [t 1;1 -t] -using Base.Test +using Test using StaticArrays using OrdinaryDiffEq, DiffEqBase -gc() H(t) = -im*(@SMatrix [t 1;1 -t]) fun(ψ,p,t) = H(t)*ψ diff --git a/test/composite_algorithm_test.jl b/test/composite_algorithm_test.jl index c3342557e0..a8710994ee 100644 --- a/test/composite_algorithm_test.jl +++ b/test/composite_algorithm_test.jl @@ -1,4 +1,5 @@ -using OrdinaryDiffEq, DiffEqProblemLibrary, Base.Test +using OrdinaryDiffEq, Test +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_linear, prob_ode_2Dlinear @testset "Composite Algorithm Tests" begin prob = prob_ode_2Dlinear choice_function(integrator) = (Int(integrator.t<0.5) + 1) diff --git a/test/data_array_test.jl b/test/data_array_test.jl index 35972467ea..04e339235a 100644 --- a/test/data_array_test.jl +++ b/test/data_array_test.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, Base.Test +using OrdinaryDiffEq, Test, LinearAlgebra mutable struct SimType{T} <: DEDataVector{T} x::Array{T,1} @@ -57,7 +57,7 @@ end sol(1.5:0.5:2.5) - @test [sol[i].f1 for i in eachindex(sol)] == [zeros(9);1.5*ones(5);-1.5*ones(4)] + @test [sol[i].f1 for i in eachindex(sol)] == [fill(0., 9);1.5*ones(5);-1.5*ones(4)] A = diagm([0.3,0.6,0.9]) B = [1 2 3].' @@ -70,19 +70,19 @@ end dx .= A*x.x + B*x.u end - input = (x,p,t)->(1*one(t)≤t≤2*one(t)?[one(t)]:[zero(t)]) - prob = DiscreteProblem((dx,x,p,t)->mysystem(t,x,dx,p,input), SimType2(zeros(3), zeros(1), zeros(1)), (0//1,4//1)) + input = (x,p,t)->(1*one(t)≤t≤2*one(t) ? [one(t)] : [zero(t)]) + prob = DiscreteProblem((dx,x,p,t)->mysystem(t,x,dx,p,input), SimType2(fill(0., 3), fill(0., 1), fill(0., 1)), (0//1,4//1)) sln = solve(prob, FunctionMap(scale_by_time=false), dt = 1//10) u1 = [sln[idx].u for idx in 1:length(sln)] - u2 = [sln(t).u for t in linspace(0,4,41)] + u2 = [sln(t).u for t in range(0,stop=4,length=41)] @test any(x->x[1]>0, u1) @test any(x->x[1]>0, u2) sln = solve(prob, FunctionMap(scale_by_time=true), dt = 1//10) u1 = [sln[idx].u for idx in 1:length(sln)] - u2 = [sln(t).u for t in linspace(0,4,41)] + u2 = [sln(t).u for t in range(0,stop=4,length=41)] @test any(x->x[1]>0, u1) @test any(x->x[1]>0, u2) @@ -90,14 +90,14 @@ end @test u1 == [sln[idx].u for idx in 1:length(sln)] # Show that discrete is the same u1 = [sln[idx].u for idx in 1:length(sln)] - u2 = [sln(t).u for t in linspace(0,4,41)] + u2 = [sln(t).u for t in range(0,stop=4,length=41)] @test any(x->x[1]>0, u1) @test any(x->x[1]>0, u2) sln = solve(prob, DP5(), dt = 1//10, adaptive=false) u1 = [sln[idx].u for idx in 1:length(sln)] - u2 = [sln(t).u for t in linspace(0,4,41)] + u2 = [sln(t).u for t in range(0,stop=4,length=41)] @test any(x->x[1]>0, u1) @test any(x->x[1]>0, u2) end diff --git a/test/differentiation_traits_tests.jl b/test/differentiation_traits_tests.jl index 1719809370..3be0d9cc30 100644 --- a/test/differentiation_traits_tests.jl +++ b/test/differentiation_traits_tests.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, Base.Test, DiffEqProblemLibrary +using OrdinaryDiffEq, Test @testset "Differentiation Trait Tests" begin jac_called = Ref(false) diff --git a/test/discrete_algorithm_test.jl b/test/discrete_algorithm_test.jl index 325936642f..9827c4f1c3 100644 --- a/test/discrete_algorithm_test.jl +++ b/test/discrete_algorithm_test.jl @@ -1,4 +1,5 @@ -using OrdinaryDiffEq, DiffEqProblemLibrary, Base.Test +using OrdinaryDiffEq, Test, Statistics +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_2Dlinear, prob_ode_linear @testset "Scalar Discrete Problem" begin prob = DiscreteProblem(0.5,(0.0,1.0)) diff --git a/test/export_tests.jl b/test/export_tests.jl index aa331807cb..89f200a1b5 100644 --- a/test/export_tests.jl +++ b/test/export_tests.jl @@ -1,6 +1,6 @@ using DiffEqBase using OrdinaryDiffEq -using Base.Test +using Test @testset "Export tests" begin @test DiffEqBase.undefined_exports(OrdinaryDiffEq) == [] diff --git a/test/integrator_interface_tests.jl b/test/integrator_interface_tests.jl index 0e6e5147c2..4a3ab0228f 100644 --- a/test/integrator_interface_tests.jl +++ b/test/integrator_interface_tests.jl @@ -1,7 +1,6 @@ using DiffEqBase: set_t!, set_u!, set_ut! using OrdinaryDiffEq -gc() println("First") # set_X!(integrator, integrator.X) should not change the result. @testset "Trivial $setter ($alg, inplace=$iip)" for alg in [RK4, Trapezoid], diff --git a/test/iterator_tests.jl b/test/iterator_tests.jl index 7d1dd1e1db..5cb7d0a544 100644 --- a/test/iterator_tests.jl +++ b/test/iterator_tests.jl @@ -1,4 +1,6 @@ -using OrdinaryDiffEq, DiffEqProblemLibrary, Base.Test, Compat, RecursiveArrayTools +using OrdinaryDiffEq, Test, Compat, RecursiveArrayTools +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_linear, prob_ode_2Dlinear + prob = prob_ode_linear sol = solve(prob,BS3();dt=1//2^(4),tstops=[0.5],saveat=0.01,save_everystep=true) @@ -60,12 +62,12 @@ B = integrator([1.0;2.0],idxs=1:2:5) integrator(A[1],0.5) @test A[1] == integrator(0.5) -A = zeros(3) +A = fill(0., 3) integrator(A,0.6,idxs=1:2:5) @test A == integrator(0.6;idxs=1:2:5) integrator = init(prob_ode_2Dlinear,Tsit5();dt=1//2^(4)) -ts = linspace(0,1,11) +ts = range(0, stop=1, length=11) us = Matrix{Float64}[] for (u,t) in TimeChoiceIterator(integrator,ts) push!(us,copy(u)) diff --git a/test/linear_method_tests.jl b/test/linear_method_tests.jl index cb088aa7d4..b819541163 100644 --- a/test/linear_method_tests.jl +++ b/test/linear_method_tests.jl @@ -1,8 +1,8 @@ -using OrdinaryDiffEq, Base.Test, DiffEqDevTools, DiffEqOperators +using OrdinaryDiffEq, Test, DiffEqDevTools, DiffEqOperators u0 = rand(2) A = DiffEqArrayOperator([2.0 -1.0; -1.0 2.0]) function (p::typeof(A))(::Type{Val{:analytic}},u0,p,t) - expm(p.A*t)*u0 + exp(p.A*t)*u0 end prob = ODEProblem(A,u0,(0.0,1.0)) @@ -26,7 +26,7 @@ sol = solve(prob,LinearImplicitEuler()) B = DiffEqArrayOperator(ones(2,2)) L = AffineDiffEqOperator{Float64}((A,B),(),rand(2)) function (p::typeof(L))(::Type{Val{:analytic}},u0,p,t) - expm((p.As[1].A+p.As[2].A)*t)*u0 + exp((p.As[1].A+p.As[2].A)*t)*u0 end # Midpoint splitting @@ -37,7 +37,7 @@ sol = solve(prob,MidpointSplitting(),dt=1/10) ## Midpoint splitting convergence -## +## ## We use the inhomogeneous Lorentz equation for an electron in a ## time-dependent field. To write this on matrix form and simplify ## comparison with the analytic solution, we introduce two dummy diff --git a/test/linear_nonlinear_convergence_tests.jl b/test/linear_nonlinear_convergence_tests.jl index 66f69d26c0..51ad288add 100644 --- a/test/linear_nonlinear_convergence_tests.jl +++ b/test/linear_nonlinear_convergence_tests.jl @@ -1,14 +1,13 @@ -using OrdinaryDiffEq, Base.Test, DiffEqDevTools, DiffEqOperators +using OrdinaryDiffEq, Test, DiffEqDevTools, DiffEqOperators, Random const μ = 1.01 linnonlin_f2 = (u,p,t) -> μ * u linnonlin_f1 = DiffEqArrayOperator(μ) -prob = SplitODEProblem(linnonlin_f1,linnonlin_f2,1/2,(0.0,1.0),func_cache=1/2) -(::typeof(prob.f))(::Type{Val{:analytic}},u0,p,t) = u0.*exp.(2μ*t) +fun = SplitFunction(linnonlin_f1, linnonlin_f2; analytic=(u0,p,t)->u0.*exp.(2μ*t)) +prob = SplitODEProblem(fun,1/2,(0.0,1.0)) println("Out-of-place") -gc() srand(100) -dts = 1./2.^(7:-1:4) #14->7 good plot +dts = 1 ./2 .^(7:-1:4) #14->7 good plot sim = test_convergence(dts,prob,GenericIIF1()) @test abs(sim.𝒪est[:l2]-1) < 0.2 sim = test_convergence(dts,prob,GenericIIF2()) @@ -29,18 +28,14 @@ sim = test_convergence(dts,prob,ETD2()) @test abs(sim.𝒪est[:l2]-2) < 0.2 println("Inplace") -gc() u0 = rand(2) A = [2.0 -1.0; -1.0 2.0] linnonlin_f1 = DiffEqArrayOperator(A) linnonlin_f2 = (du,u,p,t) -> du .= μ .* u -prob = SplitODEProblem(linnonlin_f1,linnonlin_f2,u0,(0.0,1.0)) -function (::typeof(prob.f))(::Type{Val{:analytic}},u0,p,t) - tmp = (A+μ*I)*t - expm(tmp)*u0 -end +fun = SplitFunction(linnonlin_f1,linnonlin_f2;analytic=(u0,p,t)->exp((A+μ*I)*t)*u0) +prob = SplitODEProblem(fun,u0,(0.0,1.0)) -dts = 1./2.^(8:-1:4) #14->7 good plot +dts = 1 ./2 .^(8:-1:4) #14->7 good plot sim = test_convergence(dts,prob,GenericIIF1()) @test abs(sim.𝒪est[:l2]-1) < 0.2 diff --git a/test/linear_nonlinear_krylov_tests.jl b/test/linear_nonlinear_krylov_tests.jl index d77bee6d5e..2724ede5a5 100644 --- a/test/linear_nonlinear_krylov_tests.jl +++ b/test/linear_nonlinear_krylov_tests.jl @@ -1,28 +1,24 @@ -using OrdinaryDiffEq, Base.Test, DiffEqOperators +using OrdinaryDiffEq, Test, DiffEqOperators, Random, LinearAlgebra @testset "Classical ExpRK" begin N = 20 - dx = 1.0; dt=0.1 + dt=0.1 srand(0); u0 = rand(N) reltol = 1e-4 - L = DerivativeOperator{Float64}(2,2,dx,N,:Dirichlet0,:Dirichlet0) + dd = -2 * ones(N); du = ones(N-1) + L = DiffEqArrayOperator(diagm(-1 => du, 0 => dd, 1 => du)) krylov_f2 = (u,p,t) -> -0.1*u krylov_f2! = (du,u,p,t) -> du .= -0.1*u prob = SplitODEProblem(L,krylov_f2,u0,(0.0,1.0)) prob_inplace = SplitODEProblem(L,krylov_f2!,u0,(0.0,1.0)) - # Ad-hoc fix for SplitFunction miscalssified as having analytic solutions - DiffEqBase.has_analytic(::typeof(prob.f)) = false - DiffEqBase.has_analytic(::typeof(prob_inplace.f)) = false - Algs = [LawsonEuler,NorsettEuler,ETDRK2,ETDRK3,ETDRK4,HochOst4] for Alg in Algs - gc() - sol = solve(prob, Alg(); dt=dt, internalnorm=Base.norm) - sol_krylov = solve(prob, Alg(krylov=true, m=10); dt=dt, reltol=reltol, internalnorm=Base.norm) + sol = solve(prob, Alg(); dt=dt) + sol_krylov = solve(prob, Alg(krylov=true, m=10); dt=dt, reltol=reltol) @test isapprox(sol.u,sol_krylov.u; rtol=reltol) - sol_ip = solve(prob_inplace, Alg(); dt=dt, internalnorm=Base.norm) - sol_ip_krylov = solve(prob_inplace, Alg(krylov=true, m=10); dt=dt, reltol=reltol, internalnorm=Base.norm) + sol_ip = solve(prob_inplace, Alg(); dt=dt) + sol_ip_krylov = solve(prob_inplace, Alg(krylov=true, m=10); dt=dt, reltol=reltol) @test isapprox(sol.u,sol_krylov.u; rtol=reltol) println(Alg) # prevent Travis hanging @@ -34,41 +30,39 @@ end srand(0); u0 = normalize(randn(N)) # For the moment, use dense Jacobian dd = -2 * ones(N); du = ones(N-1) - A = diagm(du, -1) + diagm(dd) + diagm(du, 1) + A = diagm(-1 => du, 0 => dd, 1 => du) _f = (u,p,t) -> A*u - u.^3 - _f_ip = (du,u,p,t) -> (A_mul_B!(du, A, u); du .-= u.^3) - _jac = (u,p,t) -> A - 3 * diagm(u.^2) + _f_ip = (du,u,p,t) -> (mul!(du, A, u); du .-= u.^3) + _jac = (u,p,t) -> A - 3 * diagm(0 => u.^2) _jac_ip = (J,u,p,t) -> begin - copy!(J, A) + copyto!(J, A) @inbounds for i = 1:N J[i, i] -= 3 * u[i]^2 end end - f = DiffEqFunction{false}(_f; jac=_jac) - f_ip = DiffEqFunction{true}(_f_ip; jac=_jac_ip) + f = ODEFunction(_f; jac=_jac) + f_ip = ODEFunction(_f_ip; jac=_jac_ip) prob = ODEProblem(f, u0, (0.0, 1.0)) - prob_ip = ODEProblem{true}(f_ip, u0, (0.0, 1.0)) + prob_ip = ODEProblem(f_ip, u0, (0.0, 1.0)) dt = 0.05; tol=1e-5 Algs = [Exp4, EPIRK4s3A, EPIRK4s3B, EXPRB53s3, EPIRK5P1, EPIRK5P2] for Alg in Algs - gc() - sol = solve(prob, Alg(); dt=dt, internalnorm=Base.norm, reltol=tol) + sol = solve(prob, Alg(); dt=dt, reltol=tol) sol_ref = solve(prob, Tsit5(); reltol=tol) @test isapprox(sol(1.0), sol_ref(1.0); rtol=tol) - sol = solve(prob_ip, Alg(); dt=dt, internalnorm=Base.norm, reltol=tol) + sol = solve(prob_ip, Alg(); dt=dt, reltol=tol) sol_ref = solve(prob_ip, Tsit5(); reltol=tol) @test isapprox(sol(1.0), sol_ref(1.0); rtol=tol) println(Alg) # prevent Travis hanging end - gc() - sol = solve(prob, EPIRK5s3(); dt=dt, internalnorm=Base.norm, reltol=tol) + sol = solve(prob, EPIRK5s3(); dt=dt, reltol=tol) sol_ref = solve(prob, Tsit5(); reltol=tol) @test_broken isapprox(sol(1.0), sol_ref(1.0); rtol=tol) - sol = solve(prob_ip, EPIRK5s3(); dt=dt, internalnorm=Base.norm, reltol=tol) + sol = solve(prob_ip, EPIRK5s3(); dt=dt, reltol=tol) sol_ref = solve(prob_ip, Tsit5(); reltol=tol) @test_broken isapprox(sol(1.0), sol_ref(1.0); rtol=tol) println(EPIRK5s3) # prevent Travis hanging diff --git a/test/mass_matrix_tests.jl b/test/mass_matrix_tests.jl index f3fa13c162..86d246dd13 100644 --- a/test/mass_matrix_tests.jl +++ b/test/mass_matrix_tests.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, Base.Test +using OrdinaryDiffEq, Test, LinearAlgebra, Statistics # TODO: clean up @testset "Mass Matrix Accuracy Tests" begin @@ -7,12 +7,12 @@ using OrdinaryDiffEq, Base.Test 2 1 3] mm_b = mm_A*ones(3) function mm_f(du,u,p,t) - A_mul_B!(du,mm_A,u) + mul!(du,mm_A,u) tmp = t*mm_b du .+= tmp end mm_f(::Type{Val{:analytic}},u0,p,t) = @. 2ones(3)*exp(t) - t - 1 - mm_g(du,u,p,t) = du .= u + t + mm_g(du,u,p,t) = du .= u .+ t mm_g(::Type{Val{:analytic}},u0,p,t) = @. 2ones(3)*exp(t) - t - 1 prob2 = ODEProblem(mm_g,ones(3),(0.0,1.0)) prob = ODEProblem(mm_f,ones(3),(0.0,1.0),mass_matrix=mm_A) @@ -99,7 +99,7 @@ sol2 = solve(prob2, TRBDF2(),adaptive=false,dt=1/10) u0 = [0.,1.] tspan = (0.0, 1.0) - M = zeros(2,2) + M = fill(0., 2,2) M[1,1] = 1. m_ode_prob = ODEProblem(f!, u0, tspan, mass_matrix=M) @@ -115,7 +115,7 @@ sol2 = solve(prob2, TRBDF2(),adaptive=false,dt=1/10) du[2] = u[1] return end - u0 = zeros(2) + u0 = fill(0., 2) m_ode_prob = ODEProblem(f2!, u0, tspan, mass_matrix=M) @test_nowarn sol = solve(m_ode_prob, Rosenbrock23()) diff --git a/test/ode/adams_tests.jl b/test/ode/adams_tests.jl index 3bc7172059..97bf6156f9 100644 --- a/test/ode/adams_tests.jl +++ b/test/ode/adams_tests.jl @@ -1,14 +1,13 @@ -using OrdinaryDiffEq, DiffEqDevTools, DiffEqBase, - DiffEqProblemLibrary, Base.Test -gc() +using OrdinaryDiffEq, DiffEqDevTools, DiffEqBase, Test +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_linear, prob_ode_2Dlinear -probArr = Vector{ODEProblem}(2) +probArr = Vector{ODEProblem}(undef, 2) probArr[1] = prob_ode_linear probArr[2] = prob_ode_2Dlinear function fixed_step_ϕstar(k) - ∇ = Vector{typeof(k[end][1])}(3) + ∇ = Vector{typeof(k[end][1])}(undef, 3) ∇[1] = k[end][1] ∇[2] = ∇[1] - k[end-1][1] ∇[3] = ∇[2] - k[end-1][1] + k[end-2][1] diff --git a/test/ode/nordsieck_tests.jl b/test/ode/nordsieck_tests.jl index 1e3ffe3f5c..cc888d86c9 100644 --- a/test/ode/nordsieck_tests.jl +++ b/test/ode/nordsieck_tests.jl @@ -1,4 +1,5 @@ -using OrdinaryDiffEq, DiffEqDevTools, DiffEqProblemLibrary, Base.Test +using OrdinaryDiffEq, DiffEqDevTools, Test, Random +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_linear, prob_ode_2Dlinear srand(100) linear_bigαN = big"0.5" @@ -9,7 +10,7 @@ f_2dlinearbig = (du,u,p,t) -> (du.=linear_bigαN*u) probArr = [ODEProblem(f_linearbig, big"0.5", (0,1.)), ODEProblem(f_2dlinearbig, big.(rand(4,2)), (0,1.)),] testTol = 0.2 -dts = 1.//2.^(10:-1:4) +dts = 1 .//(2 .^(10:-1:4)) @testset "Nordsieck Convergence Tests" begin for i in eachindex(probArr) diff --git a/test/ode/ode_add_steps_tests.jl b/test/ode/ode_add_steps_tests.jl index 2990e4bff4..e6c2c99924 100644 --- a/test/ode/ode_add_steps_tests.jl +++ b/test/ode/ode_add_steps_tests.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, Base.Test +using OrdinaryDiffEq, Test function test_ode(u, p, t) [p[1] - (1 - p[1])*u[1]] @@ -12,7 +12,7 @@ end test_solution(t) = t <= 5 ? t : 5. * e^(-(t-5)) tspan = (0.,10.) -testtimes = linspace(tspan..., 1001) +testtimes = range(tspan[1], stop=tspan[2], length=1001) pullback_condition(u, t, i) = t - 5 pullback_affect!(i) = i.p[1] = abs(1 - i.p[1]) cb = ContinuousCallback(pullback_condition, pullback_affect!) @@ -49,5 +49,5 @@ for inplace in [false,true], alg in lazy_alg passed[cur_itr] = pass && !fail end -any(.!(passed)) && warn("The following algorithms failed the continuous callback test: $(vcat(algs,algs,lazy_alg,lazy_alg)[.!(passed)])") +any(.!(passed)) && @warn("The following algorithms failed the continuous callback test: $(vcat(algs,algs,lazy_alg,lazy_alg)[.!(passed)])") @test all(passed) diff --git a/test/ode/ode_backwards_test.jl b/test/ode/ode_backwards_test.jl index 5be254673c..1ed84be308 100644 --- a/test/ode/ode_backwards_test.jl +++ b/test/ode/ode_backwards_test.jl @@ -1,4 +1,5 @@ -using OrdinaryDiffEq, DiffEqProblemLibrary, Base.Test +using OrdinaryDiffEq, Test, Statistics +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_2Dlinear, @testset "Backwards Tests" begin prob = deepcopy(prob_ode_2Dlinear) prob2 = ODEProblem(prob.f,prob.u0,(1.0,0.0)) diff --git a/test/ode/ode_cache_tests.jl b/test/ode/ode_cache_tests.jl index 1a1fba8983..76bcacad18 100644 --- a/test/ode/ode_cache_tests.jl +++ b/test/ode/ode_cache_tests.jl @@ -1,6 +1,6 @@ -using OrdinaryDiffEq, DiffEqBase, DiffEqCallbacks, Base.Test +using OrdinaryDiffEq, DiffEqBase, DiffEqCallbacks, Test -NON_IMPLICIT_ALGS = filter((x)->isleaftype(x) && !OrdinaryDiffEq.isimplicit(x()),union(subtypes(OrdinaryDiffEq.OrdinaryDiffEqAlgorithm),subtypes(OrdinaryDiffEq.OrdinaryDiffEqAdaptiveAlgorithm))) +NON_IMPLICIT_ALGS = filter((x)->isconcretetype(x) && !OrdinaryDiffEq.isimplicit(x()),union(subtypes(OrdinaryDiffEq.OrdinaryDiffEqAlgorithm),subtypes(OrdinaryDiffEq.OrdinaryDiffEqAdaptiveAlgorithm))) f = function (du,u,p,t) for i in 1:length(u) @@ -34,11 +34,11 @@ sol = solve(prob,Tsit5(),callback=callback) sol = solve(prob,GenericImplicitEuler(nlsolve=OrdinaryDiffEq.NLSOLVEJL_SETUP(chunk_size=1)),callback=callback,dt=1/2) sol = solve(prob,GenericTrapezoid(nlsolve=OrdinaryDiffEq.NLSOLVEJL_SETUP(chunk_size=1)),callback=callback,dt=1/2) -=# sol = solve(prob,Rosenbrock23(chunk_size=1),callback=callback,dt=1/2) sol = solve(prob,Rosenbrock32(chunk_size=1),callback=callback,dt=1/2) +=# for alg in CACHE_TEST_ALGS sol = solve(prob,alg,callback=callback,dt=1/2) diff --git a/test/ode/ode_convergence_tests.jl b/test/ode/ode_convergence_tests.jl index 75e2d6b790..d6f17bb7fe 100644 --- a/test/ode/ode_convergence_tests.jl +++ b/test/ode/ode_convergence_tests.jl @@ -1,7 +1,7 @@ # This definitely needs cleaning -using OrdinaryDiffEq, DiffEqDevTools, DiffEqBase, - DiffEqProblemLibrary, Base.Test -probArr = Vector{ODEProblem}(2) +using OrdinaryDiffEq, DiffEqDevTools, DiffEqBase, Test, Random +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_linear, prob_ode_2Dlinear +probArr = Vector{ODEProblem}(undef, 2) probArr[1] = prob_ode_linear probArr[2] = prob_ode_2Dlinear diff --git a/test/ode/ode_dense_tests.jl b/test/ode/ode_dense_tests.jl index 804729bb8a..8dc4984fc4 100644 --- a/test/ode/ode_dense_tests.jl +++ b/test/ode/ode_dense_tests.jl @@ -1,6 +1,6 @@ -using OrdinaryDiffEq, DiffEqProblemLibrary, Base.Test, DiffEqBase -using ForwardDiff - +using OrdinaryDiffEq, Test, DiffEqBase +using ForwardDiff, Printf +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_linear, prob_ode_2Dlinear # use `PRINT_TESTS = true` to print the tests, including results const PRINT_TESTS = false @@ -9,21 +9,21 @@ print_results(x) = if PRINT_TESTS; @printf("%s \n", x) end # points and storage arrays used in the interpolation tests const interpolation_points = 0:1//2^(4):1 -const interpolation_results_1d = zeros(typeof(prob_ode_linear.u0), length(interpolation_points)) -const interpolation_results_2d = Vector{typeof(prob_ode_2Dlinear.u0)}(length(interpolation_points)) +const interpolation_results_1d = fill(zero(typeof(prob_ode_linear.u0)), length(interpolation_points)) +const interpolation_results_2d = Vector{typeof(prob_ode_2Dlinear.u0)}(undef, length(interpolation_points)) for idx in eachindex(interpolation_results_2d) - interpolation_results_2d[idx] = zeros(prob_ode_2Dlinear.u0) + interpolation_results_2d[idx] = zero(prob_ode_2Dlinear.u0) end f_linear_inplace = (du,u,p,t) -> begin @. du = 1.01 * u end (::typeof(f_linear_inplace))(::Type{Val{:analytic}}, u0, p, t) = exp(1.01*t)*u0 prob_ode_linear_inplace = ODEProblem(f_linear_inplace, [0.5], (0.,1.)) -const interpolation_results_1d_inplace = Vector{typeof(prob_ode_linear_inplace.u0)}(length(interpolation_points)) +const interpolation_results_1d_inplace = Vector{typeof(prob_ode_linear_inplace.u0)}(undef, length(interpolation_points)) for idx in eachindex(interpolation_results_1d_inplace) - interpolation_results_1d_inplace[idx] = zeros(prob_ode_linear_inplace.u0) + interpolation_results_1d_inplace[idx] = zero(prob_ode_linear_inplace.u0) end -const deriv_test_points = linspace(0,1,5) +const deriv_test_points = range(0, stop=1, length=5) function nth_derivative(fun, t, n) if n == 1 @@ -234,8 +234,8 @@ regression_test(Vern8(), 3e-8, 5e-8; test_diff1 = true) regression_test(Vern8(lazy=false), 3e-8, 5e-8; test_diff1 = true) # Vern9 -regression_test(Vern9(), 1e-9, 2e-9; test_diff1 = true, nth_der=4, dertol=1e-2) -regression_test(Vern9(lazy=false), 1e-9, 2e-9; test_diff1 = true, nth_der=4, dertol=1e-2) +regression_test(Vern9(), 1e-9, 2e-9; test_diff1 = true, nth_der=2, dertol=1e-2) +regression_test(Vern9(lazy=false), 1e-9, 2e-9; test_diff1 = true, dertol=1e-2) println("Rosenbrocks") diff --git a/test/ode/ode_event_tests.jl b/test/ode/ode_event_tests.jl index 1a4c8a3e66..1fd384d141 100644 --- a/test/ode/ode_event_tests.jl +++ b/test/ode/ode_event_tests.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, RecursiveArrayTools, Base.Test, StaticArrays +using OrdinaryDiffEq, RecursiveArrayTools, Test, StaticArrays f = function (u,p,t) diff --git a/test/ode/ode_initdt_tests.jl b/test/ode/ode_initdt_tests.jl index b8e1957f0b..04f132b527 100644 --- a/test/ode/ode_initdt_tests.jl +++ b/test/ode/ode_initdt_tests.jl @@ -1,4 +1,5 @@ -using OrdinaryDiffEq,DiffEqProblemLibrary, DiffEqDevTools, Base.Test +using OrdinaryDiffEq, DiffEqDevTools, Test +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_linear, prob_ode_2Dlinear @testset "Initial Dt Tests" begin prob = prob_ode_linear diff --git a/test/ode/ode_rosenbrock_tests.jl b/test/ode/ode_rosenbrock_tests.jl index d2d6690f7b..ea6c2670f4 100644 --- a/test/ode/ode_rosenbrock_tests.jl +++ b/test/ode/ode_rosenbrock_tests.jl @@ -1,6 +1,7 @@ ## Breakout these since no other test of their adaptivity -using OrdinaryDiffEq, DiffEqProblemLibrary, DiffEqDevTools, Base.Test +using OrdinaryDiffEq, DiffEqDevTools, Test +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_linear, prob_ode_2Dlinear dts = 1.//2.^(6:-1:3) testTol = 0.2 diff --git a/test/ode/ode_saveat_tests.jl b/test/ode/ode_saveat_tests.jl index f25685cd2c..40b24fb907 100644 --- a/test/ode/ode_saveat_tests.jl +++ b/test/ode/ode_saveat_tests.jl @@ -1,4 +1,5 @@ -using OrdinaryDiffEq, DiffEqProblemLibrary, Base.Test +using OrdinaryDiffEq, Test +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_linear, prob_ode_2Dlinear @testset "saveat Tests" begin prob = prob_ode_linear @@ -75,9 +76,9 @@ using OrdinaryDiffEq, DiffEqProblemLibrary, Base.Test @test sol2.t ≈ collect(0:1//100:1) - sol2=solve(prob,DP5(),dt=1//2^(2),save_everystep=false,dense=false,saveat=linspace(0,1,100)) + sol2=solve(prob,DP5(),dt=1//2^(2),save_everystep=false,dense=false,saveat=range(0,stop=1,length=100)) - @test sol2.t ≈ linspace(0,1,100) + @test sol2.t ≈ range(0,stop=1,length=100) f = (du,u,p,t) -> prob.f(du,u,p,t) prob2 = ODEProblem(f,vec(prob.u0),prob.tspan) diff --git a/test/ode/ode_saveidxs_tests.jl b/test/ode/ode_saveidxs_tests.jl index 9176acfa71..2648b57061 100644 --- a/test/ode/ode_saveidxs_tests.jl +++ b/test/ode/ode_saveidxs_tests.jl @@ -1,4 +1,6 @@ -using OrdinaryDiffEq, DiffEqProblemLibrary, Base.Test +using OrdinaryDiffEq, Test +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_linear, + linear, f_2dlinear @testset "save_idxs Tests" begin # scalar, not in-place @@ -7,22 +9,22 @@ using OrdinaryDiffEq, DiffEqProblemLibrary, Base.Test sol(0.5) # test interpolation # vector, not in-place - prob2 = ODEProblem(DiffEqProblemLibrary.linear, [0.5], (0., 1.)) + prob2 = ODEProblem(linear, [0.5], (0., 1.)) sol2 = solve(prob2, DP5(); save_idxs=1) - @test sol.t == sol2.t && sol.u == sol2.u + @test sol.t ≈ sol2.t && sol.u ≈ sol2.u sol2(0.5) sol2b = solve(prob2, DP5(); save_idxs=[1]) - @test sol.t == sol2b.t && sol.u == [u[1] for u in sol2b.u] + @test sol.t ≈ sol2b.t && sol.u ≈ [u[1] for u in sol2b.u] sol2b(0.5) # vector, in-place - prob3 = ODEProblem(DiffEqProblemLibrary.f_2dlinear, [0.5], (0., 1.)) + prob3 = ODEProblem(f_2dlinear, [0.5], (0., 1.)) sol3 = solve(prob3, DP5(); save_idxs=1) - @test sol.t == sol3.t && sol.u == sol3.u + @test sol.t ≈ sol3.t && sol.u ≈ sol3.u sol3(0.5) sol3b = solve(prob3, DP5(); save_idxs=[1]) - @test sol.t == sol3b.t && sol2b.u == sol3b.u + @test sol.t ≈ sol3b.t && sol2b.u ≈ sol3b.u sol3b(0.5) end diff --git a/test/ode/ode_ssprk_tests.jl b/test/ode/ode_ssprk_tests.jl index edc7a3d586..ece9d8cda4 100644 --- a/test/ode/ode_ssprk_tests.jl +++ b/test/ode/ode_ssprk_tests.jl @@ -1,4 +1,5 @@ -using OrdinaryDiffEq, DiffEqProblemLibrary, DiffEqDevTools, Base.Test +using OrdinaryDiffEq, DiffEqDevTools, Test, Random +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_linear, prob_ode_2Dlinear srand(100) @@ -73,9 +74,9 @@ sol = solve(test_problem_ssp_long, alg, dt=OrdinaryDiffEq.ssp_coefficient(alg), @test all(sol.u .>= 0) # test SSP property of dense output sol = solve(test_problem_ssp, alg, dt=1.) -@test mapreduce(t->all(0 .<= sol(t) .<= 1), (u,v)->u&&v, true, linspace(0,8)) +@test mapreduce(t->all(0 .<= sol(t) .<= 1), (u,v)->u&&v, true, range(0, stop=8, length=50)) sol = solve(test_problem_ssp_inplace, alg, dt=1.) -@test mapreduce(t->all(0 .<= sol(t) .<= 1), (u,v)->u&&v, true, linspace(0,8)) +@test mapreduce(t->all(0 .<= sol(t) .<= 1), (u,v)->u&&v, true, range(0, stop=8, length=50)) alg = SSPRK33() @@ -98,9 +99,9 @@ sol = solve(test_problem_ssp_long, alg, dt=OrdinaryDiffEq.ssp_coefficient(alg), @test all(sol.u .>= 0) # test SSP property of dense output sol = solve(test_problem_ssp, alg, dt=1.) -@test mapreduce(t->all(0 .<= sol(t) .<= 1), (u,v)->u&&v, true, linspace(0,8)) +@test mapreduce(t->all(0 .<= sol(t) .<= 1), (u,v)->u&&v, true, range(0, stop=8, length=50)) sol = solve(test_problem_ssp_inplace, alg, dt=1.) -@test mapreduce(t->all(0 .<= sol(t) .<= 1), (u,v)->u&&v, true, linspace(0,8)) +@test mapreduce(t->all(0 .<= sol(t) .<= 1), (u,v)->u&&v, true, range(0, stop=8, length=50)) alg = SSPRK53() @@ -194,9 +195,9 @@ sol = solve(test_problem_ssp_long, alg, dt=OrdinaryDiffEq.ssp_coefficient(alg), @test all(sol.u .>= 0) # test SSP property of dense output sol = solve(test_problem_ssp, alg, dt=8/5, adaptive=false) -@test mapreduce(t->all(0 .<= sol(t) .<= 1), (u,v)->u&&v, true, linspace(0,8)) +@test mapreduce(t->all(0 .<= sol(t) .<= 1), (u,v)->u&&v, true, range(0, stop=8, length=50)) sol = solve(test_problem_ssp_inplace, alg, dt=8/5, adaptive=false) -@test mapreduce(t->all(0 .<= sol(t) .<= 1), (u,v)->u&&v, true, linspace(0,8)) +@test mapreduce(t->all(0 .<= sol(t) .<= 1), (u,v)->u&&v, true, range(0, stop=8, length=50)) alg = SSPRK932() diff --git a/test/ode/ode_tstops_tests.jl b/test/ode/ode_tstops_tests.jl index b6872de9a7..1c8a3767a6 100644 --- a/test/ode/ode_tstops_tests.jl +++ b/test/ode/ode_tstops_tests.jl @@ -1,4 +1,5 @@ -using OrdinaryDiffEq, Base.Test, DiffEqProblemLibrary +using OrdinaryDiffEq, Test, Random +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_linear srand(100) @testset "Tstops Tests on the Interval [0, 1]" begin @@ -25,8 +26,8 @@ srand(100) sol = solve(prob,RK4(),tstops=0:1//16:1, adaptive=false) @test sol.t == collect(0:1//16:1) - sol = solve(prob,RK4(),tstops=linspace(0,1,100), adaptive=false) - @test sol.t == collect(linspace(0,1,100)) + sol = solve(prob,RK4(),tstops=range(0,stop=1,length=100), adaptive=false) + @test sol.t == collect(range(0,stop=1,length=100)) end @testset "Integrator Tstops Tests on the Interval $(["[-1, 0]", "[0, 1]"][i])" for (i, tdir) in enumerate([-1.; 1.]) diff --git a/test/ode/ode_twodimlinear_tests.jl b/test/ode/ode_twodimlinear_tests.jl index 5c6b828fe4..c810ca0f41 100644 --- a/test/ode/ode_twodimlinear_tests.jl +++ b/test/ode/ode_twodimlinear_tests.jl @@ -1,4 +1,5 @@ -using OrdinaryDiffEq, DiffEqProblemLibrary +using OrdinaryDiffEq +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_2Dlinear prob = prob_ode_2Dlinear integrator = init(prob,Euler();dt=1//2^(4)) diff --git a/test/ode/progress_bar_tests.jl b/test/ode/progress_bar_tests.jl index 356a81e5ec..9dd0f61528 100644 --- a/test/ode/progress_bar_tests.jl +++ b/test/ode/progress_bar_tests.jl @@ -1,4 +1,5 @@ -using OrdinaryDiffEq, DiffEqProblemLibrary +using OrdinaryDiffEq +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_2Dlinear prob = deepcopy(prob_ode_2Dlinear) prob.tspan = (0.0,100.0) ## Solve and plot diff --git a/test/owrenzen_tests.jl b/test/owrenzen_tests.jl index 0a4264c4c2..f7dee97671 100644 --- a/test/owrenzen_tests.jl +++ b/test/owrenzen_tests.jl @@ -1,5 +1,6 @@ -using OrdinaryDiffEq, DiffEqDevTools, DiffEqBase, - DiffEqProblemLibrary, Base.Test +using OrdinaryDiffEq, DiffEqDevTools, DiffEqBase, Test, Random +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_2Dlinear, prob_ode_linear + srand(100) ## Convergence Testing dts = 1.//2.^(7:-1:4) diff --git a/test/partitioned_methods_tests.jl b/test/partitioned_methods_tests.jl index 89cb7de043..793e358947 100644 --- a/test/partitioned_methods_tests.jl +++ b/test/partitioned_methods_tests.jl @@ -1,8 +1,6 @@ -using OrdinaryDiffEq, Base.Test, RecursiveArrayTools, DiffEqDevTools +using OrdinaryDiffEq, Test, RecursiveArrayTools, DiffEqDevTools -gc() - -u0 = zeros(2) +u0 = fill(0., 2) v0 = ones(2) f1 = function (dv,v,u,p,t) dv .= -u @@ -10,11 +8,12 @@ end f2 = function (du,v,u,p,t) du .= v end -prob = DynamicalODEProblem(f1,f2,v0,u0,(0.0,5.0)) -function (::typeof(prob.f))(::Type{Val{:analytic}}, y0, p, x) +function analytic_sol(y0, p, x) v0, u0 = y0 ArrayPartition(-u0*sin(x) + v0*cos(x),u0*cos(x) + v0*sin(x)) end +fun = DynamicalODEFunction(f1,f2;analytic=analytic_sol) +prob = DynamicalODEProblem(fun,v0,u0,(0.0,5.0)) sol = solve(prob,SymplecticEuler(),dt=1/2) sol_verlet = solve(prob,VelocityVerlet(),dt=1/100) @@ -26,11 +25,8 @@ interps = sol(interp_time) sol_tsit5 = solve(prob,Tsit5()) -prob = SecondOrderODEProblem(f1,v0,u0,(0.0,5.0)) -function (::typeof(prob.f))(::Type{Val{:analytic}}, y0, p, x) - v0, u0 = y0 - ArrayPartition(-u0*sin(x) + v0*cos(x),u0*cos(x) + v0*sin(x)) -end +fun = DynamicalODEFunction(f1;analytic=analytic_sol) +prob = SecondOrderODEProblem(fun,v0,u0,(0.0,5.0)) sol2 = solve(prob,SymplecticEuler(),dt=1/2) sol2_verlet = solve(prob,VelocityVerlet(),dt=1/100) @@ -47,7 +43,7 @@ sol2_verlet(0.1) println("Convergence tests") -dts = 1.//2.^(6:-1:3) +dts = 1 .//2 .^(6:-1:3) # Symplectic Euler sim = test_convergence(dts,prob,SymplecticEuler(),dense_errors=true) @test sim.𝒪est[:l2] ≈ 1 rtol = 1e-1 @@ -91,7 +87,7 @@ sim = test_convergence(dts,prob,CalvoSanz4(),dense_errors=true) @test sim.𝒪est[:l2] ≈ 4 rtol = 1e-1 @test sim.𝒪est[:L2] ≈ 4 rtol = 1e-1 -dts = 1.//2.^(4:-1:0) +dts = 1 .//2 .^(4:-1:0) sim = test_convergence(dts,prob,McAte5(),dense_errors=true) @test sim.𝒪est[:l2] ≈ 5 rtol = 1e-1 @test sim.𝒪est[:L2] ≈ 4 rtol = 1e-1 @@ -115,7 +111,7 @@ sim = test_convergence(dts,prob,KahanLi8(),dense_errors=true) sol = solve(prob,Nystrom4(),dt=1/1000) # Nyström method -dts = 1.//2.^(9:-1:6) +dts = 1 .//2 .^(9:-1:6) sim = test_convergence(dts,prob,Nystrom4(),dense_errors=true) @test sim.𝒪est[:l2] ≈ 4 rtol = 1e-1 @test sim.𝒪est[:L2] ≈ 4 rtol = 1e-1 @@ -128,23 +124,19 @@ sim = test_convergence(dts,prob,IRKN3(),dense_errors=true) sim = test_convergence(dts,prob,IRKN4(),dense_errors=true) @test sim.𝒪est[:l2] ≈ 4 rtol = 1e-1 @test sim.𝒪est[:L2] ≈ 4 rtol = 1e-1 -dts = 1.0./2.0.^(5:-1:0) +dts = 1.0 ./2.0 .^(5:-1:0) sim = test_convergence(dts,prob,Nystrom5VelocityIndependent(),dense_errors=true) @test sim.𝒪est[:l2] ≈ 5 rtol = 1e-1 @test sim.𝒪est[:L2] ≈ 4 rtol = 1e-1 -dts = 1.0./2.0.^(2:-1:-2) +dts = 1.0 ./2.0 .^(2:-1:-2) sim = test_convergence(dts,prob,SofSpa10(),dense_errors=true) @test sim.𝒪est[:l2] ≈ 10 rtol = 1e-1 @test sim.𝒪est[:L2] ≈ 4 rtol = 1e-1 # Methods need BigFloat to test convergence rate dts = big"1.0"./big"2.0".^(5:-1:1) -prob_big = SecondOrderODEProblem(f1,[big"1.0",big"1.0"],[big"0.0", big"0.0"],(big"0.",big"70.")) -function (::typeof(prob_big.f))(::Type{Val{:analytic}}, y0, p, x) - v0, u0 = y0 - ArrayPartition(-u0*sin(x) + v0*cos(x),u0*cos(x) + v0*sin(x)) -end +prob_big = SecondOrderODEProblem(fun,[big"1.0",big"1.0"],[big"0.0", big"0.0"],(big"0.",big"70.")) sim = test_convergence(dts,prob_big,DPRKN6(),dense_errors=true) @test sim.𝒪est[:l2] ≈ 6 rtol = 1e-1 @test sim.𝒪est[:L2] ≈ 6 rtol = 1e-1 @@ -171,7 +163,7 @@ sol = solve(prob, DPRKN12()) sol = solve(prob, ERKN4(),reltol=1e-8) @test length(sol.u) < 38 sol = solve(prob, ERKN5(),reltol=1e-8) -@test length(sol.u) < 29 +@test length(sol.u) < 31 # Test array partition outside of symplectic @@ -199,15 +191,12 @@ f22 = function (v,u,p,t) v end -prob = DynamicalODEProblem(f12,f22,v0,u0,(0.0,5.0)) -function (::typeof(prob.f))(::Type{Val{:analytic}}, y0, p, x) - v0, u0 = y0 - ArrayPartition(-u0*sin(x) + v0*cos(x),u0*cos(x) + v0*sin(x)) -end +fun = DynamicalODEFunction(f12,f22;analytic=analytic_sol) +prob = DynamicalODEProblem(fun,v0,u0,(0.0,5.0)) sol = solve(prob,SymplecticEuler(),dt=1/10) -dts = 1.//2.^(6:-1:3) +dts = 1 .//2 .^(6:-1:3) # Symplectic Euler sim = test_convergence(dts,prob,SymplecticEuler(),dense_errors=true) @test sim.𝒪est[:l2] ≈ 1 rtol = 1e-1 @@ -251,7 +240,7 @@ sim = test_convergence(dts,prob,CalvoSanz4(),dense_errors=true) @test sim.𝒪est[:l2] ≈ 4 rtol = 1e-1 @test sim.𝒪est[:L2] ≈ 4 rtol = 1e-1 -dts = 1.//2.^(4:-1:0) +dts = 1 .//2 .^(4:-1:0) sim = test_convergence(dts,prob,McAte5(),dense_errors=true) @test sim.𝒪est[:l2] ≈ 5 rtol = 1e-1 @test sim.𝒪est[:L2] ≈ 4 rtol = 1e-1 @@ -272,7 +261,7 @@ sim = test_convergence(dts,prob,KahanLi8(),dense_errors=true) @test sim.𝒪est[:L2] ≈ 4 rtol = 1e-1 # Nyström method -dts = 1.//2.^(9:-1:6) +dts = 1 .//2 .^(9:-1:6) sim = test_convergence(dts,prob,Nystrom4(),dense_errors=true) @test sim.𝒪est[:l2] ≈ 4 rtol = 1e-1 @test sim.𝒪est[:L2] ≈ 4 rtol = 1e-1 @@ -285,23 +274,19 @@ sim = test_convergence(dts,prob,Nystrom4VelocityIndependent(),dense_errors=true) @test_broken sim = test_convergence(dts,prob,IRKN4(),dense_errors=true) #@test_broken sim.𝒪est[:l2] ≈ 4 rtol = 1e-1 #@test_broken sim.𝒪est[:L2] ≈ 4 rtol = 1e-1 -dts = 1.0./2.0.^(5:-1:0) +dts = 1.0 ./2.0 .^(5:-1:0) sim = test_convergence(dts,prob,Nystrom5VelocityIndependent(),dense_errors=true) @test sim.𝒪est[:l2] ≈ 5 rtol = 1e-1 @test sim.𝒪est[:L2] ≈ 4 rtol = 1e-1 -dts = 1.0./2.0.^(2:-1:-2) +dts = 1.0 ./2.0 .^(2:-1:-2) sim = test_convergence(dts,prob,SofSpa10(),dense_errors=true) @test sim.𝒪est[:l2] ≈ 10 rtol = 1e-1 @test sim.𝒪est[:L2] ≈ 4 rtol = 1e-1 # Methods need BigFloat to test convergence rate dts = big"1.0"./big"2.0".^(5:-1:1) -prob_big = SecondOrderODEProblem(f12,big"1.0",big"0.0",(big"0.",big"70.")) -function (::typeof(prob_big.f))(::Type{Val{:analytic}}, y0, p, x) - v0, u0 = y0 - ArrayPartition(-u0*sin(x) + v0*cos(x),u0*cos(x) + v0*sin(x)) -end +prob_big = SecondOrderODEProblem(fun,big"1.0",big"0.0",(big"0.",big"70.")) sim = test_convergence(dts,prob_big,DPRKN6(),dense_errors=true) @test sim.𝒪est[:l2] ≈ 6 rtol = 1e-1 @test sim.𝒪est[:L2] ≈ 6 rtol = 1e-1 diff --git a/test/reinit_test.jl b/test/reinit_test.jl index 2656c47c51..c195344fe0 100644 --- a/test/reinit_test.jl +++ b/test/reinit_test.jl @@ -1,4 +1,5 @@ -using OrdinaryDiffEq, DiffEqProblemLibrary, DiffEqCallbacks, Base.Test +using OrdinaryDiffEq, DiffEqCallbacks, Test +import DiffEqProblemLibrary.ODEProblemLibrary: prob_ode_2Dlinear prob = prob_ode_2Dlinear diff --git a/test/runtests.jl b/test/runtests.jl index 0c52e3a44e..04479c9fdd 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,7 @@ using OrdinaryDiffEq -using Base.Test +using Test, LinearAlgebra, Statistics + +using DiffEqProblemLibrary.ODEProblemLibrary: importodeproblems; importodeproblems() const CPU_FLOPS = peakflops() const LONGER_TESTS = false @@ -15,7 +17,7 @@ else group = "All" end -is_APPVEYOR = ( is_windows() && haskey(ENV,"APPVEYOR") ) +is_APPVEYOR = ( Sys.iswindows() && haskey(ENV,"APPVEYOR") ) #Start Test Script @@ -62,6 +64,7 @@ if !is_APPVEYOR && ( group == "All" || group == "AlgConvergence_I" ) # ~ 2 s @time @testset "Adams Variable Coefficients Tests" begin include("ode/adams_tests.jl") end # ~ 50 s + # broken @time @testset "Nordsieck Tests" begin include("ode/nordsieck_tests.jl") end #@time @testset "Linear Methods Tests" begin include("linear_method_tests.jl") end # ~ 170 s diff --git a/test/split_methods_tests.jl b/test/split_methods_tests.jl index 128094c4f0..2a92c9f94f 100644 --- a/test/split_methods_tests.jl +++ b/test/split_methods_tests.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, DiffEqDevTools, Base.Test +using OrdinaryDiffEq, DiffEqDevTools, Test, Random testTol = 0.2 srand(100) @@ -42,10 +42,8 @@ sol3 = solve(prob2,Euler(),dt=1/10) f1 = (u,p,t) -> 2u f2 = (u,p,t) -> zero(u) -prob = SplitODEProblem(f1,f2,1.0,(0.0,1.0)) -function (::typeof(prob.f))(::Type{Val{:analytic}},u0,p,t) - exp(2t)*u0 -end +fun = SplitFunction(f1, f2; analytic=(u0,p,t)->exp(2t)*u0) +prob = SplitODEProblem(fun,1.0,(0.0,1.0)) sol = solve(prob,KenCarp3()) dts = 1.//2.^(8:-1:4) @@ -82,10 +80,8 @@ sim = test_convergence(dts,prob,CNLF2()) f1 = (u,p,t) -> zero(u) f2 = (u,p,t) -> 2u -prob = SplitODEProblem(f1,f2,1.0,(0.0,1.0)) -function (::typeof(prob.f))(::Type{Val{:analytic}},u0,p,t) - exp(2t)*u0 -end +fun = SplitFunction(f1, f2; analytic=(u0,p,t)->exp(2t)*u0) +prob = SplitODEProblem(fun,1.0,(0.0,1.0)) sol = solve(prob,KenCarp3()) dts = 1.//2.^(8:-1:4) @@ -122,10 +118,8 @@ sim = test_convergence(dts,prob,CNLF2()) f1 = (u,p,t) -> u f2 = (u,p,t) -> u -prob = SplitODEProblem(f1,f2,1.0,(0.0,1.0)) -function (::typeof(prob.f))(::Type{Val{:analytic}},u0,p,t) - exp(2t)*u0 -end +fun = SplitFunction(f1, f2; analytic=(u0,p,t)->exp(2t)*u0) +prob = SplitODEProblem(fun,1.0,(0.0,1.0)) sol = solve(prob,KenCarp3()) dts = 1.//2.^(12:-1:8) @@ -162,10 +156,8 @@ sim = test_convergence(dts,prob,CNLF2()) f1 = (du,u,p,t) -> du .= 2u f2 = (du,u,p,t) -> du .= 0.0 -prob = SplitODEProblem(f1,f2,rand(4,2),(0.0,1.0)) -function (::typeof(prob.f))(::Type{Val{:analytic}},u0,p,t) - exp(2t)*u0 -end +fun = SplitFunction(f1, f2; analytic=(u0,p,t)->exp(2t)*u0) +prob = SplitODEProblem(fun,rand(4,2),(0.0,1.0)) sol = solve(prob,KenCarp3()) dts = 1.//2.^(8:-1:4) @@ -202,10 +194,8 @@ sim = test_convergence(dts,prob,CNLF2()) f1 = (du,u,p,t) -> du.= 0.0 f2 = (du,u,p,t) -> du.= 2u -prob = SplitODEProblem(f1,f2,rand(4,2),(0.0,1.0)) -function (::typeof(prob.f))(::Type{Val{:analytic}},u0,p,t) - exp(2t)*u0 -end +fun = SplitFunction(f1, f2; analytic=(u0,p,t)->exp(2t)*u0) +prob = SplitODEProblem(fun,rand(4,2),(0.0,1.0)) sol = solve(prob,KenCarp3()) dts = 1.//2.^(8:-1:4) @@ -242,10 +232,8 @@ sim = test_convergence(dts,prob,CNLF2()) f1 = (du,u,p,t) -> du .= u f2 = (du,u,p,t) -> du .= u -prob = SplitODEProblem(f1,f2,rand(4,2),(0.0,1.0)) -function (::typeof(prob.f))(::Type{Val{:analytic}},u0,p,t) - exp(2t)*u0 -end +fun = SplitFunction(f1, f2; analytic=(u0,p,t)->exp(2t)*u0) +prob = SplitODEProblem(fun,rand(4,2),(0.0,1.0)) sol = solve(prob,KenCarp3()) dts = 1.//2.^(12:-1:8) diff --git a/test/static_array_tests.jl b/test/static_array_tests.jl index 9534b7d1fc..69b679f413 100644 --- a/test/static_array_tests.jl +++ b/test/static_array_tests.jl @@ -1,15 +1,15 @@ -using StaticArrays, Base.Test +using StaticArrays, Test using OrdinaryDiffEq @testset "Static Array Tests" begin - u0 = zeros(MVector{2,Float64}, 2) + u0 = fill(zero(MVector{2,Float64}), 2) u0[1] = ones(MVector{2,Float64}) + 1 f = (du,u,p,t) -> du .= u ode = ODEProblem(f, u0, (0.,1.)) sol = solve(ode, Euler(), dt=1.e-2) sol = solve(ode, Tsit5()) - u0 = zeros(SVector{2,Float64}, 2) + 1 + u0 = fill(zero(SVector{2,Float64}), 2) + 1 u0[1] = ones(SVector{2,Float64}) + 1 ode = ODEProblem(f, u0, (0.,1.)) sol = solve(ode, Euler(), dt=1.e-2) diff --git a/test/stiffness_detection_test.jl b/test/stiffness_detection_test.jl index 248c134f54..42df36ef2f 100644 --- a/test/stiffness_detection_test.jl +++ b/test/stiffness_detection_test.jl @@ -1,17 +1,18 @@ -using OrdinaryDiffEq, DiffEqProblemLibrary, Base.Test +using OrdinaryDiffEq, Test +import DiffEqProblemLibrary.ODEProblemLibrary: van @testset "Stiffness Detection Tests" begin - prob1 = ODEProblem(DiffEqProblemLibrary.van,[0,2.],(0.0,6),inv(0.003)) + prob1 = ODEProblem(van,[0,2.],(0.0,6),inv(0.003)) # out-of-place test - function van(u, p, t) + function _van(u, p, t) μ = p[1] [μ*((1-u[2]^2)*u[1] - u[2]), 1*u[1]] end - prob2 = ODEProblem(van,[0,2.],(0.0,6),inv(0.003)) + prob2 = ODEProblem(_van,[0,2.],(0.0,6),inv(0.003)) probArr = [prob1, prob2] # Test if switching back and forth - is_switching_fb(sol) = maximum(diff(find(x->x==2, sol.alg_choice))) > 5 + is_switching_fb(sol) = maximum(diff(findall(x->x==2, sol.alg_choice))) > 5 for prob in probArr alg = AutoTsit5(Rodas5(); maxstiffstep=5, maxnonstiffstep=5, stiffalgfirst=true) sol = solve(prob, alg) @@ -28,7 +29,7 @@ using OrdinaryDiffEq, DiffEqProblemLibrary, Base.Test @test length(sol.t) < 690 @test is_switching_fb(sol) sol = solve(prob,AutoVern7(Hairer42(); maxstiffstep=4, maxnonstiffstep=4)) - @test length(sol.t) < 535 + @test length(sol.t) < 540 @test is_switching_fb(sol) sol = solve(prob,AutoVern8(Rosenbrock23(); maxstiffstep=4, maxnonstiffstep=4)) @test length(sol.t) < 910 diff --git a/test/umodified_test.jl b/test/umodified_test.jl index 85abb67705..22fe49b188 100644 --- a/test/umodified_test.jl +++ b/test/umodified_test.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, Base.Test +using OrdinaryDiffEq, Test @testset "u_modifed Tests" begin T = 1000.0; Ttr = 0.0; diff --git a/test/utility_tests.jl b/test/utility_tests.jl index df1cecfd4b..5178cf69e8 100644 --- a/test/utility_tests.jl +++ b/test/utility_tests.jl @@ -1,10 +1,11 @@ using OrdinaryDiffEq: phi, phi, phiv, phiv_timestep, expv, expv_timestep, arnoldi, getH, getV +using LinearAlgebra, SparseArrays, Random, Test @testset "Exponential Utilities" begin # Scalar phi K = 4 z = 0.1 - P = zeros(K+1); P[1] = exp(z) + P = fill(0., K+1); P[1] = exp(z) for i = 1:K P[i+1] = (P[i] - 1/factorial(i-1))/z end @@ -12,7 +13,7 @@ using OrdinaryDiffEq: phi, phi, phiv, phiv_timestep, expv, expv_timestep, arnold # Matrix phi A = [0.1 0.2; 0.3 0.4] - P = Vector{Matrix{Float64}}(K+1); P[1] = expm(A) + P = Vector{Matrix{Float64}}(undef, K+1); P[1] = exp(A) for i = 1:K P[i+1] = (P[i] - 1/factorial(i-1)*I) / A end @@ -24,9 +25,9 @@ using OrdinaryDiffEq: phi, phi, phiv, phiv_timestep, expv, expv_timestep, arnold A = randn(n, n) t = 1e-2 b = randn(n) - @test expm(t * A) * b ≈ expv(t, A, b; m=m) + @test exp(t * A) * b ≈ expv(t, A, b; m=m) P = phi(t * A, K) - W = zeros(n, K+1) + W = fill(0., n, K+1) for i = 1:K+1 W[:,i] = P[i] * b end @@ -52,7 +53,7 @@ using OrdinaryDiffEq: phi, phi, phiv, phiv_timestep, expv, expv_timestep, arnold K = 4 t = 5.0 tol = 1e-7 - A = spdiagm((ones(n-1), -2*ones(n), ones(n-1)), (-1, 0, 1)) + A = spdiagm(-1=>ones(n-1), 0=>-2*ones(n), 1=>ones(n-1)) B = randn(n, K+1) Phi_half = phi(t/2 * A, K) Phi = phi(t * A, K)