Skip to content

ishermitian test's A[i,j] != ctranspose(A[j,i]) which causes problems with numerical accuracy Β #182

Closed
@dhoegh

Description

I have a function where i determine the hessian with finite difference using the hessian function in the Calculus package. Then I test if the hessian is positive definite with isposdef this always return false because, ishermitian is called at: https://github.com/JuliaLang/julia/blob/5e2a6173eca65e78f787a3525bae18857d283229/base/linalg/dense.jl#L27-L28
before the LAPACK.potrf! is called. Due to numerical inaccuracy will ishermitian always return false because A[i,j] != ctranspose(A[j,i]) in https://github.com/JuliaLang/julia/blob/5e2a6173eca65e78f787a3525bae18857d283229/base/linalg/generic.jl#L282, will return true for some i,j due to numerical inaccuracy. If I change the line to !isapprox(A[i,j],ctranspose(Aj,i])) the ishermitian returns true and hence also call the LAPACK.potrf! to check if it is positive definite.

So from my point of view, should ishermitian test approximately equality.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions