1
1
"""
2
2
SHermitianCompact{N, T, L} <: StaticMatrix{N, N, T}
3
3
4
- A [`StaticArray`](@ref) subtype that represents a Hermitian matrix. Unlike
4
+ A [`StaticArray`](@ref) subtype that can represent a Hermitian matrix. Unlike
5
5
`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.
7
9
For example, for an `SHermitianCompact{3}`, the indices of the stored elements
8
10
can be visualized as follows:
9
11
@@ -28,6 +30,13 @@ An `SHermitianCompact` may be constructed either:
28
30
29
31
For the latter two cases, only the lower triangular elements are used; the upper triangular
30
32
elements 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.
31
40
"""
32
41
struct SHermitianCompact{N, T, L} <: StaticMatrix{N, N, T}
33
42
lowertriangle:: SVector{L, T}
129
138
end
130
139
end
131
140
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)
134
145
135
146
# TODO : factorize?
136
147
0 commit comments