Skip to content

Commit 10fbdfc

Browse files
committed
Fix format
1 parent 97c2a49 commit 10fbdfc

File tree

4 files changed

+37
-22
lines changed

4 files changed

+37
-22
lines changed

lib/OrdinaryDiffEqCore/src/misc_utils.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,12 @@ function _bool_to_ADType(::Val{false}, _, ::Val{FD}) where {FD}
147147
end
148148

149149
# Functions to get ADType type from Bool or ADType object, or ADType type
150-
function _process_AD_choice(ad_alg::Bool, ::Val{CS}, ::Val{FD}) where {CS,FD}
150+
function _process_AD_choice(ad_alg::Bool, ::Val{CS}, ::Val{FD}) where {CS, FD}
151151
return _bool_to_ADType(Val(ad_alg), Val{CS}(), Val{FD}()), Val{CS}(), Val{FD}()
152152
end
153153

154-
function _process_AD_choice(ad_alg::AutoForwardDiff{CS}, ::Val{CS2}, ::Val{FD}) where {CS,CS2,FD}
154+
function _process_AD_choice(
155+
ad_alg::AutoForwardDiff{CS}, ::Val{CS2}, ::Val{FD}) where {CS, CS2, FD}
155156
# Non-default `chunk_size`
156157
if CS2 != 0
157158
@warn "The `chunk_size` keyword is deprecated. Please use an `ADType` specifier. For now defaulting to using `AutoForwardDiff` with `chunksize=$(CS2)`."
@@ -161,7 +162,8 @@ function _process_AD_choice(ad_alg::AutoForwardDiff{CS}, ::Val{CS2}, ::Val{FD})
161162
return ad_alg, Val{_CS}(), Val{FD}()
162163
end
163164

164-
function _process_AD_choice(ad_alg::AutoFiniteDiff{FD}, ::Val{CS}, ::Val{FD2}) where {FD,CS,FD2}
165+
function _process_AD_choice(
166+
ad_alg::AutoFiniteDiff{FD}, ::Val{CS}, ::Val{FD2}) where {FD, CS, FD2}
165167
# Non-default `diff_type`
166168
if FD2 !== :forward
167169
@warn "The `diff_type` keyword is deprecated. Please use an `ADType` specifier. For now defaulting to using `AutoFiniteDiff` with `fdtype=Val{$FD2}()`."

lib/OrdinaryDiffEqExponentialRK/src/algorithms.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ for (Alg, Description, Ref) in [
3939
standardtag = Val{true}(), concrete_jac = nothing,
4040
chunk_size = Val{0}(),
4141
diff_type = Val{:forward}())
42-
AD_choice, chunk_size, diff_type = _process_AD_choice(autodiff, chunk_size, diff_type)
42+
AD_choice, chunk_size, diff_type = _process_AD_choice(
43+
autodiff, chunk_size, diff_type)
4344

4445
$Alg{_unwrap_val(chunk_size), typeof(AD_choice),
4546
diff_type, _unwrap_val(standardtag), _unwrap_val(concrete_jac)}(krylov,
@@ -83,7 +84,8 @@ for (Alg, Description, Ref) in [
8384
m = 30, iop = 0, autodiff = AutoForwardDiff(), standardtag = Val{true}(),
8485
concrete_jac = nothing, chunk_size = Val{0}(),
8586
diff_type = Val{:forward}())
86-
AD_choice, chunk_size, diff_type = _process_AD_choice(autodiff, chunk_size, diff_type)
87+
AD_choice, chunk_size, diff_type = _process_AD_choice(
88+
autodiff, chunk_size, diff_type)
8789

8890
$Alg{_unwrap_val(chunk_size), typeof(AD_choice),
8991
diff_type, _unwrap_val(standardtag),
@@ -145,7 +147,8 @@ for (Alg, Description, Ref) in [(:Exp4, "4th order EPIRK scheme.", REF3)
145147
adaptive_krylov = true, m = 30, iop = 0, autodiff = AutoForwardDiff(),
146148
standardtag = Val{true}(), concrete_jac = nothing,
147149
chunk_size = Val{0}(), diff_type = Val{:forward}())
148-
AD_choice, chunk_size, diff_type = _process_AD_choice(autodiff, chunk_size, diff_type)
150+
AD_choice, chunk_size, diff_type = _process_AD_choice(
151+
autodiff, chunk_size, diff_type)
149152

150153
$Alg{_unwrap_val(chunk_size), typeof(AD_choice), diff_type,
151154
_unwrap_val(standardtag), _unwrap_val(concrete_jac)}(adaptive_krylov,

lib/OrdinaryDiffEqRosenbrock/src/algorithms.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ for Alg in [
117117
diff_type = Val{:forward}(), linsolve = nothing,
118118
precs = DEFAULT_PRECS, step_limiter! = trivial_limiter!,
119119
stage_limiter! = trivial_limiter!)
120-
AD_choice, chunk_size, diff_type = _process_AD_choice(autodiff, chunk_size, diff_type)
120+
AD_choice, chunk_size, diff_type = _process_AD_choice(
121+
autodiff, chunk_size, diff_type)
121122
$Alg{_unwrap_val(chunk_size), typeof(AD_choice), typeof(linsolve),
122123
typeof(precs), diff_type, _unwrap_val(standardtag),
123124
_unwrap_val(concrete_jac), typeof(step_limiter!),
@@ -136,7 +137,8 @@ end
136137
function GeneralRosenbrock(; chunk_size = Val{0}(), autodiff = AutoForwardDiff(),
137138
standardtag = Val{true}(), concrete_jac = nothing,
138139
factorization = lu!, tableau = ROSENBROCK_DEFAULT_TABLEAU)
139-
AD_choice, chunk_size, diff_type = _process_AD_choice(autodiff, chunk_size, Val{:forward}())
140+
AD_choice, chunk_size, diff_type = _process_AD_choice(
141+
autodiff, chunk_size, Val{:forward}())
140142

141143
GeneralRosenbrock{
142144
_unwrap_val(chunk_size), typeof(AD_choice), typeof(factorization),
@@ -202,7 +204,8 @@ for Alg in [
202204
function $Alg(; chunk_size = Val{0}(), autodiff = AutoForwardDiff(),
203205
standardtag = Val{true}(), concrete_jac = nothing,
204206
diff_type = Val{:forward}(), linsolve = nothing, precs = DEFAULT_PRECS)
205-
AD_choice, chunk_size, diff_type = _process_AD_choice(autodiff, chunk_size, diff_type)
207+
AD_choice, chunk_size, diff_type = _process_AD_choice(
208+
autodiff, chunk_size, diff_type)
206209

207210
$Alg{_unwrap_val(chunk_size), typeof(AD_choice), typeof(linsolve),
208211
typeof(precs), diff_type, _unwrap_val(standardtag),

lib/OrdinaryDiffEqRosenbrock/test/ode_rosenbrock_tests.jl

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -745,49 +745,56 @@ end
745745
ROS3PR,
746746
Scholz4_7
747747
]
748-
RosenbrockAlgorithm = if T <: OrdinaryDiffEqRosenbrock.OrdinaryDiffEqRosenbrockAlgorithm
748+
RosenbrockAlgorithm = if T <:
749+
OrdinaryDiffEqRosenbrock.OrdinaryDiffEqRosenbrockAlgorithm
749750
OrdinaryDiffEqRosenbrock.OrdinaryDiffEqRosenbrockAlgorithm
750751
else
751752
OrdinaryDiffEqRosenbrock.OrdinaryDiffEqRosenbrockAdaptiveAlgorithm
752753
end
753754

754755
ad = AutoForwardDiff(; chunksize = 3)
755756
alg = @test_logs @inferred(T(; autodiff = ad))
756-
@test alg isa RosenbrockAlgorithm{3,typeof(ad),Val{:forward}()}
757+
@test alg isa RosenbrockAlgorithm{3, typeof(ad), Val{:forward}()}
757758
@test OrdinaryDiffEqRosenbrock.OrdinaryDiffEqCore.alg_autodiff(alg) === ad
758759
@test OrdinaryDiffEqRosenbrock.OrdinaryDiffEqCore.get_chunksize(alg) === Val{3}()
759760

760-
alg = @test_logs (:warn,r"The `chunk_size` keyword is deprecated") match_mode=:any @inferred(T(; autodiff = ad, chunk_size = Val{4}()))
761-
@test alg isa RosenbrockAlgorithm{4,<:AutoForwardDiff{4},Val{:forward}()}
762-
@test OrdinaryDiffEqRosenbrock.OrdinaryDiffEqCore.alg_autodiff(alg) isa AutoForwardDiff{4}
761+
alg = @test_logs (:warn, r"The `chunk_size` keyword is deprecated") match_mode=:any @inferred(T(;
762+
autodiff = ad, chunk_size = Val{4}()))
763+
@test alg isa RosenbrockAlgorithm{4, <:AutoForwardDiff{4}, Val{:forward}()}
764+
@test OrdinaryDiffEqRosenbrock.OrdinaryDiffEqCore.alg_autodiff(alg) isa
765+
AutoForwardDiff{4}
763766
@test OrdinaryDiffEqRosenbrock.OrdinaryDiffEqCore.get_chunksize(alg) === Val{4}()
764767

765768
ad = AutoFiniteDiff(; fdtype = Val{:central}())
766769
alg = @test_logs @inferred(T(; autodiff = ad))
767-
@test alg isa RosenbrockAlgorithm{0,<:AutoFiniteDiff{Val{:central}},Val{:central}()}
770+
@test alg isa
771+
RosenbrockAlgorithm{0, <:AutoFiniteDiff{Val{:central}}, Val{:central}()}
768772
@test OrdinaryDiffEqRosenbrock.OrdinaryDiffEqCore.alg_autodiff(alg) === ad
769773
@test OrdinaryDiffEqRosenbrock.OrdinaryDiffEqCore.get_chunksize(alg) === Val{0}()
770774

771-
alg = @test_logs (:warn,r"The `diff_type` keyword is deprecated") match_mode=:any @inferred(T(; autodiff = ad, diff_type = Val{:complex}()))
772-
@test alg isa RosenbrockAlgorithm{0,<:AutoFiniteDiff{Val{:complex}},Val{:complex}()}
773-
@test OrdinaryDiffEqRosenbrock.OrdinaryDiffEqCore.alg_autodiff(alg) isa AutoFiniteDiff{Val{:complex}}
775+
alg = @test_logs (:warn, r"The `diff_type` keyword is deprecated") match_mode=:any @inferred(T(;
776+
autodiff = ad, diff_type = Val{:complex}()))
777+
@test alg isa
778+
RosenbrockAlgorithm{0, <:AutoFiniteDiff{Val{:complex}}, Val{:complex}()}
779+
@test OrdinaryDiffEqRosenbrock.OrdinaryDiffEqCore.alg_autodiff(alg) isa
780+
AutoFiniteDiff{Val{:complex}}
774781
@test OrdinaryDiffEqRosenbrock.OrdinaryDiffEqCore.get_chunksize(alg) === Val{0}()
775782

776783
# issue #2613
777784
f(u, _, _) = -u
778785
prob = ODEProblem(f, [1.0, 0.0], (0.0, 1.0))
779-
alg = T(; autodiff=AutoForwardDiff(; chunksize=1))
786+
alg = T(; autodiff = AutoForwardDiff(; chunksize = 1))
780787
sol = if alg isa OrdinaryDiffEqRosenbrock.OrdinaryDiffEqRosenbrockAdaptiveAlgorithm
781788
@inferred(solve(prob, alg))
782789
else
783-
@inferred(solve(prob, alg; dt=0.1))
790+
@inferred(solve(prob, alg; dt = 0.1))
784791
end
785792
@test sol.alg === alg
786-
alg = T(; autodiff=AutoFiniteDiff(; fdtype=Val(:central)))
793+
alg = T(; autodiff = AutoFiniteDiff(; fdtype = Val(:central)))
787794
sol = if alg isa OrdinaryDiffEqRosenbrock.OrdinaryDiffEqRosenbrockAdaptiveAlgorithm
788795
@inferred(solve(prob, alg))
789796
else
790-
@inferred(solve(prob, alg; dt=0.1))
797+
@inferred(solve(prob, alg; dt = 0.1))
791798
end
792799
@test sol.alg === alg
793800
end

0 commit comments

Comments
 (0)