Skip to content

Commit c6e842e

Browse files
ChrisRackauckasSciML Bot
andauthored
Apply JuliaFormatter to fix code formatting (#450)
- Applied JuliaFormatter with SciML style guide - Formatted 7 files 🤖 Generated by OrgMaintenanceScripts.jl Co-authored-by: SciML Bot <sciml-bot@julialang.org>
1 parent 437e8d6 commit c6e842e

7 files changed

Lines changed: 67 additions & 64 deletions

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: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@ using Makie
88
Makie.plottype(::AbstractInterpolation) = Makie.ScatterLines
99

1010
# Define the attributes that you want to use
11-
Makie.used_attributes(::Makie.PointBased, ::AbstractInterpolation) = (:plotdensity, :denseplot)
12-
Makie.used_attributes(::Type{<:Makie.ScatterLines}, ::AbstractInterpolation) = (:plotdensity, :denseplot)
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
1317

1418
# Define the conversion of the data to the plot
1519
function Makie.convert_arguments(
16-
::Makie.PointBased,
17-
A::AbstractInterpolation;
18-
plotdensity = 10_000,
19-
denseplot = true,
20+
::Makie.PointBased,
21+
A::AbstractInterpolation;
22+
plotdensity = 10_000,
23+
denseplot = true
2024
)
2125
DataInterpolations.to_plottable(A; plotdensity = plotdensity, denseplot = denseplot)
2226
end
@@ -26,16 +30,17 @@ end
2630
# and should actually be handled by a plot! method,
2731
# except that doesn't work anymore or does it?
2832
function Makie.convert_arguments(
29-
::Type{<:Makie.ScatterLines},
30-
A::AbstractInterpolation;
31-
plotdensity = 10_000,
32-
denseplot = true,
33+
::Type{<:Makie.ScatterLines},
34+
A::AbstractInterpolation;
35+
plotdensity = 10_000,
36+
denseplot = true
3337
)
34-
densex, densey = convert_arguments(Makie.PointBased(), A; plotdensity = plotdensity, denseplot = denseplot)
38+
densex, densey = convert_arguments(
39+
Makie.PointBased(), A; plotdensity = plotdensity, denseplot = denseplot)
3540
return [
3641
Makie.SpecApi.Lines(densex, densey),
3742
Makie.SpecApi.Scatter(A.t, A.u)
3843
]
3944
end
4045

41-
end # module
46+
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: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,7 @@ 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
195-
zip(idxs, @view(A.t[begin:(end - 1)]), @view(A.t[(begin + 1):end])))
194+
for (idx, t1, t2) in zip(idxs, @view(A.t[begin:(end - 1)]), @view(A.t[(begin + 1):end])))
196195
end
197196

198197
function get_parameters(A::LinearInterpolation, idx)

test/derivative_tests.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ 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 Union{SmoothedConstantInterpolation, BSplineInterpolation, BSplineApprox}
38+
if func isa
39+
Union{SmoothedConstantInterpolation, BSplineInterpolation, BSplineApprox}
3940
# TODO fix interpolations
4041
continue
4142
else

test/interpolation_tests.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,6 @@ 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-
10311030
interp = @inferred(LinearInterpolation(ut1, ut2))
10321031
for xs in (u, t)
10331032
ys = @inferred(interp(xs))
@@ -1110,7 +1109,6 @@ f_cubic_spline = c -> square(CubicSpline, c)
11101109
iszero_allocations(u, t) = iszero(@allocated(DataInterpolations.munge_data(u, t)))
11111110

11121111
for T in (String, Union{String, Missing}), dims in 1:3
1113-
11141112
_u0 = convert(Array{T}, reshape(u0, ntuple(i -> i == dims ? 3 : 1, dims)))
11151113

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

0 commit comments

Comments
 (0)