Open tpapp opened 5 years ago
Regardless, we could start by extending the error message to mention Hermitian
.
Regardless, we could start by extending the error message to mention
Hermitian
.
Please do this. Just lost a bunch of hours trying to implement some Gaussian Processes code that just wouldn't work. I ended up re implementing in Python to find out that what I wanted was indeed possible and finally found this issue here. This could have been avoided if the documentation was a bit more clear :(
(follow-up to a discussion on the forum)
This is a proposal to change the semantics of functions that require a symmetric/hermitian matrix as an argument.
Currently functions that require symmetric/hermitian matrices, like
LinearAlgebra.cholesky
, accept arbitrary<: AbstractMatrix
arguments, then check for the desired symmetry. This leads to a lot of confusion among users since even if a calculation preserves symmetry in theory, in practice floating point error is very likely to break it. An example from that discussion isbut questions like this come up all the time.
The current workaround is to wrap a matrix in
Symmetric
orHermitian
. I am proposing that instead of working with general<: AbstractMatrix
types, functions likecholesky
only accept types which explicitly enforce symmetry. This would encourage a programming style that works uses wrapper types instead of (low-cost, but still significant) checks, and eliminate a surprises.The change is breaking, even though a lot of existing code already wraps matrices so that would not be affected.