From a2ee39ebb00052b318a1a766656dd64df7306c83 Mon Sep 17 00:00:00 2001 From: Luis Benet Date: Fri, 16 Aug 2024 22:29:09 -0600 Subject: [PATCH] Cleaning up --- src/bounds.jl | 24 +++++++++--------------- src/promotion.jl | 1 - src/valid_integ/validated_integ.jl | 18 ------------------ src/valid_integ/validated_integ2.jl | 12 ------------ 4 files changed, 9 insertions(+), 46 deletions(-) diff --git a/src/bounds.jl b/src/bounds.jl index cc76d36..ebe9861 100644 --- a/src/bounds.jl +++ b/src/bounds.jl @@ -15,20 +15,19 @@ Joldes PhD thesis (pp 52). """ function bound_remainder(::Type{TaylorModel1}, f::Function, polf::Taylor1, polfI::Taylor1, x0, I::Interval) - - _order = get_order(polf) + 1 - fTIend = polfI[_order] - bb = sup(fTIend) < 0 || inf(fTIend) > 0 - return _monot_bound_remainder(TaylorModel1, Val(bb), f, polf, polfI, x0, I) -end -function bound_remainder(::Type{TaylorModel1}, f::Function, polf::Taylor1{TaylorN{T}}, polfI::Taylor1, x0, I::Interval) where {T} - # The domain of the TaylorN part is assumed to be - # the normalized symmetric box _order = get_order(polf) + 1 fTIend = polfI[_order] bb = sup(fTIend) < 0 || inf(fTIend) > 0 return _monot_bound_remainder(TaylorModel1, Val(bb), f, polf, polfI, x0, I) end +# function bound_remainder(::Type{TaylorModel1}, f::Function, polf::Taylor1{TaylorN{T}}, polfI::Taylor1, x0, I::Interval) where {T} +# # The domain of the TaylorN part is assumed to be +# # the normalized symmetric box +# _order = get_order(polf) + 1 +# fTIend = polfI[_order] +# bb = sup(fTIend) < 0 || inf(fTIend) > 0 +# return _monot_bound_remainder(TaylorModel1, Val(bb), f, polf, polfI, x0, I) +# end """ @@ -45,7 +44,6 @@ remainder. This corresponds to Prop 2.3.7 in Mioara Joldes' PhD thesis (pp 67). """ function bound_remainder(::Type{RTaylorModel1}, f::Function, polf::Taylor1, polfI::Taylor1, x0, I::Interval) - _order = get_order(polf) + 1 fTIend = polfI[_order+1] a = Interval(inf(I)) @@ -85,6 +83,7 @@ end Δx0 = (f(x0) - polf[0])(symIbox) return hull(Δlo, Δx0, Δhi) end + """ _monot_bound_remainder(::Type{TaylorModel1}, ::Val{false}, f::Function, polf::Taylor1, polfI::Taylor1, x0, I::Interval) @@ -105,7 +104,6 @@ Computes the remainder exploiting monotonicity; see Prop 2.3.7 in Mioara Joldes' """ @inline function _monot_bound_remainder(::Type{RTaylorModel1}, ::Val{true}, f::Function, polf::Taylor1, polfI::Taylor1, x0, I::Interval) - _order = get_order(polf) + 1 a = Interval(inf(I)) b = Interval(sup(I)) @@ -122,7 +120,6 @@ Computes the remainder exploiting monotonicity; see Prop 2.3.7 in Mioara Joldes' end @inline function _monot_bound_remainder(::Type{RTaylorModel1}, ::Val{true}, f::Function, polf::Taylor1{TaylorN{T}}, polfI::Taylor1, x0, I::Interval) where {T} - _order = get_order(polf) + 1 a = Interval(inf(I)) b = Interval(sup(I)) @@ -157,7 +154,6 @@ tighter bound. """ function bound_taylor1(fT::Taylor1, I::Interval) - # Check if the fT is monotonous (the derivative has a given sign) fTd = TaylorSeries.derivative(fT) range_deriv = fTd(I) @@ -189,7 +185,6 @@ a definite sign. """ function bound_taylor1(fT::Taylor1{T}, fTd::Taylor1{T}, I::Interval{T}) where {T} - # I_lo = inf(I) I_hi = sup(I) if inf(fTd(I)) ≥ 0 @@ -201,7 +196,6 @@ function bound_taylor1(fT::Taylor1{T}, fTd::Taylor1{T}, I::Interval{T}) where {T end function bound_taylor1(fT::Taylor1{Interval{T}}, fTd::Taylor1{Interval{T}}, I::Interval{S}) where {T,S} - # I_lo = inf(I) I_hi = sup(I) if inf(fTd(I)) ≥ 0 diff --git a/src/promotion.jl b/src/promotion.jl index 32a1364..0130bd1 100644 --- a/src/promotion.jl +++ b/src/promotion.jl @@ -3,7 +3,6 @@ # # Promotion function promote(a::TaylorModelN{N,T,S}, b::R) where {N, T<:Real, S<:Real, R<:Real} - orderTMN = get_order(a[0]) apol, bb = promote(a.pol, b) a_rem = remainder(a) return (TaylorModelN(apol, a_rem, expansion_point(a), domain(a)), diff --git a/src/valid_integ/validated_integ.jl b/src/valid_integ/validated_integ.jl index 4853c49..5d104d2 100644 --- a/src/valid_integ/validated_integ.jl +++ b/src/valid_integ/validated_integ.jl @@ -154,12 +154,6 @@ function _validated_integ!(f!, t0::T, tmax::T, x, dx, xI, dxI, xTM1v[:, 1] = TaylorModel1(deepcopy(x), zI, zI, zI) end - # # parse_eqs == false - # # Internals: jet transport integration - # xaux = Array{Taylor1{TaylorN{T}}}(undef, dof) - # # Internals: Taylor1{Interval{T}} integration - # xauxI = Array{Taylor1{Interval{T}}}(undef, dof) - # Direction of the integration sign_tstep = copysign(1, tmax-t0) @@ -177,18 +171,6 @@ function _validated_integ!(f!, t0::T, tmax::T, x, dx, xI, dxI, orderT, red_abstol, params, adaptive, minabstol, absorb, check_property) δtI = sign_tstep * Interval(zt, sign_tstep*δt) - # # parse_eqs == false - # (_success, δt, red_abstol) = validated_step!(f!, t, x, dx, xaux, tI, xI, dxI, xauxI, - # t0, tmax, sign_tstep, xTMN, rem, zB, S, - # orderT, red_abstol, params, - # adaptive, minabstol, absorb, check_property) - # δtI = sign_tstep * Interval(zt, sign_tstep*δt) - # # parse_eqs == true - # (_success, δt, red_abstol) = validated_step!(f!, t, x, dx, rv, tI, xI, dxI, rvI, - # t0, tmax, sign_tstep, xTMN, rem, zB, S, - # orderT, red_abstol, params, - # adaptive, minabstol, absorb, check_property) - # δtI = sign_tstep * Interval(zt, sign_tstep*δt) # New initial conditions and time, and output vectors nsteps += 1 diff --git a/src/valid_integ/validated_integ2.jl b/src/valid_integ/validated_integ2.jl index 22335fb..be3a567 100644 --- a/src/valid_integ/validated_integ2.jl +++ b/src/valid_integ/validated_integ2.jl @@ -31,18 +31,6 @@ function validated_integ2(f!, X0, t0::T, tmax::T, orderQ::Int, orderT::Int, return _validated_integ2!(f!, t0, tmax, orderT, x, dx, rv, abstol, params, parse_eqs, maxsteps, adaptive, minabstol, absorb, validatesteps, ε, δ, absorb_steps) - # if parse_eqs - # # Re-initialize the Taylor1 expansions - # t = t0 + Taylor1( T, orderT ) - # initialize!(X0, orderQ, orderT, x) - # return _validated_integ2!(f!, t0, tmax, orderT, x, dx, rv, - # abstol, params, maxsteps, adaptive, minabstol, absorb, - # validatesteps, ε, δ, absorb_steps) - # else - # return _validated_integ2!(f!, t0, tmax, orderT, x, dx, - # abstol, params, maxsteps, adaptive, minabstol, absorb, - # validatesteps, ε, δ, absorb_steps) - # end end function _validated_integ2!(f!, t0::T, tf::T, orderT::Int, x, dx, rv,