Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
oameye committed Jan 2, 2025
1 parent 7e03f66 commit 297d227
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
8 changes: 6 additions & 2 deletions src/largedeviations/geometric_min_action_method.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ algorithm[^1].
[^1]: [Heymann and Vanden-Eijnden, PRL (2008)](https://link.aps.org/doi/10.1103/PhysRevLett.100.140601)
"""
function geometric_min_action_method(sys::ContinuousTimeDynamicalSystem, x_i, x_f; N=100, kwargs...)
function geometric_min_action_method(
sys::ContinuousTimeDynamicalSystem, x_i, x_f; N=100, kwargs...
)
path = reduce(hcat, range(x_i, x_f; length=N))
return geometric_min_action_method(sys, path; kwargs...)
end
Expand Down Expand Up @@ -111,7 +113,9 @@ Solves eq. (6) of Ref.[^1] for an initial `path` with `N` points and arclength `
[^1]: [Heymann and Vanden-Eijnden, PRL (2008)](https://link.aps.org/doi/10.1103/PhysRevLett.100.140601)
"""
function heymann_vandeneijnden_step(sys::ContinuousTimeDynamicalSystem, path, N; tau=0.1, diff_order=4)
function heymann_vandeneijnden_step(
sys::ContinuousTimeDynamicalSystem, path, N; tau=0.1, diff_order=4
)
L = 1.0
dx = L / (N - 1)
update = zeros(size(path))
Expand Down
2 changes: 1 addition & 1 deletion src/largedeviations/sgMAM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function sgmam(
iterations::Int64=1000,
show_progress::Bool=false,
reltol::Real=NaN,
) where T
) where {T}
H_p, H_x = sys.H_p, sys.H_x

Nx, Nt = size(x_initial)
Expand Down
8 changes: 4 additions & 4 deletions test/largedeviations/API.jl
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
@testset "autonomous invertible additive noise" begin
f!(du, u, p, t) = du .= 1.01u
g_corr_alt!(du, u, p, t) = (du .= [1 0.3 1; 0.3 1 1]; return nothing)
corr_alt = CoupledSDEs(f!, zeros(2); g = g_corr_alt!, noise_prototype = zeros(2, 3))
corr_alt = CoupledSDEs(f!, zeros(2); g=g_corr_alt!, noise_prototype=zeros(2, 3))

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

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

x_i = SA[sqrt(2 / 3), sqrt(2 / 27)]
x_f = SA[0.001, 0.0]
N, T = 200, 2.0
init = reduce(hcat, range(x_i, x_f; length=N))

for inst in [corr_alt, addit_non_autom, linear_multipli]
@test_throws ArgumentError min_action_method(inst,init, T)
@test_throws ArgumentError min_action_method(inst, init, T)
@test_throws ArgumentError geometric_min_action_method(inst, init)
@test_throws ArgumentError sgmam(inst, init)
end
Expand Down

0 comments on commit 297d227

Please sign in to comment.