Skip to content

flaky condition number-related tests in test/linalg_solvers.jl #648

@nsajko

Description

@nsajko

Flaky tests here:

@testset "sparse matrix cond" begin
local A = sparse(reshape([1.0], 1, 1))
Ac = sprandn(20, 20,.5) + im*sprandn(20, 20,.5)
Ar = sprandn(20, 20,.5) + eps()*I
@test cond(A, 1) == 1.0
# For a discussion of the tolerance, see #14778
@test 0.99 <= cond(Ar, 1) \ opnorm(Ar, 1) * opnorm(inv(Array(Ar)), 1) < 3
@test 0.99 <= cond(Ac, 1) \ opnorm(Ac, 1) * opnorm(inv(Array(Ac)), 1) < 3
@test 0.99 <= cond(Ar, Inf) \ opnorm(Ar, Inf) * opnorm(inv(Array(Ar)), Inf) < 3
@test 0.99 <= cond(Ac, Inf) \ opnorm(Ac, Inf) * opnorm(inv(Array(Ac)), Inf) < 3
@test_throws ArgumentError cond(A,2)
@test_throws ArgumentError cond(A,3)
Arect = spzeros(10, 6)
@test_throws DimensionMismatch cond(Arect, 1)
@test_throws ArgumentError cond(Arect,2)
@test_throws DimensionMismatch cond(Arect, Inf)
end

Added in PR JuliaLang/julia#15113 to fix issue JuliaLang/LinearAlgebra.jl#301.

The test at line 136 above failed now in my PR JuliaLang/julia#59465.

CI link:

CI log excerpt:

SparseArrays/linalg_solvers                     (10) |         failed at 2025-09-02T09:02:29.135
Test Failed at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-master/julia-1d21dd31ac/share/julia/stdlib/v1.13/SparseArrays/test/linalg_solvers.jl:136
  Expression: 0.99 <= (cond(Ar, 1) \ opnorm(Ar, 1)) * opnorm(inv(Array(Ar)), 1) < 3
   Evaluated: 0.99 <= 3.02356520291477 < 3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions