I am experimenting with NonlinearSolve.jl to solve a nonlinear system of equations with a symmetric indefinite Jacobian. I am specifically interested in using MINRES to solve this system. In my code, I’ve not specified any preconditioner, yet I’m receiving the warning:
┌ Warning: minres! doesn't support right preconditioning.
└ @ LinearSolve ~/.julia/packages/LinearSolve/B82H3/src/iterative_wrappers.jl:275
The documentation for NonlinearSolve.jl suggests that no preconditioner is the default. Here is a minimal working example that triggers the warning:
using NonlinearSolve
using LinearSolve
# Yes, this is a linear system...
function f(du, u, p)
du[1] = u[1] - 1
du[2] = -u[2] + 1
end
function jvp(Jv, v, u, p)
Jv .= [v[1]; -v[2]]
end
u0 = [0.0, 0.0]
p = nothing
ff = NonlinearFunction(f; jvp=jvp)
prob = NonlinearProblem(ff, u0, p)
sol = solve(prob, NewtonRaphson(linsolve = KrylovJL_MINRES()))
Why I am getting this warning even though I have not explicitly installed a preconditioner?
Thanks for confirming that the warning is spurious.
Looking into the code, I see that NonlineearSolve.jl uses the internal function __wrapprecs, which is called by LinearSolverCache and installs default explicit identity preconditioners. Although these identity preconditioners mathematically provide no preconditioning, they inadvertently cause MINRES to incur additional overhead. Would it be feasible to redefine these identity preconditioners as type UniformScaling, which does not result in this overhead?
In the meantime, instead of globally disabling all warnings, is there a way to call solve that would execute the following line of code?