Skip to content

isposdef() is incorrect #392

@wilburtownsend

Description

@wilburtownsend

isposdef() is claiming that some (though not all) positive-semi definite matrices are positive definite when they are not:

julia> A = [1.69  2.21; 2.21  2.89]
2×2 Array{Float64,2}:
 1.69  2.21
 2.21  2.89
julia> det(A)
0.0
julia> isposdef(A)
true
julia> isposdef(ones(2,2))
false

I'm not sure what's causing this behaviour -- it looks like isposdef() attempts to make a Cholesky decomposition of the matrix, and all positive semi-definite matrices have a Cholesky decomposition (though IIRC there is no general algorithm for finding them). It seems to me that it would be simpler to just implement Sylvestor's criterion with something like

sylvestor(A) = issymmetric(A) & all([det(A[1:j, 1:j]) > 0 for j = 1:size(A)[1]])

Version info:

julia> versioninfo()
Julia Version 0.5.0
Commit 3c9d753 (2016-09-19 18:14 UTC)
Platform Info:
  System: NT (x86_64-w64-mingw32)
  CPU: Intel(R) Xeon(R) CPU E3-1240 v3 @ 3.40GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, haswell)

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsThis change adds or pertains to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions