Skip to content

Commit

Permalink
Improve Taylor1{TaylorN{T}} mixtures (#333)
Browse files Browse the repository at this point in the history
* Add tests for  Taylor1{TaylorN{T}}

* Add fixorder to Taylor1{TaylorN{T}}

* Add methods for arithm opers for Taylor1{TaylorN{T}}

* Add methods of ^, sqrt, pow!, sqr!, sqrt! for Taylor1{TaylorN{T}

* Add specialized methods for most mutating functions

for Taylor1{TaylorN{T}}

* Implement suggestions by @PerezHz

* Fix error in docs

* Use TS

* Improvements for evaluate

* Clean up commented (old) code

* Remove some superfluous methods in evaluate

* More fixes

* Fixes and clean-up of `evaluate` methods

* Returning a zero Homogeneouspolynomial is of order 0

* Scattered fixes and clean up

* Fix documentation

* Remove evaluate methods for TaylorN with Varargs,
and fix tests

* Fix _evaluate for mixtures, and new tests

* Methods of evaluate for Taylor1 involving TaylorN
(fixing certain type instability)

* Add tests for new evaluate methods

* Bump minor version

* Remove a `@show` left there
  • Loading branch information
lbenet authored Jan 31, 2024
1 parent 36586d7 commit f5587a7
Show file tree
Hide file tree
Showing 18 changed files with 1,421 additions and 500 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.15.4"
version = "0.16.0"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
3 changes: 1 addition & 2 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ div!
pow!
square
sqr!
sqr!(::HomogeneousPolynomial{T}, ::HomogeneousPolynomial{T}) where {T<:NumberNotSeriesN}
accsqr!
sqrt!
exp!
log!
Expand Down Expand Up @@ -105,6 +105,5 @@ _populate_dicts!

```@index
Pages = ["api.md"]
Module = ["TaylorSeries"]
Order = [:type, :function]
```
18 changes: 9 additions & 9 deletions ext/TaylorSeriesIAExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function ^(a::Taylor1{Interval{T}}, r::S) where {T<:Real, S<:Real}
c_order = l0 == 0 ? a.order : min(a.order, trunc(Int,r*a.order))
c = Taylor1(zero(aux), c_order)
for k = 0:c_order
TaylorSeries.pow!(c, aa, r, k)
TS.pow!(c, aa, r, k)
end

return c
Expand All @@ -66,7 +66,7 @@ function ^(a::TaylorN{Interval{T}}, r::S) where {T<:Real, S<:Real}

c = TaylorN( a0r, a.order)
for ord in 1:a.order
TaylorSeries.pow!(c, aa, r, ord)
TS.pow!(c, aa, r, ord)
end

return c
Expand All @@ -84,7 +84,7 @@ for T in (:Taylor1, :TaylorN)
aa[0] = one(aux) * a0
c = $T( aux, order )
for k in eachindex(a)
TaylorSeries.log!(c, aa, k)
TS.log!(c, aa, k)
end
return c
end
Expand All @@ -101,7 +101,7 @@ for T in (:Taylor1, :TaylorN)
c = $T( aux, order )
r = $T( sqrt(1 - a0^2), order )
for k in eachindex(a)
TaylorSeries.asin!(c, aa, r, k)
TS.asin!(c, aa, r, k)
end
return c
end
Expand All @@ -118,7 +118,7 @@ for T in (:Taylor1, :TaylorN)
c = $T( aux, order )
r = $T( sqrt(1 - a0^2), order )
for k in eachindex(a)
TaylorSeries.acos!(c, aa, r, k)
TS.acos!(c, aa, r, k)
end
return c
end
Expand All @@ -135,7 +135,7 @@ for T in (:Taylor1, :TaylorN)
c = $T( aux, order )
r = $T( sqrt(a0^2 - 1), order )
for k in eachindex(a)
TaylorSeries.acosh!(c, aa, r, k)
TS.acosh!(c, aa, r, k)
end
return c
end
Expand All @@ -152,14 +152,14 @@ for T in (:Taylor1, :TaylorN)
"""Series expansion of atanh(x) diverges at x = ±1."""))

for k in eachindex(a)
TaylorSeries.atanh!(c, aa, r, k)
TS.atanh!(c, aa, r, k)
end
return c
end
end


function evaluate(a::Taylor1, dx::Interval)
function evaluate(a::Taylor1{T}, dx::Interval{S}) where {T<:Real, S<:Real}
order = a.order
uno = one(dx)
dx2 = dx^2
Expand Down Expand Up @@ -201,7 +201,7 @@ end
function _evaluate(a::HomogeneousPolynomial, dx::IntervalBox{N,T}, ::Val{true} ) where {T<:Real,N}
a.order == 0 && return a[1] + Interval{T}(0, 0)

ct = TaylorSeries.coeff_table[a.order+1]
ct = TS.coeff_table[a.order+1]
@inbounds suma = a[1]*Interval{T}(0,0)

Ieven = Interval{T}(0,1)
Expand Down
Loading

2 comments on commit f5587a7

@lbenet
Copy link
Member Author

@lbenet lbenet commented on f5587a7 Jan 31, 2024

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/99978

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

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.16.0 -m "<description of version>" f5587a772e99d93428c5201f5422d5629fa4fcaf
git push origin v0.16.0

Please sign in to comment.