Skip to content

Commit

Permalink
Merge pull request #256 from mleseach/type_inference
Browse files Browse the repository at this point in the history
fix: remove abstract type from RegularizationSmooth
  • Loading branch information
ChrisRackauckas authored Jun 4, 2024
2 parents 4ca5bfc + d9cf8bb commit eb7a197
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
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

0 comments on commit eb7a197

Please sign in to comment.