PDMats.jl
PDMats.jl copied to clipboard
Design question/discussion: PDMat without constructing full matrix
As pointed out in the README, PDMat always stores both Cholesky factorisation and full matrix. For many operations that are commonly used downstream, such as logdet and the quadratic forms, the full matrix is never used. So when the PDMat is constructed from an already known Cholesky factor (e.g. because we optimize for a variationally optimal covariance matrix), this is an unnecessary computation (see https://github.com/invenia/ParameterHandling.jl/issues/41#issuecomment-936495430).
What are the design reasons for the current setup? What would it take to change this? Could we, for example, have some lazy way of computing mat (or chol) only when it is actually required [and then caching it]?
What are the PDMats.jl maintainers' thoughts on this?