-
-
Notifications
You must be signed in to change notification settings - Fork 52
Add optional extrapolation methods #433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
SouthEndMusic
merged 8 commits into
SciML:master
from
simulutions:configurable-extrapolation-method-in-invert_integral()
May 27, 2025
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
23e6798
Add optional extrapolation methods
simulutions ab07ff7
add test for configurable extrapolation method
simulutions 778b5f5
remove optional from inner contructor
simulutions 46298c9
added unit test
simulutions c709b5e
Added proper test cases
simulutions d90876a
add semi colon
simulutions 222cf63
run formatter
simulutions e4c3306
fix test with keyword args
simulutions File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -41,9 +41,10 @@ struct LinearInterpolationIntInv{uType, tType, itpType, T} <: | |||||||||||
extrapolation_right::ExtrapolationType.T | ||||||||||||
iguesser::Guesser{tType} | ||||||||||||
itp::itpType | ||||||||||||
function LinearInterpolationIntInv(u, t, A) | ||||||||||||
function LinearInterpolationIntInv(u, t, A, extrapolation_left = A.extrapolation_left, | ||||||||||||
extrapolation_right = A.extrapolation_right) | ||||||||||||
new{typeof(u), typeof(t), typeof(A), eltype(u)}( | ||||||||||||
u, t, A.extrapolation_left, A.extrapolation_right, Guesser(t), A) | ||||||||||||
u, t, extrapolation_left, extrapolation_right, Guesser(t), A) | ||||||||||||
end | ||||||||||||
end | ||||||||||||
|
||||||||||||
|
@@ -57,9 +58,13 @@ function get_I(A::AbstractInterpolation) | |||||||||||
I | ||||||||||||
end | ||||||||||||
|
||||||||||||
function invert_integral(A::LinearInterpolation{<:AbstractVector{<:Number}}) | ||||||||||||
function invert_integral(A::LinearInterpolation{<:AbstractVector{<:Number}}, | ||||||||||||
extrapolation_left::ExtrapolationType.T = A.extrapolation_left, | ||||||||||||
extrapolation_right::ExtrapolationType.T = A.extrapolation_right) | ||||||||||||
!invertible_integral(A) && throw(IntegralNotInvertibleError()) | ||||||||||||
return LinearInterpolationIntInv(A.t, get_I(A), A) | ||||||||||||
|
||||||||||||
return LinearInterpolationIntInv( | ||||||||||||
A.t, get_I(A), A, extrapolation_left, extrapolation_right) | ||||||||||||
end | ||||||||||||
|
||||||||||||
function _interpolate( | ||||||||||||
|
@@ -92,9 +97,11 @@ struct ConstantInterpolationIntInv{uType, tType, itpType, T} <: | |||||||||||
extrapolation_right::ExtrapolationType.T | ||||||||||||
iguesser::Guesser{tType} | ||||||||||||
itp::itpType | ||||||||||||
function ConstantInterpolationIntInv(u, t, A) | ||||||||||||
function ConstantInterpolationIntInv( | ||||||||||||
u, t, A, extrapolation_left = A.extrapolation_left, | ||||||||||||
extrapolation_right = A.extrapolation_right) | ||||||||||||
new{typeof(u), typeof(t), typeof(A), eltype(u)}( | ||||||||||||
u, t, A.extrapolation_left, A.extrapolation_right, Guesser(t), A | ||||||||||||
u, t, extrapolation_left, extrapolation_right, Guesser(t), A | ||||||||||||
) | ||||||||||||
end | ||||||||||||
end | ||||||||||||
|
@@ -103,9 +110,12 @@ function invertible_integral(A::ConstantInterpolation{<:AbstractVector{<:Number} | |||||||||||
return all(A.u .> 0) | ||||||||||||
end | ||||||||||||
|
||||||||||||
function invert_integral(A::ConstantInterpolation{<:AbstractVector{<:Number}}) | ||||||||||||
function invert_integral(A::ConstantInterpolation{<:AbstractVector{<:Number}}, | ||||||||||||
extrapolation_left::ExtrapolationType.T = A.extrapolation_left, | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
extrapolation_right::ExtrapolationType.T = A.extrapolation_right) | ||||||||||||
!invertible_integral(A) && throw(IntegralNotInvertibleError()) | ||||||||||||
return ConstantInterpolationIntInv(A.t, get_I(A), A) | ||||||||||||
return ConstantInterpolationIntInv( | ||||||||||||
A.t, get_I(A), A, extrapolation_left, extrapolation_right) | ||||||||||||
end | ||||||||||||
|
||||||||||||
function _interpolate( | ||||||||||||
|
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.