Skip to content

Commit 7bf098a

Browse files
committed
Fix rebase mistake
1 parent 3720713 commit 7bf098a

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
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,

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)