From ba75a45b44f0d4079243b5b3d96410639e45bf77 Mon Sep 17 00:00:00 2001 From: mleseach <113145496+mleseach@users.noreply.github.com> Date: Fri, 31 May 2024 16:34:32 +0200 Subject: [PATCH 1/4] add type inference test for RegularizationSmooth --- test/regularization.jl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/regularization.jl b/test/regularization.jl index 565becfd..fcf7580d 100644 --- a/test/regularization.jl +++ b/test/regularization.jl @@ -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 From 857c7f3454b9c17dfb7b413d3d4198222b4fcbe6 Mon Sep 17 00:00:00 2001 From: mleseach <113145496+mleseach@users.noreply.github.com> Date: Fri, 31 May 2024 16:40:20 +0200 Subject: [PATCH 2/4] remove abstract type from RegularizationSmooth --- src/DataInterpolations.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DataInterpolations.jl b/src/DataInterpolations.jl index 16b003f7..32f773a6 100644 --- a/src/DataInterpolations.jl +++ b/src/DataInterpolations.jl @@ -56,7 +56,7 @@ 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 @@ -66,7 +66,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, û, @@ -79,7 +79,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̂, From 6c846654d5e78c25c38ccd88027e59db0d0d0dbd Mon Sep 17 00:00:00 2001 From: mleseach <113145496+mleseach@users.noreply.github.com> Date: Sat, 1 Jun 2024 17:46:39 +0200 Subject: [PATCH 3/4] fix formatting --- src/DataInterpolations.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DataInterpolations.jl b/src/DataInterpolations.jl index 32f773a6..db4e520a 100644 --- a/src/DataInterpolations.jl +++ b/src/DataInterpolations.jl @@ -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, ITP <: AbstractInterpolation{T}} <: AbstractInterpolation{T} +struct RegularizationSmooth{uType, tType, T, T2, ITP <: AbstractInterpolation{T}} <: + AbstractInterpolation{T} u::uType û::uType t::tType From d9cf8bbc1b2818bb2d79fd4d1600a6803ba7ad14 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Mon, 3 Jun 2024 09:46:19 -0400 Subject: [PATCH 4/4] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 7c6ac28f..17dc96d0 100644 --- a/Project.toml +++ b/Project.toml @@ -37,7 +37,7 @@ Reexport = "1" RegularizationTools = "0.6" SafeTestsets = "0.1" StableRNGs = "1" -Symbolics = "5.1" +Symbolics = "5.29" Test = "1" julia = "1.10"