Skip to content
This repository was archived by the owner on Apr 16, 2025. It is now read-only.

Commit 6a1a40f

Browse files
committed
format
1 parent 7cccd62 commit 6a1a40f

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/itp.jl

+8-9
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct Itp <: AbstractBracketingAlgorithm
1111
k1::Real
1212
k2::Real
1313
n0::Int
14-
function Itp(;k1::Real = 0.007, k2::Real = 1.5, n0::Int = 10)
14+
function Itp(; k1::Real = 0.007, k2::Real = 1.5, n0::Int = 10)
1515
if k1 < 0
1616
error("Hyper-parameter κ₁ should not be negative")
1717
end
@@ -26,8 +26,8 @@ struct Itp <: AbstractBracketingAlgorithm
2626
end
2727

2828
function SciMLBase.solve(prob::IntervalNonlinearProblem, alg::Itp,
29-
args...; abstol = 1.0e-15,
30-
maxiters = 1000, kwargs...)
29+
args...; abstol = 1.0e-15,
30+
maxiters = 1000, kwargs...)
3131
f = Base.Fix2(prob.f, prob.p)
3232
left, right = prob.tspan # a and b
3333
fl, fr = f(left), f(right)
@@ -58,10 +58,10 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem, alg::Itp,
5858
while i <= maxiters
5959
#mid = (left + right) / 2
6060
r = ϵ_s - ((right - left) / 2)
61-
δ = k1 * ((right - left) ^ k2)
61+
δ = k1 * ((right - left)^k2)
6262

6363
## Interpolation step ##
64-
x_f = (fr * left - fl * right) / (fr - fl)
64+
x_f = (fr * left - fl * right) / (fr - fl)
6565

6666
## Truncation step ##
6767
σ = sign(mid - x_f)
@@ -96,11 +96,10 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem, alg::Itp,
9696

9797
if (right - left < 2 * ϵ)
9898
return SciMLBase.build_solution(prob, alg, mid, f(mid);
99-
retcode = ReturnCode.Success, left = left,
100-
right = right)
99+
retcode = ReturnCode.Success, left = left,
100+
right = right)
101101
end
102102
end
103103
return SciMLBase.build_solution(prob, alg, left, fl; retcode = ReturnCode.MaxIters,
104104
left = left, right = right)
105-
106-
end
105+
end

0 commit comments

Comments
 (0)