-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
(H+μI) \ x solvers for Hessenberg factorizations #31853
Conversation
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’m not really qualified to review but this is an impressively thorough PR. @jiahao, maybe you could review?
I'll try to wrap my head around this tonight. |
One related change that I was considering: change Rationale:
Alternatively, it could be a new function called But that could be a separate PR. |
I resisted the |
Probably in this case we should avoid (This could be signified in the data structure in various ways, most simply by having an empty |
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.
Great upgrade of the Hessenberg
factorization.
Did you consider a separate HessenbergMatrix
? I'm not sure it's worth the trouble but it would allow us to e.g. just overload ldiv!
instead of introducing special solve functions. It might also be useful for the eigenvalue problem.
Probably in this case we should avoid Hessenberg! simply by having
H = Hessenberg(A)
ignore the lower triangle ofA
, similar toUpperTriangular(A)
.
I agree. I think it would be a good idea to make Hessenberg
just wrap the input matrix with an empty τ
vector.
I didn't think about this… it's an interesting thought, but I have a couple of questions:
I would tend to call it |
Update: added an julia> A = rand(6,6)
6×6 Array{Float64,2}:
0.107756 0.181333 0.366188 0.441492 0.0903661 0.342221
0.236713 0.121664 0.769639 0.878645 0.774642 0.464094
0.204347 0.110714 0.993152 0.0257284 0.408132 0.00811852
0.0485218 0.618574 0.856544 0.498366 0.109 0.485984
0.0248759 0.652369 0.0578524 0.522572 0.615913 0.655619
0.0747064 0.344599 0.123562 0.915485 0.732657 0.752754
julia> F = hessenberg(A);
julia> F.H
6×6 UpperHessenberg{Float64,Array{Float64,2},Bool}:
0.107756 -0.512071 0.394723 -0.081845 0.076756 0.23782
-0.326105 1.48647 -1.21715 0.341651 0.680446 -0.364656
⋅ -1.25486 0.833861 0.357741 0.214807 0.120456
⋅ ⋅ 1.11037 0.478931 0.217121 -0.121404
⋅ ⋅ ⋅ -0.31514 0.143539 0.219257
⋅ ⋅ ⋅ ⋅ -0.0626903 0.0390469 |
I made the |
Upon reflection, I'm not happy with including a shift µ in the
I'm inclined towards the latter, since copy-free shifts mainly seem useful in re-using Hessenberg factorizations. |
AppVeyor failure is #29880. Travis is |
I updated it to add specialized Hessenberg factorizations for In the |
Travis osx failure is unrelated |
@andreasnoack, I've added quite a bit since the last time you reviewed; any comments prior to merging? |
Will merge at the end of the week if there are no further comments. |
…ation for SymTridiagonal factorization of Hermitian A
c06694b
to
ef3644f
Compare
Tests are passing again except for the unrelated "failed running test Profile" on win32. Good to merge? |
@stevengj While updating GenericLinearAlgebra to work with this change I wondered why you added the |
@andreasnoack, for For example: julia> H = hessenberg(Hermitian(rand(4,4)))
Hessenberg{Float64,SymTridiagonal{Float64,Array{Float64,1}},Array{Float64,2},Array{Float64,1},Bool}
Q factor:
4×4 LinearAlgebra.HessenbergQ{Float64,Array{Float64,2},Array{Float64,1},true}:
0.857333 0.327767 -0.396924 0.0
0.135862 -0.88782 -0.439679 0.0
-0.496509 0.323024 -0.805688 0.0
0.0 0.0 0.0 1.0
H factor:
4×4 SymTridiagonal{Float64,Array{Float64,1}}:
0.207701 0.0808081 ⋅ ⋅
0.0808081 0.211438 0.510799 ⋅
⋅ 0.510799 1.40159 -0.86616
⋅ ⋅ -0.86616 0.0661149
julia> H.Q
4×4 LinearAlgebra.HessenbergQ{Float64,Array{Float64,2},Array{Float64,1},true}:
0.857333 0.327767 -0.396924 0.0
0.135862 -0.88782 -0.439679 0.0
-0.496509 0.323024 -0.805688 0.0
0.0 0.0 0.0 1.0 |
As discussed in JuliaLang/LinearAlgebra.jl#625, this adds a few more methods for the
Hessenberg
type:Hessenberg
type now includes a shiftμ
, so that you can formH+μ*I
without making a copy.ldiv!
solver for(H+μI) \ x
using an algorithm by Henry (1994) that requires only O(n) auxiliary storage and does not modifyH
.det
,logabsdet
/logdet
, and multiplication by scalars(I wasn't entirely sure whether to store the shift as
H+μI
orH-μI
… computationally it makes no difference, but it changes what the user gets if they look atH.μ
.)Possible to-dos:
μ
even for a realH
, since this shows up in many real problems and it would be nice to support efficiently (i.e. without forcing you to complexifyH
). Unfortunately the LAPACK*ormhr
can't multiply a realQ
by a complex vector, so it seems like we'd have to copy the real/imaginary parts to separate arrays to copy.rdiv!
. Should be straightforward but seems a bit tedious to rederive Henry's algorithm for this case,so I'm inclined to leave it for a hypothetical future PR.Done.Hessenberg
objects as currently the output is rather inscrutable.det(H+µI)
andlogabsdet(H+µI)
UpperHessenberg
matrix type (analogous toUpperTriangular
) for storing upper-Hessenberg matrices(possibly including shifts).F.H
now returns anUpperHessenberg
matrix.SymTridiagonal
.cc @jiahao since we just chatted about this.