Skip to content

Separate parent matrix type from Cholesky parameter#207

Closed
jishnub wants to merge 1 commit into
JuliaStats:masterfrom
jishnub:jishnub/matrixtype
Closed

Separate parent matrix type from Cholesky parameter#207
jishnub wants to merge 1 commit into
JuliaStats:masterfrom
jishnub:jishnub/matrixtype

Conversation

@jishnub

@jishnub jishnub commented Jul 26, 2024

Copy link
Copy Markdown
Contributor

This adds an extra type parameter to PDMat corresponding to the parent matrix type. This lets the PDMat constructor succeed even if the parent type doesn't match those of the Cholesky factors. E.g. the following works after this:

julia> S = SymTridiagonal(fill(4,4), fill(1,3))
4×4 SymTridiagonal{Int64, Vector{Int64}}:
 4  1    
 1  4  1  
   1  4  1
     1  4

julia> PDMat(S)
4×4 PDMat{Float64, Bidiagonal{Float64, Vector{Float64}}, SymTridiagonal{Float64, Vector{Float64}}}:
 4.0  1.0  0.0  0.0
 1.0  4.0  1.0  0.0
 0.0  1.0  4.0  1.0
 0.0  0.0  1.0  4.0

where the Cholesky factors are Bidiagonal, but the parent is a SymTridiagonal.

@andreasnoack

Copy link
Copy Markdown
Member

Thanks. I'm wondering if this susggests that https://github.com/JuliaLang/julia/blob/197295c84aab217bffde01a4339f1d0e8e95fb98/stdlib/LinearAlgebra/src/tridiag.jl#L957 should use SymTridiagonal instead of Bidiagonal.

@devmotion

Copy link
Copy Markdown
Member

Is this issue fixed by #188? I think if we make a breaking change to the type structure, we should also address the other problems covered by #188 at the same time.

devmotion added a commit that referenced this pull request Aug 5, 2024
@devmotion

Copy link
Copy Markdown
Member

I just checked and the example is indeed fixed by #188. I added the test in this PR to #188.

@jishnub

jishnub commented Aug 5, 2024

Copy link
Copy Markdown
Contributor Author

Thanks, I'll close this in favor of that PR

@jishnub jishnub closed this Aug 5, 2024
@jishnub jishnub deleted the jishnub/matrixtype branch August 5, 2024 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants