Skip to content

Commit 3f58736

Browse files
committed
Fix rebase mistake
1 parent 3720713 commit 3f58736

File tree

4 files changed

+12
-24
lines changed

4 files changed

+12
-24
lines changed

ext/NonlinearSolveSIAMFANLEquationsExt.jl

+10-7
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,16 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SIAMFANLEquationsJL, arg
4848
sol = ptcsolsc(f, prob.u0; delta0 = delta, maxit = maxiters, atol, rtol,
4949
printerr = ShT)
5050
elseif method == :secant
51-
sol = secant(f, u; maxit = maxiters, atol, rtol, printerr = ShT)
51+
sol = secant(f, prob.u0; maxit = maxiters, atol, rtol, printerr = ShT)
5252
elseif method == :anderson
53-
sol = aasol(f, u, m, __zeros_like(u, 1, 2 * m + 4); maxit = maxiters,
53+
f_aa, u, _ = NonlinearSolve.__construct_extension_f(prob; alias_u0,
54+
make_fixed_point = Val(true))
55+
sol = aasol(f_aa, u, m, __zeros_like(u, 1, 2 * m + 4); maxit = maxiters,
5456
atol, rtol, beta)
5557
end
5658
else
57-
f, u, resid = NonlinearSolve.__construct_extension_f(prob; alias_u0)
59+
f, u, resid = NonlinearSolve.__construct_extension_f(prob; alias_u0,
60+
make_fixed_point = Val(method == :anderson))
5861
N = length(u)
5962
FS = __zeros_like(u, N)
6063

@@ -80,7 +83,7 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SIAMFANLEquationsJL, arg
8083
sol = ptcsol(f, u, FS, FPS; atol, rtol, maxit = maxiters,
8184
delta0 = delta, printerr = ShT)
8285
elseif method == :anderson
83-
sol = aasol(f!, u, m, zeros(T, N, 2 * m + 4), atol, rtol,
86+
sol = aasol(f, u, m, zeros(T, N, 2 * m + 4); atol, rtol,
8487
maxit = maxiters, beta)
8588
end
8689
else
@@ -102,9 +105,9 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SIAMFANLEquationsJL, arg
102105

103106
retcode = __siam_fanl_equations_retcode_mapping(sol)
104107
stats = __siam_fanl_equations_stats_mapping(method, sol)
105-
resid = NonlinearSolve.evaluate_f(prob, sol.solution)
106-
return SciMLBase.build_solution(prob, alg, sol.solution, resid; retcode, stats,
107-
original = sol)
108+
res = prob.u0 isa Number && method === :anderson ? sol.solution[1] : sol.solution
109+
resid = NonlinearSolve.evaluate_f(prob, res)
110+
return SciMLBase.build_solution(prob, alg, res, resid; retcode, stats, original = sol)
108111
end
109112

110113
end

src/algorithms/extension_algs.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ end
440440
linsolve::L
441441
m::Int
442442
beta
443-
autodiff``
443+
autodiff
444444
end
445445

446446
function SIAMFANLEquationsJL(; method = :newton, delta = 1e-3, linsolve = nothing, m = 0,

src/internal/helpers.jl

-15
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,3 @@ function __construct_extension_jac(prob, alg, u0, fu; can_handle_oop::Val = Fals
201201

202202
return 𝐉
203203
end
204-
205-
# @concrete struct InplaceFunction{iip} <: Function
206-
# f
207-
# p
208-
# end
209-
210-
# (f::InplaceFunction{true})(du, u) = f.f(du, u, f.p)
211-
# (f::InplaceFunction{true})(du, u, p) = f.f(du, u, p)
212-
# (f::InplaceFunction{false})(du, u) = (du .= f.f(u, f.p))
213-
# (f::InplaceFunction{false})(du, u, p) = (du .= f.f(u, p))
214-
215-
# struct __make_inplace{iip} end
216-
217-
# @inline __make_inplace{iip}(f::F, p) where {iip, F} = InplaceFunction{iip}(f, p)
218-
# @inline __make_inplace{iip}(::Nothing, p) where {iip} = nothing

test/wrappers/fixedpoint.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using NonlinearSolve, LinearAlgebra, Test
2-
import FixedPointAcceleration, SpeedMapping, NLsolve
2+
import SIAMFANLEquations, FixedPointAcceleration, SpeedMapping, NLsolve
33

44
# Simple Scalar Problem
55
@testset "Simple Scalar Problem" begin

0 commit comments

Comments
 (0)