Created
May 22, 2019 07:49
-
-
Save mfherbst/0732c386039457e7eb424e3572ebb129 to your computer and use it in GitHub Desktop.
A test for the LOBPCG eigensolver from IterativeSolvers.jl
This file contains 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
using IterativeSolvers | |
function run_test(;N=1000) | |
A = [7.44333, 7.44333, 5.77377, 6.35301, 6.35301, 6.18264, 7.44333, 5.77377, | |
6.35301, 5.77377, 3.35461, 3.18425, 5.26268, 6.35301, 3.18425, 2.26429, | |
3.59312, 7.17075, 5.26268, 3.59312, 4.17236, 7.00039, 7.17075, 7.00039, | |
6.35301, 6.18264, 6.35301, 3.18425, 2.26429, 3.59312, 7.17075, 6.18264, | |
2.26429, 0.594723, 1.17396, 4.00199, 3.59312, 1.17396, 1.0036, 3.08203, | |
7.40926, 7.17075, 4.00199, 3.08203, 4.41086, 7.9885, 7.40926, 7.9885, | |
5.26268, 3.59312, 4.17236, 7.00039, 3.59312, 1.17396, 1.0036, 3.08203, | |
7.40926, 4.17236, 1.0036, 0.083633, 1.41247, 4.9901, 7.00039, 3.08203, | |
1.41247, 1.9917, 4.81974, 7.40926, 4.9901, 4.81974, 6.89817, 7.17075, | |
7.00039, 7.17075, 4.00199, 3.08203, 4.41086, 7.9885, 7.00039, 3.08203, | |
1.41247, 1.9917, 4.81974, 4.41086, 1.9917, 1.82134, 3.89977, 7.9885, | |
4.81974, 3.89977, 5.22861, 7.40926, 7.9885, 7.40926, 4.9901, 4.81974, | |
6.89817, 7.9885, 4.81974, 3.89977, 5.22861, 6.89817, 5.22861, 5.80785] | |
println("Size of matrix: $(length(A))") | |
worked=0 | |
for i in 1:N | |
worked += try | |
lobpcg(Diagonal(A), false, 5) | |
1 | |
catch PosDefException | |
0 | |
end | |
end | |
println("Success rate: $(worked / N * 100)%") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment