Skip to content

Commit be54fd3

Browse files
committed
Run formatter
1 parent 2a6bc88 commit be54fd3

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

src/largedeviations/min_action_method.jl

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ value.
3535
- `show_progress = false`: whether to print a progress bar
3636
"""
3737
function min_action_method(
38-
sys::ContinuousTimeDynamicalSystem, x_i, x_f, T::Real;
39-
N=100, kwargs...
38+
sys::ContinuousTimeDynamicalSystem, x_i, x_f, T::Real; N=100, kwargs...
4039
)
4140
init = reduce(hcat, range(x_i, x_f; length=N))
4241
return min_action_method(sys, init, T; kwargs...)
@@ -71,8 +70,9 @@ function min_action_method(
7170
proper_MAM_system(sys)
7271
end
7372
times = range(0.0, T; length=size(init, 2))
74-
S(x) = action(sys, fix_ends(x, init[:, 1], init[:, end]), times, functional;
75-
noise_strength)
73+
S(x) = action(
74+
sys, fix_ends(x, init[:, 1], init[:, end]), times, functional; noise_strength
75+
)
7676

7777
optf = OptimizationFunction((x, _) -> S(x), ad_type)
7878
prob = OptimizationProblem(optf, init, ())
@@ -85,12 +85,7 @@ function min_action_method(
8585
end
8686

8787
sol = solve(
88-
prob,
89-
method;
90-
maxiters=maxiter,
91-
callback=callback,
92-
abstol=abstol,
93-
reltol=reltol,
88+
prob, method; maxiters=maxiter, callback=callback, abstol=abstol, reltol=reltol
9489
)
9590
return MinimumActionPath(StateSpaceSet(sol.u'), sol.objective)
9691
end;
@@ -113,4 +108,4 @@ end;
113108
114109
Alias for [`min_action_method`](@ref).]
115110
"""
116-
const action_minimizer = min_action_method
111+
const action_minimizer = min_action_method

test/CoupledSDEs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ using CriticalTransitions, Test
116116

117117
g!(du, u, p, t) = du .= u
118118
@test_throws ArgumentError CoupledSDEs(
119-
f!, zeros(2); g=g!, covariance=[1 0.3; 0.3 1]
119+
f!, zeros(2); g=(g!), covariance=[1 0.3; 0.3 1]
120120
)
121121

122122
g(u, p, t) = u

test/largedeviations/API.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
@testset "autonomous invertible additive noise" begin
22
f!(du, u, p, t) = du .= 1.01u
3-
g_corr_alt!(du, u, p, t) = (du .= [1 0.3 1; 0.3 1 1]; return nothing)
4-
corr_alt = CoupledSDEs(f!, zeros(2); g=g_corr_alt!, noise_prototype=zeros(2, 3))
3+
g_corr_alt!(du, u, p, t) = (du.=[1 0.3 1; 0.3 1 1]; return nothing)
4+
corr_alt = CoupledSDEs(f!, zeros(2); g=(g_corr_alt!), noise_prototype=zeros(2, 3))
55

6-
g_addit_non_autom!(du, u, p, t) = (du .= 1 / (1 + t); return nothing)
7-
addit_non_autom = CoupledSDEs(f!, zeros(2); g=g_addit_non_autom!)
6+
g_addit_non_autom!(du, u, p, t) = (du.=1 / (1 + t); return nothing)
7+
addit_non_autom = CoupledSDEs(f!, zeros(2); g=(g_addit_non_autom!))
88

9-
g_linear_multipli!(du, u, p, t) = (du .= u; return nothing)
10-
linear_multipli = CoupledSDEs(f!, rand(2) ./ 10; g=g_linear_multipli!)
9+
g_linear_multipli!(du, u, p, t) = (du.=u; return nothing)
10+
linear_multipli = CoupledSDEs(f!, rand(2) ./ 10; g=(g_linear_multipli!))
1111

1212
x_i = SA[sqrt(2 / 3), sqrt(2 / 27)]
1313
x_f = SA[0.001, 0.0]

0 commit comments

Comments
 (0)