Closed jecampagne closed 2 months ago
Just by eye-balling, I think your matrix is not symmetric.
With the new version 1.8 of SciPy, efficient ishermitian
and issymmetric
functions will be public, and the long term goal is to handle these issues more structurally. However note that using symmetricity exploiting functions necessitate that we only consider one triangular part of the array and such that memory can be saved hence this leaves the burden of data source control on the user.
You may be right concerning the symmetric character of the matrix but as I have suggested, this matrix is an intermediate result of a statistical library. So as end-user of this machinery, it is a behavior of a convergence of a loss in a SVI algorithm that I have suspected something strange and I've found this suspicious matrix. So, I have no entry to check this matrix during the process.
May be it would be worth to get lower=True be default which rise the Error...
What I mean is that lower
or upper
is not something we can understand at the outset. The user has to provide the lower or upper triangle that the function should consider.
The suspicion should be discussed with the originator of the data or if there is a particular reason the third party software should provide the correct part. We don't have any ways to detect the intention.
If we swap the default then other people who expect the opposite triangle would start complaining. The ideal case is that the supplied matrix is symmetric/Hermitian.
Maybe the solution could be to improve the documentation to scipy.linalg.cholesky
and include a clarification about the user being responsible for this check?
Is your feature request related to a problem? Please describe.
Here a snippet that shows the behaviour of
scipy.linalg.cholesky
which is a bit strange to my point of viewPerforming a Cholesky decomposition
return a matrix wo any complaining.
But, the matrix eigen decomposition clearly shows that the matrix is not positive definite, namely
gives
showing negative eigen-values.
Now, what is strange, is that
scipy.linalg.cholesky
with default args does not rise any Error, whilerise an exception leading to the right diagnostics
Notice, that
leads to
rc=0
so also wo mentionning the "not positive definite" status of the matrix.Describe the solution you'd like.
So, my questions and suggestion: why
scipy.linalg.cholesky
does not include (on user request) a check of positiveness of the matrix?As several library wraps the scipy implementation I imagine that it could be difficult to change the API. Now, I guess many people encounter the same problem. I must say that the fact that the decomposition returns a diagonal matrix wo any warning/error-rising makes difficult to debug the other packages, and it is my wish to understand a strange behavior in a Statistical Lib. using Variational Inference that I discover this problem.
Describe alternatives you've considered.
No response
Additional context (e.g. screenshots, GIFs)
No response