Skip to content

Commit

Permalink
[LinearAlgebra] Add regression test for BLAS.nrm2 with non-finite v…
Browse files Browse the repository at this point in the history
…alues

This would have caught an old upstream bug in OpenBLAS, which was later fixed in
v0.3.14.
  • Loading branch information
giordano committed Jan 26, 2024
1 parent e4793b0 commit e758c30
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions stdlib/LinearAlgebra/test/blas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ Random.seed!(100)
@test BLAS.iamax(b) == findmax(fabs, b)[2] * (step(ind) >= 0)
end
end
@testset "nrm2 with non-finite elements" begin
# These tests would have caught <https://github.com/OpenMathLib/OpenBLAS/issues/2998>
# when running on appropriate hardware.
a = zeros(elty,n)
a[begin] = elty(-Inf)
@test BLAS.nrm2(a) === abs2(elty(Inf))
a[begin] = elty(NaN)
@test BLAS.nrm2(a) === abs2(elty(NaN))
end
@testset "scal" begin
α = rand(elty)
a = rand(elty,n)
Expand Down

0 comments on commit e758c30

Please sign in to comment.