Skip to content

Commit

Permalink
Fix exporting normalize_taylor (#294)
Browse files Browse the repository at this point in the history
* Fix exporting normalize_taylor

* Bump patch version
  • Loading branch information
lbenet authored Dec 2, 2021
1 parent 7581372 commit 427356d
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "TaylorSeries"
uuid = "6aa5eb33-94cf-58f4-a9d0-e4b2c4fc25ea"
repo = "https://github.com/JuliaDiff/TaylorSeries.jl.git"
version = "0.11.3"
version = "0.11.4"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
3 changes: 2 additions & 1 deletion src/TaylorSeries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export getcoeff, derivative, integrate, differentiate,
get_variable_names, get_variable_symbols,
# jacobian, hessian, jacobian!, hessian!,
∇, taylor_expand, update!,
constant_term, linear_polynomial, nonlinear_polynomial
constant_term, linear_polynomial, nonlinear_polynomial,
normalize_taylor

const TS = TaylorSeries

Expand Down
5 changes: 4 additions & 1 deletion src/auxiliary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,12 @@ numtype(a) = eltype(a)
@doc doc"""
numtype(a::AbstractSeries)
Return the type of the elements of the coefficients of `a`.
Returns the type of the elements of the coefficients of `a`.
""" numtype

# Dumb methods included to properly export normalize_taylor (if IntervalArithmetic is loaded)
@inline normalize_taylor(a::AbstractSeries) = a


## fixorder ##
for T in (:Taylor1, :TaylorN)
Expand Down
2 changes: 0 additions & 2 deletions src/intervals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ are mapped by an affine transformation to the intervals `-1..1`
normalize_taylor(a::TaylorN, I::IntervalBox{N,T}, symI::Bool=true) where {T<:Real,N} =
_normalize(a, I, Val(symI))

export normalize_taylor

# I -> -1..1
function _normalize(a::Taylor1, I::Interval{T}, ::Val{true}) where {T<:Real}
order = get_order(a)
Expand Down
2 changes: 2 additions & 0 deletions test/intervals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ eeuler = Base.MathConstants.e
@test eltype(x) == TaylorN{Interval{Float64}}
@test TS.numtype(ti) == Interval{Float64}
@test TS.numtype(x) == Interval{Float64}
@test normalize_taylor(ti) == ti
@test normalize_taylor(x) == x

@test p4(ti,-a) == (ti-a)^4
@test p5(ti,-a) == (ti-a)^5
Expand Down
2 changes: 2 additions & 0 deletions test/manyvariables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ using LinearAlgebra
@test convert(eltype(xH), xH) === xH
@test eltype(xH) == HomogeneousPolynomial{Int}
@test TS.numtype(xH) == Int
@test normalize_taylor(xH) == xH
@test length(xH) == 2
@test zero(xH) == 0*xH
@test one(yH) == xH+yH
Expand All @@ -197,6 +198,7 @@ using LinearAlgebra
@test convert(eltype(xT), xT) === xT
@test eltype(convert(TaylorN{Complex{Float64}},1)) == TaylorN{Complex{Float64}}
@test TS.numtype(convert(TaylorN{Complex{Float64}},1)) == Complex{Float64}
@test normalize_taylor(xT) == xT

@test 1+xT+yT == TaylorN(1,1) + TaylorN([xH,yH],1)
@test xT-yT-1 == TaylorN([-1,xH-yH])
Expand Down
6 changes: 6 additions & 0 deletions test/mixtures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ using LinearAlgebra, SparseArrays
@test TS.numtype(xH) == Int
@test eltype(tN) == Taylor1{TaylorN{Float64}}
@test TS.numtype(tN) == TaylorN{Float64}
@test normalize_taylor(tN) == tN
@test tN.order == 3
@test string(zero(tN)) == " 0.0 + 𝒪(‖x‖¹) + 𝒪(t⁴)"
@test string(tN) == " ( 1.0 + 𝒪(‖x‖¹)) t + 𝒪(t⁴)"
Expand All @@ -45,6 +46,7 @@ using LinearAlgebra, SparseArrays
@test convert(eltype(xHt), xHt) === xHt
@test eltype(xHt) == HomogeneousPolynomial{Taylor1{Float64}}
@test TS.numtype(xHt) == Taylor1{Float64}
@test normalize_taylor(xHt) == xHt
@test string(xHt) == " ( 1.0 + 𝒪(t¹)) x₁"
xHt = HomogeneousPolynomial([one(t), zero(t)])
yHt = HomogeneousPolynomial([zero(t), t])
Expand Down Expand Up @@ -73,6 +75,7 @@ using LinearAlgebra, SparseArrays
@test TS.numtype(xHt) == Taylor1{Float64}
@test TS.numtype(tN1) == Taylor1{Float64}
@test TS.numtype(Taylor1([xH])) == HomogeneousPolynomial{Int}
@test normalize_taylor(tN1) == tN1
@test get_order(HomogeneousPolynomial([Taylor1(1), 1.0+Taylor1(2)])) == 1
@test 3*tN1 == TaylorN([HomogeneousPolynomial([3t]),3xHt,3yHt^2])
@test t*tN1 == TaylorN([HomogeneousPolynomial([t^2]),xHt*t,t*yHt^2])
Expand Down Expand Up @@ -329,6 +332,9 @@ end
@testset "Tests with nested Taylor1s" begin
ti = Taylor1(3)
to = Taylor1([zero(ti), one(ti)], 9)
@test TS.numtype(to) == Taylor1{Float64}
@test normalize_taylor(to) == to
@test normalize_taylor(Taylor1([zero(to), one(to)], 5)) == Taylor1([zero(to), one(to)], 5)
@test convert(eltype(to), to) === to
@test string(to) == " ( 1.0 + 𝒪(t⁴)) t + 𝒪(t¹⁰)"
@test string(to^2) == " ( 1.0 + 𝒪(t⁴)) t² + 𝒪(t¹⁰)"
Expand Down
2 changes: 2 additions & 0 deletions test/onevariable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Base.iszero(::SymbNumber) = false
@test Taylor1{Float64} <: AbstractSeries{Float64}
@test TS.numtype(1.0) == eltype(1.0)
@test TS.numtype([1.0]) == eltype([1.0])
@test TS.normalize_taylor(t) == t
@test TS.normalize_taylor(tim) == tim

@test Taylor1([1,2,3,4,5], 2) == Taylor1([1,2,3])
@test Taylor1(t[0:3]) == Taylor1(t[0:get_order(t)], 4)
Expand Down

2 comments on commit 427356d

@lbenet
Copy link
Member Author

@lbenet lbenet commented on 427356d Dec 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/49804

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.11.4 -m "<description of version>" 427356d25b9340d1b92405ab03861dd0aa160614
git push origin v0.11.4

Please sign in to comment.