Skip to content

Extend TaylorSolution to include all general features from TaylorInterpolant#237

Open
PerezHz wants to merge 1 commit into
mainfrom
jp/taylor-solution
Open

Extend TaylorSolution to include all general features from TaylorInterpolant#237
PerezHz wants to merge 1 commit into
mainfrom
jp/taylor-solution

Conversation

@PerezHz
Copy link
Copy Markdown
Owner

@PerezHz PerezHz commented May 28, 2026

Currently, PlanetaryEphemeris and NEOs use TaylorInterpolant, which is a precursor to the TaylorSolution type defined in TaylorIntegration. In this PR we extend TaylorSolution to incorporate all the general functionalities of TaylorInterpolant which had not been included before as part of TaylorSolution, in order to complete the migration to the latter.

This PR goes together with PerezHz/PlanetaryEphemeris.jl#60

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage is 93.922%jp/taylor-solution into main. No base build found for main.

@PerezHz
Copy link
Copy Markdown
Owner Author

PerezHz commented May 28, 2026

Test are passing but codecov is somehow not happy 😅 (coveralls is happy!)

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR expands TaylorSolution so it can serve as a full replacement for the previously-used TaylorInterpolant, adding common operations (equality/hash, conversions, reversal/sign flip/join, and JLD2 serialization) and corresponding tests to support downstream migration (e.g. PlanetaryEphemeris/NEOs).

Changes:

  • Extend TaylorSolution with ==/hash, order, convert, zero/iszero, reverse, flipsign, and join.
  • Add JLD2 serialization support for TaylorSolution (including TaylorN-valued solutions) via writeas + custom serialization structs.
  • Expand test/solution.jl to cover the new behaviors and JLD2 roundtrips.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 8 comments.

File Description
src/integrator/taylorsolution.jl Adds new constructors/utilities, reverse/flipsign/join, numeric conversion/zero, and JLD2 serialization hooks.
src/TaylorIntegration.jl Imports/depends on AutoHashEquals + JLD2 and brings needed Base/JLD2 imports into scope.
test/solution.jl Adds tests for hashing/equality, order, zero/iszero, reverse/flipsign, and JLD2 save/load.
Project.toml Bumps version and adds AutoHashEquals/JLD2 dependencies + compat entries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +94 to +100
x = Vector{U}(undef, length(t))
isempty(p) && return x
x[1] = p[1](zero(T))
for i in eachindex(p)
x[i+1] = p[i](t[i+1] - t[i])
end
return x
Comment on lines +108 to +114
x = Array{U,N}(undef, length(t), size(p)[2:end]...)
isempty(p) && return x
selectdim(x, 1, 1) .= selectdim(p, 1, 1)(zero(T))
for i in axes(p, 1)
selectdim(x, 1, i + 1) .= selectdim(p, 1, i)(t[i+1] - t[i])
end
return x
P<:Union{Nothing,AbstractArray{Taylor1{U},N}}}
xdims = (1, ntuple(_ -> 0, Val(N - 1))...)
t = zeros(T, 1)
x = Array{U,N}(undef, xdims)
Comment on lines +328 to +333
function flipsign(sol::TaylorSolution)
p = _dense_polynomials(sol)
t = flipsign.(sol.t, -one(eltype(sol.t)))
t[1] = sol.t[1]
return TaylorSolution(t, p(-Taylor1(TaylorSeries.order(sol))))
end
Comment on lines +353 to +357
function writeas(
::Type{<:TaylorSolution{T,T,N,Vector{T},Array{T,N},Array{Taylor1{T},N},Nothing,Nothing,Nothing}},
) where {T<:Real,N}
return TaylorSolutionSerialization{T,N}
end
Comment on lines +359 to +362
function convert(
::Type{TaylorSolutionSerialization{T,N}},
sol::TaylorSolution{T,T,N,Vector{T},Array{T,N},Array{Taylor1{T},N},Nothing,Nothing,Nothing},
) where {T<:Real,N}
Comment on lines +400 to +404
function writeas(
::Type{<:TaylorSolution{T,TaylorN{T},N,Vector{T},Array{TaylorN{T},N},Array{Taylor1{TaylorN{T}},N},Nothing,Nothing,Nothing}},
) where {T<:Real,N}
return TaylorSolutionNSerialization{T,N}
end
Comment on lines +406 to +409
function convert(
::Type{TaylorSolutionNSerialization{T,Ndim}},
sol::TaylorSolution{T,TaylorN{T},Ndim,Vector{T},Array{TaylorN{T},Ndim},Array{Taylor1{TaylorN{T}},Ndim},Nothing,Nothing,Nothing},
) where {T<:Real,Ndim}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants