Skip to content
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

Use a stable inverse for Tridiagonal and SymTridiagonal #29667

Merged
merged 2 commits into from
Oct 17, 2018
Merged

Conversation

andreasnoack
Copy link
Member

@andreasnoack andreasnoack added linear algebra Linear algebra bugfix This change fixes an existing bug backport pending 1.0 labels Oct 16, 2018
@andreasnoack
Copy link
Member Author

Looks like this revealed an issue with factorize(SymTridiagonal{<:Complex}).

@andreasnoack
Copy link
Member Author

Issue solved. The ldlt needed minimal modification to handle SymTridiagonal{<:Complex}. So PR should be ready now.

n = size(S,1)
d = S.dv
e = S.ev
@inbounds @simd for i = 1:n-1
e[i] /= d[i]
d[i+1] -= abs2(e[i])*d[i]
d[i+1] -= e[i]^2*d[i]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was abs2 incorrect here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but the previous version was also restricted to Real so it didn't matter. Had the type been HermitianTridiagonal then abs2 would have been correct.

@andreasnoack andreasnoack merged commit 00bb4f2 into master Oct 17, 2018
@andreasnoack andreasnoack deleted the an/invtri branch October 17, 2018 08:42
KristofferC pushed a commit that referenced this pull request Oct 19, 2018
* Use a stable inverse for Tridiagonal and SymTridiagonal

Fixes #29630

* Fix ldlt in the complex case

(cherry picked from commit 00bb4f2)
KristofferC pushed a commit that referenced this pull request Feb 11, 2019
* Use a stable inverse for Tridiagonal and SymTridiagonal

Fixes #29630

* Fix ldlt in the complex case

(cherry picked from commit 00bb4f2)
KristofferC pushed a commit that referenced this pull request Feb 20, 2020
* Use a stable inverse for Tridiagonal and SymTridiagonal

Fixes #29630

* Fix ldlt in the complex case

(cherry picked from commit 00bb4f2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug linear algebra Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LinearAlgebra - inv() producing NaNs when called on a Tridiagonal
4 participants