-
Notifications
You must be signed in to change notification settings - Fork 38
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
Cholesky of a view of a BandedMatrix forgets the structure #450
Comments
This is probably an ArrayLayouts.jl issue: we need to override cholesky for SubArray of LayoutMatrix to call cholesky_layout or something |
It does go through that code, I think the issue is when it calls julia> LinearAlgebra.cholcopy(B) # bad
10×10 Matrix{Float64}:
0.617164 0.308407 0.170248 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.308407 1.00335 0.332173 0.605791 0.0 0.0 0.0 0.0 0.0 0.0
0.170248 0.332173 0.214511 0.236248 0.159116 0.0 0.0 0.0 0.0 0.0
0.0 0.605791 0.236248 0.550771 0.27541 0.018336 0.0 0.0 0.0 0.0
0.0 0.0 0.159116 0.27541 1.04702 0.591206 0.56485 0.0 0.0 0.0
0.0 0.0 0.0 0.018336 0.591206 0.976661 1.05175 0.184048 0.0 0.0
0.0 0.0 0.0 0.0 0.56485 1.05175 1.24 0.510496 0.100412 0.0
0.0 0.0 0.0 0.0 0.0 0.184048 0.510496 0.983012 0.314483 0.0262631
0.0 0.0 0.0 0.0 0.0 0.0 0.100412 0.314483 0.245317 0.266145
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0262631 0.266145 0.532169
julia> LinearAlgebra.cholcopy(Symmetric(B)) # good
10×10 Symmetric{Float64, BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}}:
0.617164 0.308407 0.170248 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
0.308407 1.00335 0.332173 0.605791 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
0.170248 0.332173 0.214511 0.236248 0.159116 ⋅ ⋅ ⋅ ⋅ ⋅
⋅ 0.605791 0.236248 0.550771 0.27541 0.018336 ⋅ ⋅ ⋅ ⋅
⋅ ⋅ 0.159116 0.27541 1.04702 0.591206 0.56485 ⋅ ⋅ ⋅
⋅ ⋅ ⋅ 0.018336 0.591206 0.976661 1.05175 0.184048 ⋅ ⋅
⋅ ⋅ ⋅ ⋅ 0.56485 1.05175 1.24 0.510496 0.100412 ⋅
⋅ ⋅ ⋅ ⋅ ⋅ 0.184048 0.510496 0.983012 0.314483 0.0262631
⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 0.100412 0.314483 0.245317 0.266145
⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 0.0262631 0.266145 0.532169
julia> LinearAlgebra.cholcopy(Symmetric(view(B, :, :))) # bad
10×10 Symmetric{Float64, Matrix{Float64}}:
0.617164 0.308407 0.170248 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.308407 1.00335 0.332173 0.605791 0.0 0.0 0.0 0.0 0.0 0.0
0.170248 0.332173 0.214511 0.236248 0.159116 0.0 0.0 0.0 0.0 0.0
0.0 0.605791 0.236248 0.550771 0.27541 0.018336 0.0 0.0 0.0 0.0
0.0 0.0 0.159116 0.27541 1.04702 0.591206 0.56485 0.0 0.0 0.0
0.0 0.0 0.0 0.018336 0.591206 0.976661 1.05175 0.184048 0.0 0.0
0.0 0.0 0.0 0.0 0.56485 1.05175 1.24 0.510496 0.100412 0.0
0.0 0.0 0.0 0.0 0.0 0.184048 0.510496 0.983012 0.314483 0.0262631
0.0 0.0 0.0 0.0 0.0 0.0 0.100412 0.314483 0.245317 0.266145
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0262631 0.266145 0.532169 |
Probably just needs a similar method for SubArrays here. I'll make a pr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Presumably (?) it would be possible for the latter to also return something like a
which knows the structure. Not 100% sure how views propagate in all the code.
The text was updated successfully, but these errors were encountered: