Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NLEIGS TOAR #242

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions src/LinSolvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ See [`LinSolver`](@ref) and [`FactorizeLinSolverCreator`](@ref) for examples.
function FactorizeLinSolver(nep::NEP, λ, umfpack_refinements)
A=compute_Mder(nep,λ)
Afact=factorize(A)
# Only activate umfpack_refiments on julia >= 1.9 cf #265
if (Afact isa SparseArrays.UMFPACK.UmfpackLU &
isdefined(Afact,:control))
Afact.control[8]=umfpack_refinements # Set the maximum number of refiments
end
return FactorizeLinSolver(Afact, umfpack_refinements)
end

Expand All @@ -125,19 +130,7 @@ This function must be overloaded if a user wants to define their own
way of solving linear systems. See [`LinSolver`](@ref) for examples.
"""
function lin_solve(solver::FactorizeLinSolver, x::Array; tol = 0)
with_umfpack_refinements(solver.umfpack_refinements) do
solver.Afact \ x
end
end

function with_umfpack_refinements(f::Function, refinements)
current_refinements = SuiteSparse.UMFPACK.umf_ctrl[8]
try
SuiteSparse.UMFPACK.umf_ctrl[8] = refinements
f()
finally
SuiteSparse.UMFPACK.umf_ctrl[8] = current_refinements
end
solver.Afact \ x
end


Expand Down
1 change: 1 addition & 0 deletions src/NEPSolver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module NEPSolver
include("method_broyden.jl")
include("method_ilan.jl")
include("method_nleigs.jl")
include("method_nleigs_toar.jl")



Expand Down
Loading