Skip to content

Commit

Permalink
fix non-diagonal lamba
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Apr 5, 2018
1 parent 13e8f07 commit 396c871
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/caches/lamba_caches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ struct LambaEMCache{uType,rateType,rateNoiseType,dWType} <: StochasticDiffEqMuta
du2::rateType
K::rateType
tmp::uType
L::rateType
L::rateNoiseType
gtmp::rateNoiseType
dW_cache::dWType
end
Expand Down Expand Up @@ -37,7 +37,7 @@ struct LambaEulerHeunCache{uType,rateType,rateNoiseType,dWType} <: StochasticDif
du2::rateType
K::rateType
tmp::uType
L::rateType
L::rateNoiseType
gtmp::rateNoiseType
dW_cache::dWType
end
Expand Down
10 changes: 5 additions & 5 deletions src/perform_step/lamba.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ end
g_sized = L
end

@. tmp = @muladd K + L*integrator.sqdt

if !is_diagonal_noise(integrator.sol.prob)
@. tmp = @muladd K + g_sized*integrator.sqdt
integrator.g(gtmp,tmp,p,t)
g_sized2 = norm(gtmp,2)
@. dW_cache = dW.^2 - dt
diff_tmp = integrator.opts.internalnorm(dW_cache)
En = (g_sized2-g_sized)/(2integrator.sqdt)*diff_tmp
@. tmp = En
else
@. tmp = @muladd K + L*integrator.sqdt
integrator.g(gtmp,tmp,p,t)
@. tmp = (gtmp-L)/(2integrator.sqdt)*(W.dW.^2 - dt)
end
Expand Down Expand Up @@ -163,16 +163,16 @@ end
g_sized = L
end

@. tmp = @muladd uprev + L*integrator.sqdt

if !is_diagonal_noise(integrator.sol.prob)
@. tmp = @muladd uprev + g_sized*integrator.sqdt
integrator.g(gtmp,tmp,p,t)
g_sized2 = norm(gtmp,2)
@. dW_cache = dW.^2
@. dW_cache = W.dW.^2
diff_tmp = integrator.opts.internalnorm(dW_cache)
En = (g_sized2-g_sized)/(2integrator.sqdt)*diff_tmp
@. tmp = En
else
@. tmp = @muladd uprev + L*integrator.sqdt
integrator.g(gtmp,tmp,p,t)
@. tmp = (gtmp-L)/(2integrator.sqdt)*(W.dW.^2)
end
Expand Down

0 comments on commit 396c871

Please sign in to comment.