Open benzwick opened 4 years ago
Even better, I suggest wrapping LinearAlgebra.eigvals
for non-hermitian matrices to return a static array of the appropriate length and type so this is no longer an error.
That could also be a good idea but in my application the matrices should always be Hermitian, in which case it is better to exit with a specific error than to compute the eigenvalues using a slower method. I could first check that the matrices are Hermitian but then this check would be performed twice (once by me and once by the call to eigvals) which will slow things down slightly (I need to compute eigenvalues of 3x3 matrices millions of times so this could add up). I guess the other option would be to use a symmetric static matrix type.
Should we be more specific by throwing a DomainError here:
https://github.com/JuliaArrays/StaticArrays.jl/blob/95f257857bb060308870954830cfa33335cf2ce3/src/eigen.jl#L12
to make it easier to catch these types of errors?
Compare with eigen.jl in LinearAlgebra:
https://github.com/JuliaLang/julia/blob/3935491dc5028f23587ca8df6d4e0de75cf50e53/stdlib/LinearAlgebra/src/eigen.jl#L376
https://github.com/JuliaLang/julia/blob/3935491dc5028f23587ca8df6d4e0de75cf50e53/stdlib/LinearAlgebra/src/eigen.jl#L418