-
-
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
LinearAlgebra: extend eigen
with left eigenvectors and errorbounds
#48657
base: master
Are you sure you want to change the base?
Conversation
(The `k`th eigenvector can be obtained from the slice `F.vectors[:, k]`.) | ||
|
||
Iterating the decomposition produces the components `F.values` and `F.vectors`. | ||
Iterating the decomposition produces the components `F.values`, `F.vectors`, `F.vectorsl`, | ||
`F.eerrbd`, `F.verrbd`. |
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.
Doesn't this mean that values, vectors = eigen will not work anymore?
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.
No - the lhs tuple needs not to be exhaustive. You can even do a, = [1,2,3]
to set a
to 1
.
Iterating the decomposition produces the components `F.values`, `F.vectors`, `F.vectorsl`, | ||
`F.eerrbd`, `F.verrbd`. | ||
|
||
The matrix of left eigenvectors is empty, if not opted in by `eigen( ; left=true)`. |
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.
That's annoying. Can we default to inv(Rvectors)?
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.
Or just compute them unconditionally? Are they much more expensive than the right?
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.
Calculation of left eigenvectors comes with an effort comparable to that of deriving it from the right vectors. That is approximately 10-15% for n
in 100-1000 for random matrices. Actually vl = inv(vr)' ./ cn
where cn
is to normalize the columns.
|
||
The matrix of left eigenvectors is empty, if not opted in by `eigen( ; left=true)`. | ||
|
||
The error bounds are empty, if not opted in by `eigen( ; eerror=true, verror=true)`. |
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.
Default to Nan?
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.
xerrbd
are both vectors. You propose to give them size n
. Why not Inf
? For me a full vector of NaN
or Inf
doesn't look good.
Eigen{T,V,S,U}(values::AbstractVector{V}, vectors::AbstractMatrix{T}) where {T,V,S,U} = | ||
new(values, vectors) | ||
vectorsl::S | ||
eerrbd::R |
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.
These names are very cryptic. We're not constrained by Fortran or the need for short identifiers, might as well give them proper names
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.
The names are taken from the LAPACK
docu. What do you think about valbounds
and vecbounds
.
stdlib/LinearAlgebra/src/eigen.jl
Outdated
|
||
# Generalized eigenvalue problem. | ||
""" | ||
GeneralizedEigen <: Factorization | ||
|
||
Matrix factorization type of the generalized eigenvalue/spectral decomposition of | ||
Matrix factorization type of the generalized eigenvalue/apply decomposition of |
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.
That was an edit error, should be unchanged.
This is a remake of #38483, this time with documentation and test cases included.
The changes (added features) are:
struct Eigen
andstruct GeneralizedEigen
have new matrix fieldvectorsl
to keep optional left eigenvectors.struct Eigen
has additional vector fieldseerrbd
andverrbd
to keep optional error bounds for eigenvalues and eigenvectors.eigen
has new boolean keyword argumentsleft
,eerror
,verror
to opt in the calculation of the new output fields.The data are obtained by use of the existing
LAPACK
API. See also user's guide