-
-
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
Improve printing of LDLt factorization #32934
Conversation
Thanks for adding this. I think it would be a good idea to have the extractors ( |
@andreasnoack Yes sure, I will try to do this. If I have questions, I will ask here. |
Ok, so I have added a using LinearAlgebra
S = SymTridiagonal([1., 2., 3.], [-1., 1.]); The factorization looks like this: julia> F = ldlt(S)
LDLt{Float64,SymTridiagonal{Float64,Array{Float64,1}}}
L factor:
3×3 UnitLowerTriangular{Float64,SymTridiagonal{Float64,Array{Float64,1}}}:
1.0 ⋅ ⋅
-1.0 1.0 ⋅
0.0 1.0 1.0
D factor:
3×3 Diagonal{Float64,Array{Float64,1}}:
1.0 ⋅ ⋅
⋅ 1.0 ⋅
⋅ ⋅ 2.0 I'm not sure if the I'm also not sure about the types that should be returned. Currently it is like this:
If that should be changed, let me know. Note that something like julia> F.L*F.D*F.Lt does not work:
I would have assumed that the multiplication gets dispatched to a more generic method if there is no specialized method... What's the reason for this? Is it some bug? |
Great work. The error is probably because we don't have specialized methods for |
This PR improves the REPL printing of LDLt factorizations as proposed in #24588.
Prior to this PR it looked like this:
With this PR it now looks like this:
Instead of printing diagonal values, we could call it D factor and print a diagonal matrix. Let me know which method is preferred.
I have also added a new test file
stdlib/LinearAlgebra/test/ldlt.jl
to add a basic test for this.