Skip to content

Commit 9e9df93

Browse files
committed
increase coverage
1 parent f4ea67c commit 9e9df93

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

test/projections.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const BLASFloats = (Float32, Float64, ComplexF32, ComplexF64)
99
@testset "project_(anti)hermitian! for T = $T" for T in BLASFloats
1010
rng = StableRNG(123)
1111
m = 54
12+
noisefactor = eps(real(T))^(3 / 4)
1213
for alg in (NativeBlocked(blocksize = 16), NativeBlocked(blocksize = 32), NativeBlocked(blocksize = 64))
1314
A = randn(rng, T, m, m)
1415
Ah = (A + A') / 2
@@ -19,11 +20,17 @@ const BLASFloats = (Float32, Float64, ComplexF32, ComplexF64)
1920
@test ishermitian(Bh)
2021
@test Bh Ah
2122
@test A == Ac
23+
Bh_approx = Bh + noisefactor * Aa
24+
@test !ishermitian(Bh_approx)
25+
@test ishermitian(Bh_approx; rtol = 10 * noisefactor)
2226

2327
Ba = project_antihermitian(A, alg)
2428
@test isantihermitian(Ba)
2529
@test Ba Aa
2630
@test A == Ac
31+
Ba_approx = Ba + noisefactor * Ah
32+
@test !isantihermitian(Ba_approx)
33+
@test isantihermitian(Ba_approx; rtol = 10 * noisefactor)
2734

2835
Bh = project_hermitian!(Ac, alg)
2936
@test Bh === Ac

0 commit comments

Comments
 (0)