-
-
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
Make (Sym)Tridiag-Diagonal solves return TriDiagonal #42744
Conversation
8d3ceae
to
e3a05f1
Compare
e3a05f1
to
3531ab6
Compare
This is ready for review. All tests pass, even though I'm requiring |
Thanks for your comments. I was hoping to get the matrix-eltype running as well, but that turns would require making more copies by default. Not sure if it's worth it the code bloat. Maybe if someone requests it, we can get back to it. |
julia> Revise.track(LinearAlgebra)
julia> D = Diagonal([I(2) for i in 1:4]);
julia> S = SymTridiagonal([randn(2,2) for i in 1:4], [randn(2,2) for i in 1:3]);
julia> D \ S;
julia> (D \ S) |> typeof
Tridiagonal{Matrix{Float64}, Vector{Matrix{Float64}}}
julia> (D \ S) == S
true
julia> (D \ S) === S
false Edit: My fault, just notice that |
At the expense of "code bloat" I made the matrix-eltype-case also work, because I thought it was working before... turns out it wasn't, though. If we feel that's not quite necessary, I can revert the last commit and we go with the more concise version. |
BTW, we'd better add 1*1 case to the testset, as: julia> Tridiagonal(1:0,1:1,1:0) / Diagonal(1:1)
ERROR: BoundsError: attempt to access 0-element UnitRange{Int64} at index [1] |
Finally (thanks to @N5N3's comments especially on the edge cases) this seems ready. |
Closes #42684.