Skip to content

Commit 6045e5e

Browse files
ocotsgithub-actions[bot]
authored andcommitted
Format .jl files
1 parent 4c4428c commit 6045e5e

2 files changed

Lines changed: 20 additions & 15 deletions

File tree

src/Data/pseudo_hamiltonian_vector_field.jl

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -274,15 +274,14 @@ function (H::PseudoHamiltonianVectorField{
274274
x, p, u, v; variable_costate::Bool=false
275275
)
276276
variable_costate || return H.f(x, p, u, v)
277-
hasmethod(
278-
H.f, Tuple{typeof(x),typeof(p),typeof(u),typeof(v)}, (:variable_costate,)
279-
) || throw(
280-
Exceptions.PreconditionError(
281-
"variable_costate=true is not supported by this PseudoHamiltonianVectorField's inner function";
282-
suggestion="Provide an inner function accepting a `variable_costate::Bool` keyword and returning `(dx, dp, dpv)` when true",
283-
context="PseudoHamiltonianVectorField Autonomous/NonFixed call",
284-
),
285-
)
277+
hasmethod(H.f, Tuple{typeof(x),typeof(p),typeof(u),typeof(v)}, (:variable_costate,)) ||
278+
throw(
279+
Exceptions.PreconditionError(
280+
"variable_costate=true is not supported by this PseudoHamiltonianVectorField's inner function";
281+
suggestion="Provide an inner function accepting a `variable_costate::Bool` keyword and returning `(dx, dp, dpv)` when true",
282+
context="PseudoHamiltonianVectorField Autonomous/NonFixed call",
283+
),
284+
)
286285
return H.f(x, p, u, v; variable_costate=true)
287286
end
288287

@@ -293,9 +292,7 @@ function (H::PseudoHamiltonianVectorField{
293292
)
294293
variable_costate || return H.f(t, x, p, u, v)
295294
hasmethod(
296-
H.f,
297-
Tuple{typeof(t),typeof(x),typeof(p),typeof(u),typeof(v)},
298-
(:variable_costate,),
295+
H.f, Tuple{typeof(t),typeof(x),typeof(p),typeof(u),typeof(v)}, (:variable_costate,)
299296
) || throw(
300297
Exceptions.PreconditionError(
301298
"variable_costate=true is not supported by this PseudoHamiltonianVectorField's inner function";

test/suite/data/test_pseudo_hamiltonian_vector_field.jl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ function test_pseudo_hamiltonian_vector_field()
4646
(x, p, u, v) -> (x .* v .+ u, -p); is_autonomous=true, is_variable=true
4747
)
4848
Test.@test phvf_autonomous_nonfixed isa Data.PseudoHamiltonianVectorField
49-
Test.@test Traits.time_dependence(phvf_autonomous_nonfixed) ==
50-
Traits.Autonomous
49+
Test.@test Traits.time_dependence(phvf_autonomous_nonfixed) == Traits.Autonomous
5150
Test.@test Traits.variable_dependence(phvf_autonomous_nonfixed) ==
5251
Traits.NonFixed
5352

@@ -416,7 +415,16 @@ function test_pseudo_hamiltonian_vector_field()
416415
# Test variable_costate kwarg
417416
dx = [0.0, 0.0]
418417
dp = [0.0, 0.0]
419-
phvf(dx, dp, 0.0, [1.0, 2.0], [0.5, 1.0], [0.1, 0.1], 0.5; variable_costate=false)
418+
phvf(
419+
dx,
420+
dp,
421+
0.0,
422+
[1.0, 2.0],
423+
[0.5, 1.0],
424+
[0.1, 0.1],
425+
0.5;
426+
variable_costate=false,
427+
)
420428
Test.@test dx == [1.6, 2.6]
421429
Test.@test dp == [1.0, 1.5]
422430
end

0 commit comments

Comments
 (0)