JuliaStats / PDMats.jl

Uniform Interface for positive definite matrices of various structures
Other
104 stars 43 forks source link

PDMat: convert Matrix type to the same Cholesky type #117

Closed mossr closed 4 years ago

mossr commented 4 years ago

This addresses #98 where the original Matrix type (e.g., Matrix{Int}) can differ from the type returned by Cholesky (e.g., Matrix{Float64}). Therefore, we simply convert the Matrix type to the same paremetric types already converted by Cholesky.

Previously, this failed:

PDMat([1 0; 0 1])

This also addresses https://github.com/JuliaStats/Distributions.jl/issues/1004 (where my original problem started).

andreasnoack commented 4 years ago

Could you please add the example as a test? Then I think this one should be good to go.

mossr commented 4 years ago

@andreasnoack Good idea—I've since added this example in pdmtypes.jl