Skip to content

Commit

Permalink
Fix rebase mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Jan 4, 2024
1 parent 3720713 commit 3f58736
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 24 deletions.
17 changes: 10 additions & 7 deletions ext/NonlinearSolveSIAMFANLEquationsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SIAMFANLEquationsJL, arg
sol = ptcsolsc(f, prob.u0; delta0 = delta, maxit = maxiters, atol, rtol,
printerr = ShT)
elseif method == :secant
sol = secant(f, u; maxit = maxiters, atol, rtol, printerr = ShT)
sol = secant(f, prob.u0; maxit = maxiters, atol, rtol, printerr = ShT)
elseif method == :anderson
sol = aasol(f, u, m, __zeros_like(u, 1, 2 * m + 4); maxit = maxiters,
f_aa, u, _ = NonlinearSolve.__construct_extension_f(prob; alias_u0,
make_fixed_point = Val(true))
sol = aasol(f_aa, u, m, __zeros_like(u, 1, 2 * m + 4); maxit = maxiters,
atol, rtol, beta)
end
else
f, u, resid = NonlinearSolve.__construct_extension_f(prob; alias_u0)
f, u, resid = NonlinearSolve.__construct_extension_f(prob; alias_u0,
make_fixed_point = Val(method == :anderson))
N = length(u)
FS = __zeros_like(u, N)

Expand All @@ -80,7 +83,7 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SIAMFANLEquationsJL, arg
sol = ptcsol(f, u, FS, FPS; atol, rtol, maxit = maxiters,

Check warning on line 83 in ext/NonlinearSolveSIAMFANLEquationsExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/NonlinearSolveSIAMFANLEquationsExt.jl#L83

Added line #L83 was not covered by tests
delta0 = delta, printerr = ShT)
elseif method == :anderson
sol = aasol(f!, u, m, zeros(T, N, 2 * m + 4), atol, rtol,
sol = aasol(f, u, m, zeros(T, N, 2 * m + 4); atol, rtol,
maxit = maxiters, beta)
end
else
Expand All @@ -102,9 +105,9 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SIAMFANLEquationsJL, arg

retcode = __siam_fanl_equations_retcode_mapping(sol)
stats = __siam_fanl_equations_stats_mapping(method, sol)
resid = NonlinearSolve.evaluate_f(prob, sol.solution)
return SciMLBase.build_solution(prob, alg, sol.solution, resid; retcode, stats,
original = sol)
res = prob.u0 isa Number && method === :anderson ? sol.solution[1] : sol.solution
resid = NonlinearSolve.evaluate_f(prob, res)
return SciMLBase.build_solution(prob, alg, res, resid; retcode, stats, original = sol)
end

end
2 changes: 1 addition & 1 deletion src/algorithms/extension_algs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ end
linsolve::L
m::Int
beta
autodiff``
autodiff
end

function SIAMFANLEquationsJL(; method = :newton, delta = 1e-3, linsolve = nothing, m = 0,
Expand Down
15 changes: 0 additions & 15 deletions src/internal/helpers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,3 @@ function __construct_extension_jac(prob, alg, u0, fu; can_handle_oop::Val = Fals

return 𝐉
end

# @concrete struct InplaceFunction{iip} <: Function
# f
# p
# end

# (f::InplaceFunction{true})(du, u) = f.f(du, u, f.p)
# (f::InplaceFunction{true})(du, u, p) = f.f(du, u, p)
# (f::InplaceFunction{false})(du, u) = (du .= f.f(u, f.p))
# (f::InplaceFunction{false})(du, u, p) = (du .= f.f(u, p))

# struct __make_inplace{iip} end

# @inline __make_inplace{iip}(f::F, p) where {iip, F} = InplaceFunction{iip}(f, p)
# @inline __make_inplace{iip}(::Nothing, p) where {iip} = nothing
2 changes: 1 addition & 1 deletion test/wrappers/fixedpoint.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using NonlinearSolve, LinearAlgebra, Test
import FixedPointAcceleration, SpeedMapping, NLsolve
import SIAMFANLEquations, FixedPointAcceleration, SpeedMapping, NLsolve

# Simple Scalar Problem
@testset "Simple Scalar Problem" begin
Expand Down

0 comments on commit 3f58736

Please sign in to comment.