Should `choleskify` return `Cholesky` type?
pnkraemer opened this issue · comments
Currently, choleskify_factor
turns any PSD matrix into a PSDMatrix, where the factor R
is a valid Cholesky factor.
I personally think choleskify_factor
should be split into a triangularize_factor()
method, which turns any PSDMatrix
into one with an UpperTriangular
factor, and a choleskify
method, which turns a PSDMatrix
with an UpperTriangular
factor into a Cholesky
type. Why?
- A method that is called
choleskify
would be easier to understand if it returned a Cholesky type - In most of our applications, triangular factors are sufficient, and the extra multiplication that turns upper triangular types into valid Cholesky factors can be avoided
Thoughts, @nathanaelbosch?
I agree with the split into "triangularize_factor" and "choleskify_factor", even just because triangular factors are often sufficient.
I'm a bit unsure about "choleskify" vs "choleskify_factor", where for me the former returns a Cholesky
and the latter returns a PSDMatrix
with a factor in Cholesky form. Intuitively, I'd have wanted to have the latter too, but I can't really think of any situation. Do you think that we're always fine with getting a Cholesky
out of it? Then, maybe the function we're writing isn't actually choleskify
, but a new constructor for Cholesky(::PSDMatrix)
? What do you think?