Skip to content

Commit 4911fbd

Browse files
AdityaPandeyCNChrisRackauckas
authored andcommitted
removed unnecessary comments
Signed-off-by: AdityaPandeyCN <[email protected]>
1 parent 0a9551f commit 4911fbd

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

ext/NonlinearSolveSciPyExt.jl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ using SciMLBase
1212
using NonlinearSolve
1313

1414
# Re-export algorithm type so that `using NonlinearSolve` brings it in when the
15-
# extension is loaded. (Matches convention in other extensions.)
15+
# extension is loaded.
1616
import ..NonlinearSolve: SciPyLeastSquares, SciPyRoot, SciPyRootScalar
1717
using NonlinearSolveBase: construct_extension_function_wrapper
1818

1919
""" Internal: wrap a Julia residual function into a Python callable """
2020
function _make_py_residual(f, p)
2121
return pyfunc(x_py -> begin
22-
x = Vector{Float64}(x_py) # convert NumPy array → Julia Vector
22+
x = Vector{Float64}(x_py)
2323
r = f(x, p)
24-
return r # auto-convert back to NumPy
24+
return r
2525
end)
2626
end
2727

@@ -50,15 +50,13 @@ function SciMLBase.__solve(prob::SciMLBase.NonlinearLeastSquaresProblem, alg::Sc
5050
bounds = nothing
5151
end
5252

53-
# Call SciPy
5453
res = scipy_optimize.least_squares(py_f, collect(prob.u0);
5554
method = alg.method,
5655
loss = alg.loss,
5756
max_nfev = maxiters,
5857
bounds = bounds === nothing ? py_none : bounds,
5958
kwargs...)
6059

61-
# Extract solution
6260
u_vec = Vector{Float64}(res.x)
6361
resid = Vector{Float64}(res.fun)
6462

@@ -97,7 +95,7 @@ function SciMLBase.__solve(prob::SciMLBase.NonlinearProblem, alg::SciPyRoot;
9795
kwargs...)
9896

9997
u_vec = Vector{Float64}(res.x)
100-
f!(resid, u_vec) # update residual
98+
f!(resid, u_vec)
10199

102100
u_out = prob.u0 isa Number ? u_vec[1] : reshape(u_vec, size(prob.u0))
103101

@@ -137,4 +135,5 @@ function SciMLBase.__solve(prob::SciMLBase.IntervalNonlinearProblem, alg::SciPyR
137135
original = res, stats = stats)
138136
end
139137

140-
end # module
138+
end
139+

0 commit comments

Comments
 (0)