Skip to content

Commit

Permalink
Update symmetric docstring to reflect the type of uplo (#55504)
Browse files Browse the repository at this point in the history
This brings the docstring closer to the actual implementation. In
particular, following the current docstring and defining
```julia
symmetric(::MyMatrix, uplo=:U)
```
leads to a method ambiguity, as `LinearAlgebra` defines
`symmetric(::AbstractMatrix, uplo::Symbol=:U)`.

(cherry picked from commit 8a19b74)
  • Loading branch information
jishnub authored and KristofferC committed Sep 12, 2024
1 parent 75436e4 commit f4eda2d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions stdlib/LinearAlgebra/src/symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct Symmetric{T,S<:AbstractMatrix{<:T}} <: AbstractMatrix{T}
end
end
"""
Symmetric(A, uplo=:U)
Symmetric(A::AbstractMatrix, uplo::Symbol=:U)
Construct a `Symmetric` view of the upper (if `uplo = :U`) or lower (if `uplo = :L`)
triangle of the matrix `A`.
Expand Down Expand Up @@ -63,7 +63,7 @@ function Symmetric(A::AbstractMatrix, uplo::Symbol=:U)
end

"""
symmetric(A, uplo=:U)
symmetric(A, uplo::Symbol=:U)
Construct a symmetric view of `A`. If `A` is a matrix, `uplo` controls whether the upper
(if `uplo = :U`) or lower (if `uplo = :L`) triangle of `A` is used to implicitly fill the
Expand Down Expand Up @@ -105,7 +105,7 @@ struct Hermitian{T,S<:AbstractMatrix{<:T}} <: AbstractMatrix{T}
end
end
"""
Hermitian(A, uplo=:U)
Hermitian(A::AbstractMatrix, uplo::Symbol=:U)
Construct a `Hermitian` view of the upper (if `uplo = :U`) or lower (if `uplo = :L`)
triangle of the matrix `A`.
Expand Down Expand Up @@ -153,7 +153,7 @@ function Hermitian(A::AbstractMatrix, uplo::Symbol=:U)
end

"""
hermitian(A, uplo=:U)
hermitian(A, uplo::Symbol=:U)
Construct a hermitian view of `A`. If `A` is a matrix, `uplo` controls whether the upper
(if `uplo = :U`) or lower (if `uplo = :L`) triangle of `A` is used to implicitly fill the
Expand Down Expand Up @@ -812,7 +812,7 @@ for func in (:log, :sqrt)
end

"""
hermitianpart(A, uplo=:U) -> Hermitian
hermitianpart(A::AbstractMatrix, uplo::Symbol=:U) -> Hermitian
Return the Hermitian part of the square matrix `A`, defined as `(A + A') / 2`, as a
[`Hermitian`](@ref) matrix. For real matrices `A`, this is also known as the symmetric part
Expand All @@ -828,7 +828,7 @@ See also [`hermitianpart!`](@ref) for the corresponding in-place operation.
hermitianpart(A::AbstractMatrix, uplo::Symbol=:U) = Hermitian(_hermitianpart(A), uplo)

"""
hermitianpart!(A, uplo=:U) -> Hermitian
hermitianpart!(A::AbstractMatrix, uplo::Symbol=:U) -> Hermitian
Overwrite the square matrix `A` in-place with its Hermitian part `(A + A') / 2`, and return
[`Hermitian(A, uplo)`](@ref). For real matrices `A`, this is also known as the symmetric
Expand Down

0 comments on commit f4eda2d

Please sign in to comment.