@@ -4,7 +4,7 @@ using TaylorSeries
44
55import Base: ^ , sqrt, log, asin, acos, acosh, atanh, iszero, ==
66
7- import TaylorSeries: _pow, pow!, evaluate, _evaluate, normalize_taylor
7+ import TaylorSeries: _pow, pow!, evaluate, _evaluate, normalize_taylor, aff_normalize
88
99using IntervalArithmetic
1010
815815evaluate (a:: TaylorN{Taylor1{T}} , vals:: AbstractVector{Interval{S}} ) where
816816 {T<: Real , S<: NumTypes } = TS. _evaluate (a, (vals... ,), Val (false ))
817817
818+
818819# _evaluate
819820function TS. _evaluate (a:: HomogeneousPolynomial{T} ,
820821 dx:: AbstractVector{Interval{S}} ) where {T<: Real , S<: NumTypes }
@@ -906,81 +907,80 @@ are mapped by an affine transformation to the intervals `-1..1`
906907normalize_taylor (a:: TaylorN , I:: AbstractVector{Interval{T}} ,
907908 symI:: Bool = true ) where {T<: NumTypes } = _normalize (a, I, Val (symI))
908909
910+ aff_normalize (x, I:: Interval , :: Val{true} ) = interval (mid (I)) + x* interval (radius (I))
911+ aff_normalize (x, I:: Interval , :: Val{false} ) = interval (inf (I)) + x* interval (diam (I))
912+
909913# I -> -1..1
910914function _normalize (a:: Taylor1 , I:: Interval{T} , :: Val{true} ) where {T<: NumTypes }
911- order = get_order (a)
912- t = Taylor1 (TS. numtype (a), order)
913- tnew = mid (I) + t* radius (I)
914- return a (tnew)
915+ t = Taylor1 (TS. numtype (a), get_order (a))
916+ return a (aff_normalize (t, I, Val (true )))
915917end
916918
917- function _normalize (a:: Taylor1{Interval{T}} , I:: Interval{T} , :: Val{true} ) where
918- {T<: NumTypes }
919- order = get_order (a)
920- t = Taylor1 (TS. numtype (a), order)
921- tnew = interval (mid (I)) + t* interval (radius (I))
922- return a (tnew)
923- end
919+ # function _normalize(a::Taylor1{Interval{T}}, I::Interval{T}, ::Val{true}) where
920+ # {T<:NumTypes}
921+ # t = Taylor1(TS.numtype(a), get_order(a))
922+ # return a(aff_normalize(t, I, Val(true)))
923+ # end
924924
925925# I -> 0..1
926926function _normalize (a:: Taylor1 , I:: Interval{T} , :: Val{false} ) where {T<: NumTypes }
927- order = get_order (a)
928- t = Taylor1 (TS. numtype (a), order)
929- tnew = inf (I) + t* diam (I)
930- return a (tnew)
927+ t = Taylor1 (TS. numtype (a), get_order (a))
928+ return a (aff_normalize (t, I, Val (false )))
931929end
932930
933- function _normalize (a:: Taylor1{Interval{T}} , I:: Interval{T} , :: Val{false} ) where
934- {T<: NumTypes }
935- order = get_order (a)
936- t = Taylor1 (TS. numtype (a), order)
937- tnew = interval (inf (I)) + t* interval (diam (I))
938- return a (tnew)
939- end
931+ # function _normalize(a::Taylor1{Interval{T}}, I::Interval{T}, ::Val{false}) where
932+ # {T<:NumTypes}
933+ # t = Taylor1(TS.numtype(a), get_order(a))
934+ # return a(aff_normalize(t, I, Val(false)))
935+ # end
940936
941937# I -> IntervalBox(-1..1, Val(N))
942938function _normalize (a:: TaylorN , I:: AbstractVector{Interval{T}} ,
943939 :: Val{true} ) where {T<: NumTypes }
944940 order = get_order (a)
945941 x = Vector {typeof(a)} (undef, length (I))
946942 @inbounds for ind in eachindex (x)
947- x[ind] = mid (I[ind]) + TaylorN (ind, order= order)* radius (I[ind])
943+ # x[ind] = mid(I[ind]) + TaylorN(ind, order=order)*radius(I[ind])
944+ x[ind] = aff_normalize (TaylorN (ind, order= order), I[ind], Val (true ))
948945 end
949946 return a (x)
950947end
951948
952- function _normalize (a:: TaylorN{Interval{T}} , I:: AbstractVector{Interval{T}} ,
953- :: Val{true} ) where {T<: NumTypes }
954- order = get_order (a)
955- x = Vector {typeof(a)} (undef, length (I))
956- @inbounds for ind in eachindex (x)
957- x[ind] = interval (mid (I[ind])) +
958- TaylorN (ind, order= order)* interval (radius (I[ind]))
959- end
960- return a (x)
961- end
949+ # function _normalize(a::TaylorN{Interval{T}}, I::AbstractVector{Interval{T}},
950+ # ::Val{true}) where {T<:NumTypes}
951+ # order = get_order(a)
952+ # x = Vector{typeof(a)}(undef, length(I))
953+ # @inbounds for ind in eachindex(x)
954+ # # x[ind] = interval(mid(I[ind])) +
955+ # # TaylorN(ind, order=order)*interval(radius(I[ind]))
956+ # x[ind] = aff_normalize(TaylorN(ind, order=order), I[ind], Val(true))
957+ # end
958+ # return a(x)
959+ # end
962960
963961# I -> IntervalBox(0..1, Val(N))
964962function _normalize (a:: TaylorN , I:: AbstractVector{Interval{T}} ,
965963 :: Val{false} ) where {T<: NumTypes }
966964 order = get_order (a)
967965 x = Vector {typeof(a)} (undef, length (I))
968966 @inbounds for ind in eachindex (x)
969- x[ind] = inf (I[ind]) + TaylorN (ind, order= order)* diam (I[ind])
967+ # x[ind] = inf(I[ind]) + TaylorN(ind, order=order)*diam(I[ind])
968+ x[ind] = aff_normalize (TaylorN (ind, order= order), I[ind], Val (false ))
970969 end
971970 return a (x)
972971end
973972
974- function _normalize (a:: TaylorN{Interval{T}} , I:: AbstractVector{Interval{T}} ,
975- :: Val{false} ) where {T<: NumTypes }
976- order = get_order (a)
977- x = Vector {typeof(a)} (undef, length (I))
978- @inbounds for ind in eachindex (x)
979- x[ind] = interval (inf (I[ind])) +
980- TaylorN (ind, order= order)* interval (diam (I[ind]))
981- end
982- return a (x)
983- end
973+ # function _normalize(a::TaylorN{Interval{T}}, I::AbstractVector{Interval{T}},
974+ # ::Val{false}) where {T<:NumTypes}
975+ # order = get_order(a)
976+ # x = Vector{typeof(a)}(undef, length(I))
977+ # @inbounds for ind in eachindex(x)
978+ # # x[ind] = interval(inf(I[ind])) +
979+ # # TaylorN(ind, order=order)*interval(diam(I[ind]))
980+ # x[ind] = aff_normalize(TaylorN(ind, order=order), I[ind], Val(false))
981+ # end
982+ # return a(x)
983+ # end
984984
985985# Printing-related methods numbr2str
986986function TS. numbr2str (zz:: Interval , ifirst:: Bool = false )
0 commit comments