Last active
July 4, 2019 08:04
-
-
Save fgerick/9bc3272e79c63f77f141d5a2ba6a5dea to your computer and use it in GitHub Desktop.
Shift-invert Arnoldi for targeted generalised eigen problem in Julia
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Solve Ax = λBx using Shift-invert Arnoldi targeting complex σ: | |
| # (A-σB)^-1 Bx = 1/(λ-σ)x | |
| using LinearAlgebra, SparseArrays, Arpack, LinearMaps | |
| n=100 | |
| A = sprandn(n,n,0.1) | |
| B = sprandn(n,n,0.1) .+ sparse(1.0I,n,n) | |
| # eigenvalue to target: | |
| σ = 1.0im | |
| P = lu(A-σ*B) | |
| L = LinearMap{ComplexF64}((y,x) -> ldiv!(y,P,B*x),n) | |
| evals,u = eigs(L) | |
| λ = 1.0 ./evals .+ σ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment