From c339604ea1d11407e0ca68fd0d01f1828a8fbc93 Mon Sep 17 00:00:00 2001 From: Uziel Linares Date: Sat, 5 Sep 2020 01:28:25 -0500 Subject: [PATCH 1/2] add aux function to select the bound to improve in the linear dominated algorithm --- src/bounds.jl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/bounds.jl b/src/bounds.jl index 3f6ec0cd..e21e3a64 100644 --- a/src/bounds.jl +++ b/src/bounds.jl @@ -195,6 +195,24 @@ function linear_dominated_bounder(fT::TaylorModel1{T, S}; ϵ=1e-3, max_iter=5) w return interval(bound.lo, hi) + fT.rem end +function linear_dominated_bounder(fT::TaylorModel1{T, S}, bound::Symbol=:lower, max_iter=5, tol=1e-5) where {T, S} + if bound == :upper + bound = linear_dominated_bounder(-fT, ϵ=tol, max_iter=max_iter) + elseif bound == :lower + bound = linear_dominated_bounder(fT, ϵ=tol, max_iter=max_iter) + elseif bound == :both + ldb_bounds = Array{IntervalBox{T}}(undef, 2) + aux = [-1, 1] + Threads.@threads @inbounds for i in eachindex(aux) + ldb_bounds[i] = linear_dominated_bounder(aux[i] * fT, ϵ=tol, max_iter=max_iter) + end + bound = ldb_bounds[1] ∩ ldb_bounds[2] + end + + return bound +end + + """ linear_dominated_bounder(fT::TaylorModelN, ϵ=1e-3::Float64, max_iter=5::Int) From 3ead2b9aa554a08d2354ccd711f61816036aff6d Mon Sep 17 00:00:00 2001 From: Uziel Linares Date: Sun, 6 Sep 2020 00:34:32 -0500 Subject: [PATCH 2/2] fix typos and add full signature to ldb --- src/bounds.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bounds.jl b/src/bounds.jl index e21e3a64..5d5a43a2 100644 --- a/src/bounds.jl +++ b/src/bounds.jl @@ -156,7 +156,7 @@ the bound of `fT` gets tighter than `ϵ` or the number of steps reachs `max_iter The returned bound corresponds to the improved polynomial bound with the remainder of the `TaylorModel1` included. """ -function linear_dominated_bounder(fT::TaylorModel1{T, S}; ϵ=1e-3, max_iter=5) where {T, S} +function linear_dominated_bounder(fT::TaylorModel1{T, S}; ϵ::Float64=1e-3, max_iter::Int=5) where {T, S} d = 1. Dn = fT.dom Dm = fT.x0 @@ -195,16 +195,16 @@ function linear_dominated_bounder(fT::TaylorModel1{T, S}; ϵ=1e-3, max_iter=5) w return interval(bound.lo, hi) + fT.rem end -function linear_dominated_bounder(fT::TaylorModel1{T, S}, bound::Symbol=:lower, max_iter=5, tol=1e-5) where {T, S} +function linear_dominated_bounder(fT::TaylorModel1{T, S}, bound::Symbol=:lower, max_iter::Int=5, tol::Float64=1e-5) where {T, S} if bound == :upper - bound = linear_dominated_bounder(-fT, ϵ=tol, max_iter=max_iter) + bound = -linear_dominated_bounder(-fT, ϵ=tol, max_iter=max_iter) elseif bound == :lower bound = linear_dominated_bounder(fT, ϵ=tol, max_iter=max_iter) elseif bound == :both - ldb_bounds = Array{IntervalBox{T}}(undef, 2) + ldb_bounds = Array{Interval{T}}(undef, 2) aux = [-1, 1] - Threads.@threads @inbounds for i in eachindex(aux) - ldb_bounds[i] = linear_dominated_bounder(aux[i] * fT, ϵ=tol, max_iter=max_iter) + Threads.@threads for i in eachindex(aux) + @inbounds ldb_bounds[i] = aux[i] * linear_dominated_bounder(aux[i] * fT, ϵ=tol, max_iter=max_iter) end bound = ldb_bounds[1] ∩ ldb_bounds[2] end