11"""
22 SHermitianCompact{N, T, L} <: StaticMatrix{N, N, T}
33
4- A [`StaticArray`](@ref) subtype that represents a Hermitian matrix. Unlike
4+ A [`StaticArray`](@ref) subtype that can represent a Hermitian matrix. Unlike
55`LinearAlgebra.Hermitian`, `SHermitianCompact` stores only the lower triangle
6- of the matrix (as an `SVector`). The lower triangle is stored in column-major order.
6+ of the matrix (as an `SVector`), and the diagonal may not be real. The lower
7+ triangle is stored in column-major order and the superdiagonal entries are
8+ `adjoint` to the transposed subdiagonal entries. The diagonal is returned as-is.
79For example, for an `SHermitianCompact{3}`, the indices of the stored elements
810can be visualized as follows:
911
@@ -28,6 +30,13 @@ An `SHermitianCompact` may be constructed either:
2830
2931For the latter two cases, only the lower triangular elements are used; the upper triangular
3032elements are ignored.
33+
34+ When its element type is real, then a `SHermitianCompact` is both Hermitian and
35+ symmetric. Otherwise, to ensure that a `SHermitianCompact` matrix, `a`, is
36+ Hermitian according to `LinearAlgebra.ishermitian`, take an average with its
37+ adjoint, i.e. `(a+a')/2`, or take a Hermitian view of the data with
38+ `LinearAlgebra.Hermitian(a)`. However, the latter case is not specialized to use
39+ the compact storage.
3140"""
3241struct SHermitianCompact{N, T, L} <: StaticMatrix{N, N, T}
3342 lowertriangle:: SVector{L, T}
129138 end
130139end
131140
132- LinearAlgebra. ishermitian (a:: SHermitianCompact ) = true
133- LinearAlgebra. issymmetric (a:: SHermitianCompact ) = true
141+ LinearAlgebra. ishermitian (a:: SHermitianCompact{<:Any,<:Real} ) = true
142+ LinearAlgebra. ishermitian (a:: SHermitianCompact ) = a == a'
143+ LinearAlgebra. issymmetric (a:: SHermitianCompact{<:Any,<:Real} ) = true
144+ LinearAlgebra. issymmetric (a:: SHermitianCompact ) = a == transpose (a)
134145
135146# TODO : factorize?
136147
0 commit comments