Extend TaylorSolution to include all general features from TaylorInterpolant#237
Open
PerezHz wants to merge 1 commit into
Open
Extend TaylorSolution to include all general features from TaylorInterpolant#237PerezHz wants to merge 1 commit into
TaylorSolution to include all general features from TaylorInterpolant#237PerezHz wants to merge 1 commit into
Conversation
Owner
Author
|
Test are passing but codecov is somehow not happy 😅 (coveralls is happy!) |
There was a problem hiding this comment.
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
TaylorSolutionwith==/hash,order,convert,zero/iszero,reverse,flipsign, andjoin. - Add JLD2 serialization support for
TaylorSolution(includingTaylorN-valued solutions) viawriteas+ custom serialization structs. - Expand
test/solution.jlto 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} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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