@@ -27,6 +27,10 @@ if any specialized algorithms.)
2727To compute the symmetric part of a real matrix, or more generally the Hermitian part `(A + A') / 2` of
2828a real or complex matrix `A`, use [`hermitianpart`](@ref).
2929
30+ The `uplo` symbol corresponding to the triangular half of `A` that is shared by the symmetric view may be
31+ fetched by using the function [`LinearAlgebra.uplo`](@ref). The underlying matrix `A` may be fetched from the symmetric
32+ view by using `parent`.
33+
3034# Examples
3135```jldoctest
3236julia> A = [1 2 3; 4 5 6; 7 8 9]
@@ -112,6 +116,10 @@ triangle of the matrix `A`.
112116
113117To compute the Hermitian part of `A`, use [`hermitianpart`](@ref).
114118
119+ The `uplo` symbol corresponding to the triangular half of `A` that is shared by the hermitian view may be
120+ fetched by using the function [`LinearAlgebra.uplo`](@ref). The underlying matrix `A` may be fetched from the hermitian
121+ view by using `parent`.
122+
115123# Examples
116124```jldoctest
117125julia> A = [1 2+2im 3-3im; 4 5 6-6im; 7 8+8im 9]
@@ -237,6 +245,33 @@ nonhermitianwrappertype(::SymSymTri{<:Real}) = Symmetric
237245nonhermitianwrappertype (:: Hermitian{<:Real} ) = Symmetric
238246nonhermitianwrappertype (:: Hermitian ) = identity
239247
248+ """
249+ LinearAlgebra.uplo(S::Union{Symmetric, Hermitian})::Symbol
250+
251+ Return a `Symbol` corresponding to the stored triangular half (`:U` or `:L`) in the matrix `S`,
252+ that is, the elements are common between `S` and `parent(S)` for that triangular half.
253+
254+ # Example
255+ ```jldoctest
256+ julia> S = Symmetric([1 2; 3 4], :U)
257+ 2×2 Symmetric{Int64, Matrix{Int64}}:
258+ 1 2
259+ 2 4
260+
261+ julia> LinearAlgebra.uplo(S)
262+ :U
263+
264+ julia> H = Hermitian([1 2; 3 4], :L)
265+ 2×2 Hermitian{Int64, Matrix{Int64}}:
266+ 1 3
267+ 3 4
268+
269+ julia> LinearAlgebra.uplo(H)
270+ :L
271+ ```
272+ """
273+ uplo (S:: HermOrSym ) = sym_uplo (S. uplo)
274+
240275size (A:: HermOrSym ) = size (A. data)
241276axes (A:: HermOrSym ) = axes (A. data)
242277@inline function Base. isassigned (A:: HermOrSym , i:: Int , j:: Int )
0 commit comments