@@ -27,6 +27,10 @@ if any specialized algorithms.)
27
27
To compute the symmetric part of a real matrix, or more generally the Hermitian part `(A + A') / 2` of
28
28
a real or complex matrix `A`, use [`hermitianpart`](@ref).
29
29
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
+
30
34
# Examples
31
35
```jldoctest
32
36
julia> A = [1 2 3; 4 5 6; 7 8 9]
@@ -112,6 +116,10 @@ triangle of the matrix `A`.
112
116
113
117
To compute the Hermitian part of `A`, use [`hermitianpart`](@ref).
114
118
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
+
115
123
# Examples
116
124
```jldoctest
117
125
julia> A = [1 2+2im 3-3im; 4 5 6-6im; 7 8+8im 9]
@@ -237,6 +245,33 @@ nonhermitianwrappertype(::SymSymTri{<:Real}) = Symmetric
237
245
nonhermitianwrappertype (:: Hermitian{<:Real} ) = Symmetric
238
246
nonhermitianwrappertype (:: Hermitian ) = identity
239
247
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
+
240
275
size (A:: HermOrSym ) = size (A. data)
241
276
axes (A:: HermOrSym ) = axes (A. data)
242
277
@inline function Base. isassigned (A:: HermOrSym , i:: Int , j:: Int )
0 commit comments