@@ -5,20 +5,20 @@ using SparseConnectivityTracer: GradientTracer, gradient_tracer_1_to_1
55using SparseConnectivityTracer: HessianTracer, hessian_tracer_1_to_1
66using FillArrays: Fill # from FillArrays.jl
77using DataInterpolations:
8- AbstractInterpolation,
9- LinearInterpolation,
10- QuadraticInterpolation,
11- LagrangeInterpolation,
12- AkimaInterpolation,
13- ConstantInterpolation,
14- QuadraticSpline,
15- CubicSpline,
16- BSplineInterpolation,
17- BSplineApprox,
18- CubicHermiteSpline,
19- # PCHIPInterpolation,
20- QuinticHermiteSpline,
21- output_size
8+ AbstractInterpolation,
9+ LinearInterpolation,
10+ QuadraticInterpolation,
11+ LagrangeInterpolation,
12+ AkimaInterpolation,
13+ ConstantInterpolation,
14+ QuadraticSpline,
15+ CubicSpline,
16+ BSplineInterpolation,
17+ BSplineApprox,
18+ CubicHermiteSpline,
19+ # PCHIPInterpolation,
20+ QuinticHermiteSpline,
21+ output_size
2222
2323#= ==========#
2424# Utilities #
@@ -33,26 +33,26 @@ function _sct_interpolate(
3333 uType:: Type{<:AbstractVector{<:Number}} ,
3434 t:: GradientTracer ,
3535 is_der_1_zero,
36- is_der_2_zero
37- )
36+ is_der_2_zero,
37+ )
3838 return gradient_tracer_1_to_1 (t, is_der_1_zero)
3939end
4040function _sct_interpolate (
4141 :: AbstractInterpolation ,
4242 uType:: Type{<:AbstractVector{<:Number}} ,
4343 t:: HessianTracer ,
4444 is_der_1_zero,
45- is_der_2_zero
46- )
45+ is_der_2_zero,
46+ )
4747 return hessian_tracer_1_to_1 (t, is_der_1_zero, is_der_2_zero)
4848end
4949function _sct_interpolate (
5050 interp:: AbstractInterpolation ,
5151 uType:: Type{<:AbstractMatrix{<:Number}} ,
5252 t:: GradientTracer ,
5353 is_der_1_zero,
54- is_der_2_zero
55- )
54+ is_der_2_zero,
55+ )
5656 t = gradient_tracer_1_to_1 (t, is_der_1_zero)
5757 N = only (output_size (interp))
5858 return Fill (t, N)
@@ -62,8 +62,8 @@ function _sct_interpolate(
6262 uType:: Type{<:AbstractMatrix{<:Number}} ,
6363 t:: HessianTracer ,
6464 is_der_1_zero,
65- is_der_2_zero
66- )
65+ is_der_2_zero,
66+ )
6767 t = hessian_tracer_1_to_1 (t, is_der_1_zero, is_der_2_zero)
6868 N = only (output_size (interp))
6969 return Fill (t, N)
7777# all interpolations have a non-zero second derivative at some point in the input domain.
7878
7979for (I, is_der1_zero, is_der2_zero) in (
80- (:ConstantInterpolation , true , true ),
81- (:LinearInterpolation , false , true ),
82- (:QuadraticInterpolation , false , false ),
83- (:LagrangeInterpolation , false , false ),
84- (:AkimaInterpolation , false , false ),
85- (:QuadraticSpline , false , false ),
86- (:CubicSpline , false , false ),
87- (:BSplineInterpolation , false , false ),
88- (:BSplineApprox , false , false ),
89- (:CubicHermiteSpline , false , false ),
90- (:QuinticHermiteSpline , false , false )
91- )
80+ (:ConstantInterpolation , true , true ),
81+ (:LinearInterpolation , false , true ),
82+ (:QuadraticInterpolation , false , false ),
83+ (:LagrangeInterpolation , false , false ),
84+ (:AkimaInterpolation , false , false ),
85+ (:QuadraticSpline , false , false ),
86+ (:CubicSpline , false , false ),
87+ (:BSplineInterpolation , false , false ),
88+ (:BSplineApprox , false , false ),
89+ (:CubicHermiteSpline , false , false ),
90+ (:QuinticHermiteSpline , false , false ),
91+ )
9292 @eval function (interp:: $ (I){uType})(
9393 t:: AbstractTracer
94- ) where {uType <: AbstractArray{<:Number} }
94+ ) where {uType <: AbstractArray{<:Number} }
9595 return _sct_interpolate (interp, uType, t, $ is_der1_zero, $ is_der2_zero)
9696 end
9797end
9898
9999# Some Interpolations require custom overloads on `Dual` due to mutation of caches.
100100for I in (
101- :LagrangeInterpolation ,
102- :BSplineInterpolation ,
103- :BSplineApprox ,
104- :CubicHermiteSpline ,
105- :QuinticHermiteSpline
106- )
101+ :LagrangeInterpolation ,
102+ :BSplineInterpolation ,
103+ :BSplineApprox ,
104+ :CubicHermiteSpline ,
105+ :QuinticHermiteSpline ,
106+ )
107107 @eval function (interp:: $ (I){uType})(d:: Dual ) where {uType <: AbstractVector }
108108 p = interp (primal (d))
109109 t = interp (tracer (d))
0 commit comments