Skip to content

Commit

Permalink
Remove two uses of fixorder in evaluate methods for recursive Tay…
Browse files Browse the repository at this point in the history
…lor1 (#360)

* Remove two uses of `fixorder` in `evaluate` methods, involving recursive Taylor1

* Updates in github actions (ci and docs)

* Fix error in ci

* Add evaluation tests

* Bump patch version
  • Loading branch information
lbenet authored Jun 22, 2024
1 parent 466845e commit 0585883
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 14 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,21 @@ on:
tags: '*'

jobs:
pre_job:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'same_content_newer'
test:
name: Julia ${{ matrix.julia-version }} - ${{ matrix.os }} - ${{ matrix.julia-threads }} thread(s) - ${{ github.event_name }}
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, 'skip ci')"
env:
JULIA_NUM_THREADS: ${{ matrix.julia-threads }}
strategy:
Expand All @@ -38,13 +49,13 @@ jobs:
julia-threads: '2'

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: "Set up Julia"
uses: julia-actions/setup-julia@v1
uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}
arch: ${{ matrix.julia-arch }}
- uses: actions/cache@v3
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@latest
with:
version: '1'
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg;
run: julia --project=docs/ -e 'using Pkg;
Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Build and deploy
env:
Expand Down
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.17.7"
version = "0.17.8"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
13 changes: 6 additions & 7 deletions src/evaluate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,13 @@ function evaluate(a::Taylor1{T}, x::Taylor1{T}) where {T<:Number}
end

function evaluate(a::Taylor1{Taylor1{T}}, x::Taylor1{T}) where {T<:NumberNotSeriesN}
if a.order != x.order
a, x = fixorder(a, x)
end
@inbounds suma = a[end]*zero(x)
aux = zero(suma)
_horner!(suma, a, x, aux)
return suma
end

function evaluate(a::Taylor1{T}, x::Taylor1{Taylor1{T}}) where {T<:NumberNotSeriesN}
if a.order != x.order
a, x = fixorder(a, x)
end
@inbounds suma = a[end]*zero(x)
aux = zero(suma)
_horner!(suma, a, x, aux)
Expand Down Expand Up @@ -472,7 +466,12 @@ function evaluate!(x::AbstractArray{Taylor1{T}}, δt::S,
x0 .= evaluate.( x, δt )
return nothing
end

# function evaluate!(x::AbstractArray{Taylor1{Taylor1{T}}}, δt::Taylor1{T},
# x0::AbstractArray{Taylor1{T}}) where {T<:Number}
# x0 .= evaluate.( x, Ref(δt) )
# # x0 .= evaluate.( x, δt )
# return nothing
# end

## In place evaluation of multivariable arrays
function evaluate!(x::AbstractArray{TaylorN{T}}, δx::Array{T,1},
Expand Down
5 changes: 5 additions & 0 deletions test/mixtures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -569,4 +569,9 @@ end
@test get_order(tti[0]) == get_order(ti)-1
@test isapprox(abs2(exp(im*to)), one(to))
@test isapprox(abs(exp(im*to)), one(to))
to = Taylor1([1/(1+ti), one(ti)], 9)
@test to(1.0) == 1 + 1/(1+ti)
@test cos(to)(0.0) == cos(to[0])
@test to(ti) == to[0] + ti
@test evaluate(to*ti, ti) == to[0]*ti + ti^2
end

2 comments on commit 0585883

@lbenet
Copy link
Member Author

@lbenet lbenet commented on 0585883 Jun 22, 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/109587

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.17.8 -m "<description of version>" 05858833de9434cdc910eaa09eec557a114e1d2f
git push origin v0.17.8

Please sign in to comment.