Skip to content

Conversation

@devmotion
Copy link
Member

This PR adds AbstractPDMat(::AbstractMatrix), AbstractPDMat(::Cholesky) and AbstractPDMat(::CholTypeSparse).

The main motivation is that this allows to specialize on the matrix type, which allows downstream packages such as Distributions (e.g. in https://github.com/JuliaStats/Distributions.jl/blob/9f9c5caf6cd99c5205a11ca1c8d6b6471fc9ce29/src/multivariate/mvnormal.jl#L201-L203) to just use AbstractPDMat(A) instead of adding custom dispatches.

Unfortunately, we can't add something like AbstractPDMat(A::UniformScaling) (size unknown) or AbstractPDMat(A::Diagonal{<:Real,<:FillArrays.Fill{<:Real}}) (FillArrays dependency).

Fixes #136 (without lying about the return type).

@codecov-commenter
Copy link

codecov-commenter commented Sep 18, 2022

Codecov Report

Base: 89.93% // Head: 90.11% // Increases project coverage by +0.18% 🎉

Coverage data is based on head (b4c05b6) compared to base (cc7c5c4).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #172      +/-   ##
==========================================
+ Coverage   89.93%   90.11%   +0.18%     
==========================================
  Files           8        8              
  Lines         437      445       +8     
==========================================
+ Hits          393      401       +8     
  Misses         44       44              
Impacted Files Coverage Δ
src/generics.jl 86.48% <100.00%> (+0.77%) ⬆️
src/pdiagmat.jl 97.27% <100.00%> (+0.07%) ⬆️
src/pdmat.jl 97.91% <100.00%> (+0.04%) ⬆️
src/pdsparsemat.jl 95.00% <100.00%> (+0.17%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@devmotion devmotion merged commit 1c14521 into master Feb 27, 2023
@devmotion devmotion deleted the dw/abstractpdmat branch February 27, 2023 19:31
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.

Unifying constructor? e.g. PDMat(Diagonal(...)) = PDiagMat(diag(...))

4 participants