Skip to content

Commit 6d4a98a

Browse files
[ci-skip] Revert "Apply JuliaFormatter to fix code formatting (#450)"
This reverts commit c6e842e. Reverting JuliaFormatter changes due to formatting issues being addressed in JuliaFormatter.jl PR#933.
1 parent 06c81b2 commit 6d4a98a

7 files changed

+64
-67
lines changed

ext/DataInterpolationsChainRulesCoreExt.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module DataInterpolationsChainRulesCoreExt
22

33
using DataInterpolations: _interpolate, derivative, AbstractInterpolation,
4-
LinearInterpolation, QuadraticInterpolation,
5-
LagrangeInterpolation, AkimaInterpolation,
6-
BSplineInterpolation, BSplineApprox, get_idx, get_parameters,
7-
munge_data
4+
LinearInterpolation, QuadraticInterpolation,
5+
LagrangeInterpolation, AkimaInterpolation,
6+
BSplineInterpolation, BSplineApprox, get_idx, get_parameters,
7+
munge_data
88
using ChainRulesCore
99

1010
function ChainRulesCore.rrule(::typeof(munge_data), u, t)

ext/DataInterpolationsMakieExt.jl

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@ using Makie
88
Makie.plottype(::AbstractInterpolation) = Makie.ScatterLines
99

1010
# Define the attributes that you want to use
11-
function Makie.used_attributes(::Makie.PointBased, ::AbstractInterpolation)
12-
(:plotdensity, :denseplot)
13-
end
14-
function Makie.used_attributes(::Type{<:Makie.ScatterLines}, ::AbstractInterpolation)
15-
(:plotdensity, :denseplot)
16-
end
11+
Makie.used_attributes(::Makie.PointBased, ::AbstractInterpolation) = (:plotdensity, :denseplot)
12+
Makie.used_attributes(::Type{<:Makie.ScatterLines}, ::AbstractInterpolation) = (:plotdensity, :denseplot)
1713

1814
# Define the conversion of the data to the plot
1915
function Makie.convert_arguments(
20-
::Makie.PointBased,
21-
A::AbstractInterpolation;
22-
plotdensity = 10_000,
23-
denseplot = true
16+
::Makie.PointBased,
17+
A::AbstractInterpolation;
18+
plotdensity = 10_000,
19+
denseplot = true,
2420
)
2521
DataInterpolations.to_plottable(A; plotdensity = plotdensity, denseplot = denseplot)
2622
end
@@ -30,17 +26,16 @@ end
3026
# and should actually be handled by a plot! method,
3127
# except that doesn't work anymore or does it?
3228
function Makie.convert_arguments(
33-
::Type{<:Makie.ScatterLines},
34-
A::AbstractInterpolation;
35-
plotdensity = 10_000,
36-
denseplot = true
29+
::Type{<:Makie.ScatterLines},
30+
A::AbstractInterpolation;
31+
plotdensity = 10_000,
32+
denseplot = true,
3733
)
38-
densex, densey = convert_arguments(
39-
Makie.PointBased(), A; plotdensity = plotdensity, denseplot = denseplot)
34+
densex, densey = convert_arguments(Makie.PointBased(), A; plotdensity = plotdensity, denseplot = denseplot)
4035
return [
4136
Makie.SpecApi.Lines(densex, densey),
4237
Makie.SpecApi.Scatter(A.t, A.u)
4338
]
4439
end
4540

46-
end # module
41+
end # module

ext/DataInterpolationsSparseConnectivityTracerExt.jl

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ using SparseConnectivityTracer: GradientTracer, gradient_tracer_1_to_1
55
using SparseConnectivityTracer: HessianTracer, hessian_tracer_1_to_1
66
using FillArrays: Fill # from FillArrays.jl
77
using 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)
3939
end
4040
function _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)
4848
end
4949
function _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)
@@ -77,33 +77,33 @@ end
7777
# all interpolations have a non-zero second derivative at some point in the input domain.
7878

7979
for (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
9797
end
9898

9999
# Some Interpolations require custom overloads on `Dual` due to mutation of caches.
100100
for 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))

src/interpolation_caches.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,8 +1220,8 @@ function BSplineApprox(
12201220
end
12211221
for k in 2:(n - 1)
12221222
q[ax_u...,
1223-
k] = u[ax_u..., k] - sc[k, 1] * u[ax_u..., 1] -
1224-
sc[k, h] * u[ax_u..., end]
1223+
k] = u[ax_u..., k] - sc[k, 1] * u[ax_u..., 1] -
1224+
sc[k, h] * u[ax_u..., end]
12251225
end
12261226
Q = Array{T, N}(undef, size(u)[1:(end - 1)]..., h - 2)
12271227
for i in 2:(h - 1)

src/interpolation_utils.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ function cumulative_integral(A::AbstractInterpolation{<:Number}, cache_parameter
191191
Base.require_one_based_indexing(A.u)
192192
idxs = cache_parameters ? (1:(length(A.t) - 1)) : (1:0)
193193
return cumsum(_integral(A, idx, t1, t2)
194-
for (idx, t1, t2) in zip(idxs, @view(A.t[begin:(end - 1)]), @view(A.t[(begin + 1):end])))
194+
for (idx, t1, t2) in
195+
zip(idxs, @view(A.t[begin:(end - 1)]), @view(A.t[(begin + 1):end])))
195196
end
196197

197198
function get_parameters(A::LinearInterpolation, idx)

test/derivative_tests.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ function test_derivatives(method; args = [], kwargs = [], name::String)
3535

3636
# Interpolation transition points
3737
for _t in t[2:(end - 1)]
38-
if func isa
39-
Union{SmoothedConstantInterpolation, BSplineInterpolation, BSplineApprox}
38+
if func isa Union{SmoothedConstantInterpolation, BSplineInterpolation, BSplineApprox}
4039
# TODO fix interpolations
4140
continue
4241
else

test/interpolation_tests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,7 @@ end
10271027
ut1 = Float32[0.1, 0.2, 0.3, 0.4, 0.5]
10281028
ut2 = Float64[0.1, 0.2, 0.3, 0.4, 0.5]
10291029
for u in (ut1, ut2), t in (ut1, ut2)
1030+
10301031
interp = @inferred(LinearInterpolation(ut1, ut2))
10311032
for xs in (u, t)
10321033
ys = @inferred(interp(xs))
@@ -1109,6 +1110,7 @@ f_cubic_spline = c -> square(CubicSpline, c)
11091110
iszero_allocations(u, t) = iszero(@allocated(DataInterpolations.munge_data(u, t)))
11101111

11111112
for T in (String, Union{String, Missing}), dims in 1:3
1113+
11121114
_u0 = convert(Array{T}, reshape(u0, ntuple(i -> i == dims ? 3 : 1, dims)))
11131115

11141116
u, t = @inferred(DataInterpolations.munge_data(_u0, t0))

0 commit comments

Comments
 (0)