Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't convert to Matrix #76

Closed
kleinschmidt opened this issue Apr 26, 2018 · 2 comments
Closed

can't convert to Matrix #76

kleinschmidt opened this issue Apr 26, 2018 · 2 comments

Comments

@kleinschmidt
Copy link
Member

               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.2 (2017-12-13 18:08 UTC)
 _/ |\__'_|_|_|\__'_|  |
|__/                   |  x86_64-pc-linux-gnu

julia> using PDMats

julia> x = rand(2,2)
2×2 Array{Float64,2}:
 0.667854  0.660297
 0.92969   0.775099

julia> y = PDMat(x'x)
PDMats.PDMat{Float64,Array{Float64,2}}(2, [1.31035 1.16158; 1.16158 1.03677], Base.LinAlg.Cholesky{Float64,Array{Float64,2}} with factor:
[1.14471 1.01474; 0.0 0.0840556])

julia> Matrix(y)
ERROR: MethodError: Cannot `convert` an object of type PDMats.PDMat{Float64,Array{Float64,2}} to an object of type Array{T,2} where T
This may have arisen from a call to the constructor Array{T,2} where T(...),
since type constructors fall back to convert methods.
Stacktrace:
 [1] Array{T,2} where T(::PDMats.PDMat{Float64,Array{Float64,2}}) at ./sysimg.jl:77
@ararslan
Copy link
Member

Yeah, it's because we dropped 0.6 support at the same time as changing full to Matrix to mimic Base. full should still work on 0.6 and should work with a depwarn on 0.7.

@devmotion
Copy link
Member

This seems to be fixed in the latest (and probably previous) release:

julia> using PDMats

julia> x = rand(2,2)
2×2 Matrix{Float64}:
 0.252179  0.297023
 0.598621  0.824223

julia> y = PDMat(x'x)
2×2 PDMat{Float64, Matrix{Float64}}:
 0.421941  0.5683
 0.5683    0.767567

julia> Matrix(y)
2×2 Matrix{Float64}:
 0.421941  0.5683
 0.5683    0.767567

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

No branches or pull requests

3 participants