Skip to content

Commit 7c9a465

Browse files
authored
LinearAlgebra: use instead of == for tr tests in symmetric.jl (#55143)
After investigating JuliaLang/julia#54090, I found that the issue was not caused by the effects of `checksquare`, but by the use of the `@simd` macro within `tr(::Matrix)`: https://github.com/JuliaLang/julia/blob/0945b9d7740855c82a09fed42fbf6bc561e02c77/stdlib/LinearAlgebra/src/dense.jl#L373-L380 While simply removing the `@simd` macro was considered, the strict left-to-right summation without `@simd` otherwise is not necessarily more accurate, so I concluded that the problem lies in the test code, which tests the (strict) equality of two different `tr` execution results. I have modified the test code to use `≈` instead of `==`. - fixes #54090
1 parent b049f93 commit 7c9a465

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stdlib/LinearAlgebra/test/symmetric.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ end
223223

224224
@testset "linalg unary ops" begin
225225
@testset "tr" begin
226-
@test tr(asym) == tr(Symmetric(asym))
227-
@test tr(aherm) == tr(Hermitian(aherm))
226+
@test tr(asym) tr(Symmetric(asym))
227+
@test tr(aherm) tr(Hermitian(aherm))
228228
end
229229

230230
@testset "isposdef[!]" begin

0 commit comments

Comments
 (0)