Skip to content

Commit bd9971d

Browse files
Merge pull request #623 from SciML/fix-formatter-line-splits
Initialize line split fixes following Catalyst.jl PR #1306
2 parents 526236e + 61f42ae commit bd9971d

File tree

6 files changed

+17
-39
lines changed

6 files changed

+17
-39
lines changed

src/integrators/integrator_utils.jl

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,9 @@ end
355355
end
356356
else
357357
if integrator.u isa AbstractArray
358-
integrator.ΔW .= scaling_factor .*
359-
integrator.noise(size(integrator.u), integrator)
358+
integrator.ΔW .= scaling_factor .* integrator.noise(size(integrator.u), integrator)
360359
if alg_needs_extra_process(integrator.alg)
361-
integrator.ΔZ .= scaling_factor .*
362-
integrator.noise(size(integrator.u), integrator)
360+
integrator.ΔZ .= scaling_factor .* integrator.noise(size(integrator.u), integrator)
363361
end
364362
else
365363
integrator.ΔW = scaling_factor*integrator.noise(integrator)
@@ -389,21 +387,15 @@ end
389387
else
390388
if integrator.u isa AbstractArray
391389
if add1 != 0
392-
integrator.ΔWtilde = add1 .+
393-
scaling .*
394-
integrator.noise(size(integrator.u), integrator)
390+
integrator.ΔWtilde = add1 .+ scaling .* integrator.noise(size(integrator.u), integrator)
395391
else
396-
integrator.ΔWtilde = scaling .*
397-
integrator.noise(size(integrator.u), integrator)
392+
integrator.ΔWtilde = scaling .* integrator.noise(size(integrator.u), integrator)
398393
end
399394
if alg_needs_extra_process(integrator.alg)
400395
if add2 != 0
401-
integrator.ΔZtilde = add2 .+
402-
scaling .*
403-
integrator.noise(size(integrator.u), integrator)
396+
integrator.ΔZtilde = add2 .+ scaling .* integrator.noise(size(integrator.u), integrator)
404397
else
405-
integrator.ΔZtilde = scaling .*
406-
integrator.noise(size(integrator.u), integrator)
398+
integrator.ΔZtilde = scaling .* integrator.noise(size(integrator.u), integrator)
407399
end
408400
end
409401
else

src/perform_step/SROCK_perform_step.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,7 @@ end
195195

196196
gen_prob = !((is_diagonal_noise(integrator.sol.prob)) || (W.dW isa Number) ||
197197
(length(W.dW) == 1))
198-
gen_prob && (vec_χ = 2 .*
199-
floor.(false .* W.dW .+ 1//2 .+ oftype(W.dW, rand(W.rng, length(W.dW)))) .-
200-
true)
198+
gen_prob && (vec_χ = 2 .* floor.(false .* W.dW .+ 1//2 .+ oftype(W.dW, rand(W.rng, length(W.dW)))) .- true)
201199

202200
alg = unwrap_alg(integrator, true)
203201
alg.eigen_est === nothing ? maxeig!(integrator, cache) : alg.eigen_est(integrator)

src/perform_step/iif.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ end
4040
elseif cache isa IIF1MConstantCache
4141
tmp = exp(A*dt)*(uprev + integrator.g(uprev, p, t)*W.dW)
4242
elseif cache isa IIF2MConstantCache
43-
tmp = exp(A*dt)*(uprev + 0.5dt*integrator.f.f2(uprev, p, t) +
44-
integrator.g(uprev, p, t)*W.dW)
43+
tmp = exp(A*dt)*(uprev + 0.5dt*integrator.f.f2(uprev, p, t) + integrator.g(uprev, p, t)*W.dW)
4544
end
4645

4746
if integrator.iter > 1 && !integrator.u_modified

src/perform_step/low_order.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,7 @@ end
322322
if integrator.opts.adaptive
323323
En = integrator.opts.internalnorm(dW, t)^3*ggprime_norm^2 / 6
324324
du2 = integrator.f(K, p, t+dt)
325-
tmp = integrator.opts.internalnorm(integrator.opts.delta * dt * (du2 - du1) / 2, t) +
326-
En
325+
tmp = integrator.opts.internalnorm(integrator.opts.delta * dt * (du2 - du1) / 2, t) + En
327326

328327
tmp = calculate_residuals(tmp, uprev, u, integrator.opts.abstol,
329328
integrator.opts.reltol, integrator.opts.internalnorm, t)

src/perform_step/sdirk.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@
8686
if cache isa Union{ImplicitEMConstantCache, ImplicitEulerHeunConstantCache}
8787
En = mil_correction
8888
else
89-
En = integrator.opts.internalnorm.(integrator.W.dW .^ 3, t) .*
90-
integrator.opts.internalnorm.(ggprime, t) .^ 2 ./ 6
89+
En = integrator.opts.internalnorm.(integrator.W.dW .^ 3, t) .* integrator.opts.internalnorm.(ggprime, t) .^ 2 ./ 6
9190
end
9291

9392
resids = calculate_residuals(Ed, En, uprev, u, integrator.opts.abstol,

src/perform_step/sri.jl

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,7 @@ end
208208

209209
@.. E₂ = chi2 * (2 * g₁ - Fg₂o3 - Tg₃o3) + chi3 * (2 * mg₁ + 5 * g₂o3 - Tg₃o3 + g₄)
210210

211-
@.. u = uprev + (fH01 + 2 * fH02) / 3 + W.dW * (mg₁ + Fg₂o3 + Tg₃o3) +
212-
chi1 * (mg₁ + Fg₂o3 - g₃o3) + E₂
211+
@.. u = uprev + (fH01 + 2 * fH02) / 3 + W.dW * (mg₁ + Fg₂o3 + Tg₃o3) + chi1 * (mg₁ + Fg₂o3 - g₃o3) + E₂
213212

214213
if integrator.opts.adaptive
215214
@.. E₁ = fH01 + fH02
@@ -250,8 +249,7 @@ end
250249
mg₁ = -g₁
251250
E₂ = @.. chi2 * (2 * g₁ - Fg₂o3 - Tg₃o3) + chi3 * (2 * mg₁ + 5 * g₂o3 - Tg₃o3 + g₄)
252251

253-
u = uprev + (fH01 + 2fH02)/3 + W.dW .* (mg₁ + Fg₂o3 + Tg₃o3) +
254-
chi1 .* (mg₁ + Fg₂o3 - g₃o3) + E₂
252+
u = uprev + (fH01 + 2fH02)/3 + W.dW .* (mg₁ + Fg₂o3 + Tg₃o3) + chi1 .* (mg₁ + Fg₂o3 - g₃o3) + E₂
255253
if integrator.opts.adaptive
256254
E₁ = fH01 .+ fH02
257255

@@ -348,18 +346,14 @@ end
348346
g3 = integrator.g(H12, p, t+c13*dt)
349347

350348
H03 = uprev + dt*(a041*k1 + a042*k2 + a043*k3) + chi2 .* (b041*g1 + b042*g2 + b043*g3)
351-
H13 = uprev + dt*(a141*k1 + a142*k2 + a143*k3) +
352-
integrator.sqdt*(b141*g1 + b142*g2 + b143*g3)
349+
H13 = uprev + dt*(a141*k1 + a142*k2 + a143*k3) + integrator.sqdt*(b141*g1 + b142*g2 + b143*g3)
353350

354351
k4 = integrator.f(H03, p, t+c04*dt)
355352
g4 = integrator.g(H13, p, t+c14*dt)
356353

357-
E₂ = chi2 .* (beta31*g1 + beta32*g2 + beta33*g3 + beta34*g4) +
358-
chi3 .* (beta41*g1 + beta42*g2 + beta43*g3 + beta44*g4)
354+
E₂ = chi2 .* (beta31*g1 + beta32*g2 + beta33*g3 + beta34*g4) + chi3 .* (beta41*g1 + beta42*g2 + beta43*g3 + beta44*g4)
359355

360-
u = uprev + dt*(α1*k1 + α2*k2 + α3*k3 + α4*k4) + E₂ +
361-
W.dW .* (beta11*g1 + beta12*g2 + beta13*g3 + beta14*g4) +
362-
chi1 .* (beta21*g1 + beta22*g2 + beta23*g3 + beta24*g4)
356+
u = uprev + dt*(α1*k1 + α2*k2 + α3*k3 + α4*k4) + E₂ + W.dW .* (beta11*g1 + beta12*g2 + beta13*g3 + beta14*g4) + chi1 .* (beta21*g1 + beta22*g2 + beta23*g3 + beta24*g4)
363357

364358
E₁ = dt*(k1 + k2 + k3 + k4)
365359

@@ -430,11 +424,8 @@ end
430424
integrator.eigen_est = ϱu/ϱd
431425
end
432426

433-
@.. E₂ = chi2*(beta31*g1 + beta32*g2 + beta33*g3 + beta34*g4) +
434-
chi3*(beta41*g1 + beta42*g2 + beta43*g3 + beta44*g4)
435-
@.. u = uprev + dt*(α1*k1 + α2*k2 + α3*k3 + α4*k4) + E₂ +
436-
W.dW*(beta11*g1 + beta12*g2 + beta13*g3 + beta14*g4) +
437-
chi1*(beta21*g1 + beta22*g2 + beta23*g3 + beta24*g4)
427+
@.. E₂ = chi2*(beta31*g1 + beta32*g2 + beta33*g3 + beta34*g4) + chi3*(beta41*g1 + beta42*g2 + beta43*g3 + beta44*g4)
428+
@.. u = uprev + dt*(α1*k1 + α2*k2 + α3*k3 + α4*k4) + E₂ + W.dW*(beta11*g1 + beta12*g2 + beta13*g3 + beta14*g4) + chi1*(beta21*g1 + beta22*g2 + beta23*g3 + beta24*g4)
438429

439430
if integrator.opts.adaptive
440431
@.. E₁ = dt * (k1 + k2 + k3 + k4)

0 commit comments

Comments
 (0)