Skip to content
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

fix: remove abstract type from RegularizationSmooth #256

Merged
merged 4 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/DataInterpolations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export LinearInterpolation, QuadraticInterpolation, LagrangeInterpolation,

# added for RegularizationSmooth, JJS 11/27/21
### Regularization data smoothing and interpolation
struct RegularizationSmooth{uType, tType, T, T2} <: AbstractInterpolation{T}
struct RegularizationSmooth{uType, tType, T, T2, ITP <: AbstractInterpolation{T}} <:
AbstractInterpolation{T}
u::uType
û::uType
t::tType
Expand All @@ -66,7 +67,7 @@ struct RegularizationSmooth{uType, tType, T, T2} <: AbstractInterpolation{T}
d::Int # derivative degree used to calculate the roughness
λ::T2 # regularization parameter
alg::Symbol # how to determine λ: `:fixed`, `:gcv_svd`, `:gcv_tr`, `L_curve`
Aitp::AbstractInterpolation{T}
Aitp::ITP
extrapolate::Bool
function RegularizationSmooth(u,
û,
Expand All @@ -79,7 +80,7 @@ struct RegularizationSmooth{uType, tType, T, T2} <: AbstractInterpolation{T}
alg,
Aitp,
extrapolate)
new{typeof(u), typeof(t), eltype(u), typeof(λ)}(u,
new{typeof(u), typeof(t), eltype(u), typeof(λ), typeof(Aitp)}(u,
û,
t,
t̂,
Expand Down
5 changes: 5 additions & 0 deletions test/regularization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,8 @@ end
A = RegularizationSmooth(uₒ, tₒ; alg = :fixed)
@test_throws DataInterpolations.ExtrapolationError A(10.0)
end

@testset "Type inference" begin
A = RegularizationSmooth(uₒ, tₒ; alg = :fixed)
@test @inferred(A(1.0)) == A(1.0)
end
Loading