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

Feature: user defined damping in Newton type methods #244

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jarlebring
Copy link
Member

@jarlebring jarlebring commented Sep 17, 2020

This PR adds the possibility to do damping in the newton-type methods. This is useful when you want further control of the convergence, e.g., if the eigenvalue jumps around too much in the beginning of the iteration, one can freeze it for a couple of iterations. This happens eg if your eigval approximation is much better than your eigvec approximation.

julia> dampfun(j,λ,v,Δλ,Δv,err) = (j<5 ? 0 : Δλ, Δv); # Damp eigval update to zero for the first five its
julia> nep=nep_gallery("dep0");
julia> quasinewton(nep,v=ones(size(nep,1)), λ=-0.1595, damping=dampfun,logger=1)
Precomputing linsolver
iter 1 err:0.40385648969108706 λ=-0.1595 + 0.0im
iter 2 err:4.9268122755813825e-5 λ=-0.1595 + 0.0im
iter 3 err:1.693098602693684e-5 λ=-0.1595 + 0.0im
iter 4 err:1.6930148875939743e-5 λ=-0.1595 + 0.0im
iter 5 err:1.6930148908063535e-5 λ=-0.1595 + 0.0im
iter 6 err:3.534207222540244e-10 λ=-0.15955391952211395 + 0.0im
iter 7 err:1.3189598399245775e-10 λ=-0.15955391865305488 + 0.0im
iter 8 err:6.342596145681362e-15 λ=-0.15955391823297246 + 0.0im
(-0.15955391823297246 + 0.0im, Complex{Float64}[6874.829341069828 + 0.0im, 46596.517747917926 + 0.0im, -5998.0275339435675 + 0.0im, 1523.6237897132014 + 0.0im, 5978.311709367396 + 0.0im])

Compare without damping:

julia> quasinewton(nep,v=ones(size(nep,1)), λ=-0.1595, logger=1)
Precomputing linsolver
iter 1 err:0.40385648969108706 λ=-0.1595 + 0.0im
iter 2 err:0.4016720362965377 λ=-3.3722880129157558 + 0.0im
iter 3 err:0.34209754911455964 λ=-2.353155480506111 + 0.0im
iter 4 err:0.24201665248389861 λ=-1.3736098413798286 + 0.0im
iter 5 err:0.11032443885756192 λ=-0.5854977681397857 + 0.0im
iter 6 err:0.016780803794660546 λ=-0.2144694794858884 + 0.0im
iter 7 err:0.00027978305577110147 λ=-0.1604064664410386 + 0.0im
iter 8 err:2.117065649874461e-5 λ=-0.1595002456505578 + 0.0im
iter 9 err:4.241786204533617e-5 λ=-0.15950000000003325 + 0.0im
iter 10 err:2.2749491979568696e-5 λ=-0.15962637415973216 + 0.0im
iter 11 err:5.422980704846321e-10 λ=-0.15955391728395485 + 0.0im
iter 12 err:2.3829635069539644e-10 λ=-0.1595539189919185 + 0.0im
iter 13 err:1.1465551278495235e-14 λ=-0.15955391823295587 + 0.0im
(-0.15955391823295587 + 0.0im, Complex{Float64}[-1.2308999948560478e7 + 0.0im, -8.34284759820621e7 + 0.0im, 1.0739135030701244e7 + 0.0im, -2.7279637382659465e6 + 0.0im, -1.070383494226937e7 + 0.0im])

Not yet ready to be merged. At the moment only implemented for quasinewton.

@jarlebring jarlebring changed the title Feature: damping in Newton type methods Feature: user defined damping in Newton type methods Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant