Skip to content
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# LinearAlgebra

This package is part of the Julia standard library (stdlib).

`LinearAlgebra.jl` provides functionality for performing linear algebra operations in Julia.

Comment on lines -1 to -6
Copy link
Member

@dkarrasch dkarrasch Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please undo this change. Eventually, there should be changes only in the two symmetric.jl files.

EDIT: Sorry, I see I myself marked too much for removal above.

| **Build Status** | **Coverage** |
|:-------------------------------:|:-------------------------------:|
[![Build status](https://badge.buildkite.com/4032f509b3a7354c8ce7b34b98c7496d66adc4504b0101cbcf.svg?branch=master)](https://buildkite.com/julialang/linearalgebra-dot-jl) | [![][codecov-img]][codecov-url] |
Expand Down
2 changes: 2 additions & 0 deletions src/symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,7 @@ end

"""
hermitianpart(A::AbstractMatrix, uplo::Symbol=:U) -> Hermitian
hermitianpart(x::Number) -> Number

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 @@ -1016,6 +1017,7 @@ See also [`hermitianpart!`](@ref) for the corresponding in-place operation.
This function requires Julia 1.10 or later.
"""
hermitianpart(A::AbstractMatrix, uplo::Symbol=:U) = Hermitian(_hermitianpart(A), uplo)
hermitianpart(x::Number) = real(x)

"""
hermitianpart!(A::AbstractMatrix, uplo::Symbol=:U) -> Hermitian
Expand Down
7 changes: 7 additions & 0 deletions test/symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,13 @@ end
@test Aherm isa Hermitian
@test Aherm.uplo == LinearAlgebra.char_uplo(uplo)
end
@testset "hermitianpart for numbers" begin
@test hermitianpart(3 + 4im) == 3
@test hermitianpart(5) == 5.0
@test hermitianpart(2.5) == 2.5
@test hermitianpart(-1 + 0im) == -1
@test typeof(hermitianpart(3 + 4im)) == 3.0
end
end

@testset "Structured display" begin
Expand Down