Skip to content

Commit 739035e

Browse files
replace @test_approx_eq_eps a b ε with @test a ≈ b atol=ε
[ci skip] – known to be failing tests at the moment
1 parent 9fd13e3 commit 739035e

File tree

16 files changed

+102
-102
lines changed

16 files changed

+102
-102
lines changed

test/complex.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ end
101101
@test exp(x) exp(big(x))
102102
@test exp10(x) exp10(big(x))
103103
@test exp2(x) exp2(big(x))
104-
@test_approx_eq_eps expm1(x) expm1(big(x)) eps(T)
104+
@test expm1(x) expm1(big(x)) atol=eps(T)
105105
@test log(x) log(big(x))
106106
@test log10(x) log10(big(x))
107107
@test log1p(x) log1p(big(x))

test/linalg/arnoldi.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ using Base.Test
4747
@test eigs(apd; nev=1, sigma=d[3])[1][1] d[3]
4848

4949
(d,v) = eigs(apd, bpd, nev=3, tol=1e-8)
50-
@test_approx_eq_eps apd*v[:,2] d[2]*bpd*v[:,2] testtol
50+
@test apd*v[:,2] d[2]*bpd*v[:,2] atol=testtol
5151
@test norm(v) > testtol # eigenvectors cannot be null vectors
5252

5353
@testset "(shift-and-)invert mode" begin
@@ -56,7 +56,7 @@ using Base.Test
5656
@test norm(v) > testtol # eigenvectors cannot be null vectors
5757

5858
(d,v) = eigs(apd, bpd, nev=3, sigma=0, tol=1e-8)
59-
@test_approx_eq_eps apd*v[:,1] d[1]*bpd*v[:,1] testtol
59+
@test apd*v[:,1] d[1]*bpd*v[:,1] atol=testtol
6060
@test norm(v) > testtol # eigenvectors cannot be null vectors
6161
end
6262

test/linalg/bidiag.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ srand(1)
198198
Test.test_approx_eq_modphase(u1, u2)
199199
Test.test_approx_eq_modphase(v1, v2)
200200
end
201-
@test_approx_eq_eps 0 vecnorm(u2*diagm(d2)*v2'-Tfull) n*max(n^2*eps(relty),vecnorm(u1*diagm(d1)*v1'-Tfull))
201+
@test 0 vecnorm(u2*diagm(d2)*v2'-Tfull) atol=n*max(n^2*eps(relty),vecnorm(u1*diagm(d1)*v1'-Tfull))
202202
@inferred svdvals(T)
203203
@inferred svd(T)
204204
end

test/linalg/bunchkaufman.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ bimg = randn(n,2)/2
5757
@test logabsdet(bc1)[2] sign(det(bc1))
5858
end
5959
@test inv(bc1)*asym eye(n)
60-
@test_approx_eq_eps asym*(bc1\b) b 1000ε
60+
@test asym*(bc1\b) b atol=1000ε
6161
@testset for rook in (false, true)
6262
@test inv(bkfact(a.'+a, :U, true, rook))*(a.'+a) eye(n)
6363
@test size(bc1) == size(bc1.LD)
@@ -76,7 +76,7 @@ bimg = randn(n,2)/2
7676
@test logabsdet(bc2)[1] log(abs(det(bc2)))
7777
@test logabsdet(bc2)[2] == sign(det(bc2))
7878
@test inv(bc2)*apd eye(n)
79-
@test_approx_eq_eps apd*(bc2\b) b 150000ε
79+
@test apd*(bc2\b) b atol=150000ε
8080
@test ishermitian(bc2) == !issymmetric(bc2)
8181
end
8282
end

test/linalg/dense.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ for elty in (Float32, Float64, Complex64, Complex128)
2626
a = view(ainit, 1:n, 1:n)
2727
end
2828
# cond
29-
@test_approx_eq_eps cond(a,1) 4.837320054554436e+02 0.01
30-
@test_approx_eq_eps cond(a,2) 1.960057871514615e+02 0.01
31-
@test_approx_eq_eps cond(a,Inf) 3.757017682707787e+02 0.01
32-
@test_approx_eq_eps cond(a[:,1:5]) 10.233059337453463 0.01
29+
@test cond(a,1) 4.837320054554436e+02 atol=0.01
30+
@test cond(a,2) 1.960057871514615e+02 atol=0.01
31+
@test cond(a,Inf) 3.757017682707787e+02 atol=0.01
32+
@test cond(a[:,1:5]) 10.233059337453463 atol=0.01
3333
@test_throws ArgumentError cond(a,3)
3434
end
3535
end
@@ -75,8 +75,8 @@ debug && println("Solve square general system of equations")
7575
debug && println("Test nullspace")
7676
a15null = nullspace(a[:,1:n1]')
7777
@test rank([a[:,1:n1] a15null]) == 10
78-
@test_approx_eq_eps norm(a[:,1:n1]'a15null,Inf) zero(eltya) 300ε
79-
@test_approx_eq_eps norm(a15null'a[:,1:n1],Inf) zero(eltya) 400ε
78+
@test norm(a[:,1:n1]'a15null,Inf) zero(eltya) atol=300ε
79+
@test norm(a15null'a[:,1:n1],Inf) zero(eltya) atol=400ε
8080
@test size(nullspace(b), 2) == 0
8181
@test nullspace(zeros(eltya,n)) == eye(eltya,1)
8282
end

test/linalg/diagonal.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ srand(1)
4747
end
4848

4949
for func in (det, trace)
50-
@test_approx_eq_eps func(D) func(DM) n^2*eps(relty)*(1+(elty<:Complex))
50+
@test func(D) func(DM) atol=n^2*eps(relty)*(1+(elty<:Complex))
5151
end
5252
if relty <: BlasFloat
5353
for func in (expm,)
54-
@test_approx_eq_eps func(D) func(DM) n^3*eps(relty)
54+
@test func(D) func(DM) atol=n^3*eps(relty)
5555
end
56-
@test_approx_eq_eps logm(Diagonal(abs.(D.diag))) logm(abs.(DM)) n^3*eps(relty)
56+
@test logm(Diagonal(abs.(D.diag))) logm(abs.(DM)) atol=n^3*eps(relty)
5757
end
5858
if elty <: BlasComplex
5959
for func in (logdet, sqrtm)
60-
@test_approx_eq_eps func(D) func(DM) n^2*eps(relty)*2
60+
@test func(D) func(DM) atol=n^2*eps(relty)*2
6161
end
6262
end
6363
end
@@ -73,18 +73,18 @@ srand(1)
7373
U = view(UU, 1:n, 1:2)
7474
end
7575

76-
@test_approx_eq_eps D*v DM*v n*eps(relty)*(1+(elty<:Complex))
77-
@test_approx_eq_eps D*U DM*U n^2*eps(relty)*(1+(elty<:Complex))
76+
@test D*v DM*v atol=n*eps(relty)*(1+(elty<:Complex))
77+
@test D*U DM*U atol=n^2*eps(relty)*(1+(elty<:Complex))
7878

7979
@test U.'*D U.'*Array(D)
8080
@test U'*D U'*Array(D)
8181

8282
if relty != BigFloat
83-
@test_approx_eq_eps D\v DM\v 2n^2*eps(relty)*(1+(elty<:Complex))
84-
@test_approx_eq_eps D\U DM\U 2n^3*eps(relty)*(1+(elty<:Complex))
85-
@test_approx_eq_eps A_ldiv_B!(D,copy(v)) DM\v 2n^2*eps(relty)*(1+(elty<:Complex))
86-
@test_approx_eq_eps A_ldiv_B!(D,copy(U)) DM\U 2n^3*eps(relty)*(1+(elty<:Complex))
87-
@test_approx_eq_eps A_ldiv_B!(D,eye(D)) D\eye(D) 2n^3*eps(relty)*(1+(elty<:Complex))
83+
@test D\v DM\v atol=2n^2*eps(relty)*(1+(elty<:Complex))
84+
@test D\U DM\U atol=2n^3*eps(relty)*(1+(elty<:Complex))
85+
@test A_ldiv_B!(D,copy(v)) DM\v atol=2n^2*eps(relty)*(1+(elty<:Complex))
86+
@test A_ldiv_B!(D,copy(U)) DM\U atol=2n^3*eps(relty)*(1+(elty<:Complex))
87+
@test A_ldiv_B!(D,eye(D)) D\eye(D) atol=2n^3*eps(relty)*(1+(elty<:Complex))
8888
@test_throws DimensionMismatch A_ldiv_B!(D, ones(elty, n + 1))
8989
@test_throws SingularException A_ldiv_B!(Diagonal(zeros(relty,n)),copy(v))
9090
b = rand(elty,n,n)

test/linalg/eigen.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ aimg = randn(n,n)/2
6565
f = eigfact(asym_sg, a_sg'a_sg)
6666
@test asym_sg*f[:vectors] (a_sg'a_sg*f[:vectors]) * Diagonal(f[:values])
6767
@test f[:values] eigvals(asym_sg, a_sg'a_sg)
68-
@test_approx_eq_eps prod(f[:values]) prod(eigvals(asym_sg/(a_sg'a_sg))) 200ε
68+
@test prod(f[:values]) prod(eigvals(asym_sg/(a_sg'a_sg))) atol=200ε
6969
@test eigvecs(asym_sg, a_sg'a_sg) == f[:vectors]
7070
@test eigvals(f) === f[:values]
7171
@test eigvecs(f) === f[:vectors]
@@ -86,7 +86,7 @@ aimg = randn(n,n)/2
8686
f = eigfact(a1_nsg, a2_nsg)
8787
@test a1_nsg*f[:vectors] (a2_nsg*f[:vectors]) * Diagonal(f[:values])
8888
@test f[:values] eigvals(a1_nsg, a2_nsg)
89-
@test_approx_eq_eps prod(f[:values]) prod(eigvals(a1_nsg/a2_nsg)) 50000ε
89+
@test prod(f[:values]) prod(eigvals(a1_nsg/a2_nsg)) atol=50000ε
9090
@test eigvecs(a1_nsg, a2_nsg) == f[:vectors]
9191
@test_throws KeyError f[:Z]
9292

test/linalg/generic.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,17 @@ y = linspace(50, 200, 100)
107107
# Anscombe's quartet (https://en.wikipedia.org/wiki/Anscombe%27s_quartet)
108108
x123 = [10.0; 8.0; 13.0; 9.0; 11.0; 14.0; 6.0; 4.0; 12.0; 7.0; 5.0]
109109
y1 = [8.04; 6.95; 7.58; 8.81; 8.33; 9.96; 7.24; 4.26; 10.84; 4.82; 5.68]
110-
@test_approx_eq_eps [linreg(x123,y1)...] [3.0,0.5] 10e-5
110+
@test [linreg(x123,y1)...] [3.0,0.5] atol=10e-5
111111

112112
y2 = [9.14; 8.14; 8.74; 8.77; 9.26; 8.10; 6.12; 3.10; 9.13; 7.26; 4.74]
113-
@test_approx_eq_eps [linreg(x123,y2)...] [3.0,0.5] 10e-3
113+
@test [linreg(x123,y2)...] [3.0,0.5] atol=10e-3
114114

115115
y3 = [7.46; 6.77; 12.74; 7.11; 7.81; 8.84; 6.08; 5.39; 8.15; 6.42; 5.73]
116-
@test_approx_eq_eps [linreg(x123,y3)...] [3.0,0.5] 10e-3
116+
@test [linreg(x123,y3)...] [3.0,0.5] atol=10e-3
117117

118118
x4 = [8.0; 8.0; 8.0; 8.0; 8.0; 8.0; 8.0; 19.0; 8.0; 8.0; 8.0]
119119
y4 = [6.58; 5.76; 7.71; 8.84; 8.47; 7.04; 5.25; 12.50; 5.56; 7.91; 6.89]
120-
@test_approx_eq_eps [linreg(x4,y4)...] [3.0,0.5] 10e-3
120+
@test [linreg(x4,y4)...] [3.0,0.5] atol=10e-3
121121

122122
# test diag
123123
let A = eye(4)

test/linalg/lq.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,18 @@ bimg = randn(n,2)/2
5959
@test full(copy(lqa)) a
6060
end
6161
@testset "Binary ops" begin
62-
@test_approx_eq_eps a*(lqa\b) b 3000ε
63-
@test_approx_eq_eps lqa*b qra[:Q]*qra[:R]*b 3000ε
64-
@test_approx_eq_eps A_mul_Bc(eye(eltyb,size(q.factors,2)),q)*full(q,thin=false) eye(n) 5000ε
62+
@test a*(lqa\b) b atol=3000ε
63+
@test lqa*b qra[:Q]*qra[:R]*b atol=3000ε
64+
@test A_mul_Bc(eye(eltyb,size(q.factors,2)),q)*full(q,thin=false) eye(n) atol=5000ε
6565
if eltya != Int
6666
@test eye(eltyb,n)*q convert(AbstractMatrix{tab},q)
6767
end
68-
@test_approx_eq_eps q*b full(q,thin=false)*b 100ε
69-
@test_approx_eq_eps q.'*b full(q,thin=false).'*b 100ε
70-
@test_approx_eq_eps q'*b full(q,thin=false)'*b 100ε
71-
@test_approx_eq_eps a*q a*full(q,thin=false) 100ε
72-
@test_approx_eq_eps a*q.' a*full(q,thin=false).' 100ε
73-
@test_approx_eq_eps a*q' a*full(q,thin=false)' 100ε
68+
@test q*b full(q,thin=false)*b atol=100ε
69+
@test q.'*b full(q,thin=false).'*b atol=100ε
70+
@test q'*b full(q,thin=false)'*b atol=100ε
71+
@test a*q a*full(q,thin=false) atol=100ε
72+
@test a*q.' a*full(q,thin=false).' atol=100ε
73+
@test a*q' a*full(q,thin=false)' atol=100ε
7474
@test_throws DimensionMismatch q*b[1:n1 + 1]
7575
@test_throws DimensionMismatch Ac_mul_B(q,ones(eltya,n+2,n+2))
7676
@test_throws DimensionMismatch ones(eltyb,n+2,n+2)*q

test/linalg/pinv.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,19 @@ function test_pinv(a,m,n,tol1,tol2,tol3)
9292
debug && println("=== julia/matlab pinv, default tol=eps(1.0)*max(size(a)) ===")
9393
apinv = @inferred pinv(a)
9494

95-
@test_approx_eq_eps vecnorm(a*apinv*a-a)/vecnorm(a) 0 tol1
95+
@test vecnorm(a*apinv*a-a)/vecnorm(a) 0 atol=tol1
9696
x0 = randn(n); b = a*x0; x = apinv*b
97-
@test_approx_eq_eps vecnorm(a*x-b)/vecnorm(b) 0 tol1
97+
@test vecnorm(a*x-b)/vecnorm(b) 0 atol=tol1
9898
debug && println(vecnorm(a*apinv*a - a)/vecnorm(a))
9999
debug && println(vecnorm(a*x-b)/vecnorm(b))
100100

101101

102102
debug && println("=== julia pinv, tol=sqrt(eps(1.0)) ===")
103103
apinv = pinv(a,sqrt(eps(real(one(eltype(a))))))
104104

105-
@test_approx_eq_eps vecnorm(a*apinv*a-a)/vecnorm(a) 0 tol2
105+
@test vecnorm(a*apinv*a-a)/vecnorm(a) 0 atol=tol2
106106
x0 = randn(n); b = a*x0; x = apinv*b
107-
@test_approx_eq_eps vecnorm(a*x-b)/vecnorm(b) 0 tol2
107+
@test vecnorm(a*x-b)/vecnorm(b) 0 atol=tol2
108108
debug && println(vecnorm(a*apinv*a - a)/vecnorm(a))
109109
debug && println(vecnorm(a*x-b)/vecnorm(b))
110110
end

0 commit comments

Comments
 (0)