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

ERROR: MethodError: no method matching cholesky #147

Closed
PharmCat opened this issue Nov 7, 2021 · 3 comments
Closed

ERROR: MethodError: no method matching cholesky #147

PharmCat opened this issue Nov 7, 2021 · 3 comments

Comments

@PharmCat
Copy link

PharmCat commented Nov 7, 2021

Hello! Is it expected?

x = rand(4,4)
pdm = PDMat(x'*x)
isposdef(pdm)

Trace:

ERROR: MethodError: no method matching cholesky(::Hermitian{Float64, PDMat{Float64, Matrix{Float64}}}; check=false)
Closest candidates are:
  cholesky(::Number) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\cholesky.jl:406 got unsupported keyword argument "check"
  cholesky(::Number, ::Symbol) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\cholesky.jl:406 got unsupported keyword argument "check"
  cholesky(::Diagonal) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\diagonal.jl:725 got unsupported keyword argument "check"
  ...
Stacktrace:
 [1] isposdef(A::PDMat{Float64, Matrix{Float64}})
   @ LinearAlgebra C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\dense.jl:91
 [2] top-level scope
   @ none:1
@devmotion
Copy link
Member

Your stacktrace indicates that you don't use the latest version of PDMats. PDMats 0.11.3 defines isposdef and hence you should not end up with the fallback definition in LinearAlgebra.

@devmotion
Copy link
Member

I checked and I can reproduce the issue with PDMats 0.11.2. However, as expected, it is fixed in PDMats 0.11.3:

(@v1.6) pkg> activate --temp
  Activating new environment at `/tmp/jl_AJ3u6A/Project.toml`

(jl_AJ3u6A) pkg> add PDMats
    Updating registry at `~/.julia/registries/General`
   Resolving package versions...
    Updating `/tmp/jl_AJ3u6A/Project.toml`
  [90014a1f] + PDMats v0.11.3
    Updating `/tmp/jl_AJ3u6A/Manifest.toml`
  [90014a1f] + PDMats v0.11.3
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [9a3f8284] + Random
  [9e88b42a] + Serialization
  [2f01184e] + SparseArrays
  [4607b0f0] + SuiteSparse

julia> using PDMats, LinearAlgebra

julia> x = rand(4,4)
4×4 Matrix{Float64}:
 0.78919   0.171766  0.839576   0.446731
 0.416406  0.96419   0.0670805  0.788688
 0.759789  0.67533   0.945455   0.73147
 0.923695  0.436137  0.516336   0.488594

julia> pdm = PDMat(x'*x)
4×4 PDMat{Float64, Matrix{Float64}}:
 2.22671  1.45302  1.8858   1.68805
 1.45302  1.60545  1.07258  1.54426
 1.8858   1.07258  1.86988  1.37182
 1.68805  1.54426  1.37182  1.59537

julia> isposdef(pdm)
true

Since it's fixed in the latest release I'll close the issue 🙂

@AnzhiZhang
Copy link

function cholesky is missing a fallback method accepts AbstractMatrix in Julia 1.6, since 1.6 is a LTS version, I reported an issue at JuliaLang/julia#55404

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