You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an MMatrix or SMatrix is of dimension 1-by-1, it is detected as being positive definite even if its entry is 0, and its cholesky decomposition does not fail. Below I'm using StaticArrays v1.6.5 and julia v1.9.2.
julia>using LinearAlgebra, StaticArrays
julia> m =MArray{Tuple{1,1}}(0.0); # 1×1 MMatrix
julia>isposdef(m) # should be falsetrue
julia>isposdef(cholesky(m)) # also true: cholesky didn't failtrue
julia>cholesky(m).info # 0 so it's supposedly PosDef0
same with an SMatrix:
julia> s =SArray{Tuple{1,1}}(0.0);
julia>isposdef(s)
true
julia>isposdef(cholesky(s)) # doesn't failtrue
Things are as expected if the 1×1 matrix has a negative entry, or it it's a regular matrix:
I believe this bug is fixed by JuliaLang/julia@ee3b779 (basically, a generic cholesky method is being called that does not throw an error for positive semidefinite matrices), though this has not been incorporated as of the latest stable release (1.9.3).
This package defines their own Cholesky implementation, which seems to still have this bug. The issue is fixed for general matrices, but not for StaticArrays.
When an
MMatrix
orSMatrix
is of dimension 1-by-1, it is detected as being positive definite even if its entry is 0, and its cholesky decomposition does not fail. Below I'm using StaticArrays v1.6.5 and julia v1.9.2.same with an
SMatrix
:Things are as expected if the 1×1 matrix has a negative entry, or it it's a regular matrix:
The text was updated successfully, but these errors were encountered: