-
Notifications
You must be signed in to change notification settings - Fork 55
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
An implementation of DIOM #63
Conversation
I didn't passed tests on julia 0.7: I don't understand why, It works on my laptop... |
Possibly because this package hasn't yet been upgraded to 0.7 and so doesn't pull the correct version of LinearOperators?! You're probably using a recent enough version on your laptop. First we need to upgrade to 0.7 (in another PR). |
I found the problem, @abel renamed the function |
Codecov Report
@@ Coverage Diff @@
## master JuliaLang/julia#63 +/- ##
=========================================
+ Coverage 99.48% 99.5% +0.02%
=========================================
Files 19 20 +1
Lines 1542 1619 +77
=========================================
+ Hits 1534 1611 +77
Misses 8 8
Continue to review full report at Codecov.
|
|
Thanks @abel ! |
LU factorization with partial pivoting don't break if H is singular. Furthermore the process is more stable, the biggest pivot is chosen at each step. I'm quite sure that this version was never implemented. In the article |
@@ -0,0 +1,71 @@ | |||
include("get_div_grad.jl") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DIOM and DQGMRES should really be tested on unsymmetric systems as well.
I also updated the reference of the article |
src/diom.jl
Outdated
|
||
"""Solve the consistent linear system Ax = b using direct incomplete orthogonalization method. | ||
|
||
DIOM is similar to SYMMLQ for nonsymmetric problems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is accurate. FOM is to the Arnoldi process as CG is to the Lanczos process. I think it would be more accurate to say that DIOM is similar to CG with partial reorthogonalization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will rewrite the docString.
src/diom.jl
Outdated
It's a more economical algorithm based upon the LU factorization with partial pivoting. | ||
|
||
In the particular case where A is symmetric indefinite, DIOM is theorecally equivalent | ||
to SYMMLQ but slightly more economical. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is true either; DIOM and SYMMLQ do not minimize the same quantities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's not norm(x) that is minimized. I think we could delete this sentence?
next_pos = mod(iter, mem) + 1 # Position corresponding to vₘ₊₁ in the circular stack V. | ||
|
||
# Incomplete Arnoldi procedure. | ||
z = M * V[:,pos] # Forms pₘ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why Github isn't rendering UTF-8 characters correctly. Is your editor set to use UTF-8 encoding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both Safari and Chrome seem to be missing characters...
Great, thank you! |
src/diom.jl
Outdated
# m-i+2 represents the indice of the diagonal where hᵢ.ₘ is located. | ||
# In addition of that, the last column of Uₘ is stored in H. | ||
L = zeros(mem) # Last mem Pivots of Lₘ. | ||
p = zeros(Bool, mem) # Last mem permutations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe p
could be a BitArray
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I didn't know that a Bool
was an Uint8
in Julia and not a single bit
.
end | ||
# Compute hₘ₊₁.ₘ and vₘ₊₁. | ||
H[1] = @knrm2(n, w) # hₘ₊₁.ₘ = ‖vₘ₊₁‖ | ||
if H[1] ≉ 0 # hₘ₊₁.ₘ ≈ 0 ⇒ "lucky breakdown" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there a tolerance involved in ≉
? In my experience, we want to test for != 0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there is a tolerance involved in ≈
, x ≈ y
return true if norm(x-y) ≤ rtol * max(|x|,|y|)
. With rtol that depend of the type of x and y. It's sqrt(eps)
with eps the precision machine of Float16, Float32, Float64....
But when we do x ≈ 0
, It's mean that |x| ≤ rtol * |x| ↔ x = 0
. I used this notation because I find it nicer than ==
. Also I like this notation because it means that x is a zero for the computer in the working precision but it's possible that it's not a zero in another precision or in exact arithmetic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
Thank you! |
Little brother of
DQGMRES
.Currently, the factorization is
H
is done without pivoting.Like
DQGMRES
, we can avoid the storage of H and I found a way to preconditioned it too.This algorithm needs
2n + 1
vectors ofmem
coefficients.