@@ -13,10 +13,10 @@ for elty in (Float32, Float64, Complex64, Complex128)
13
13
end
14
14
U = convert (Array{elty, 2 }, U)
15
15
V = convert (Array{elty, 2 }, V)
16
- @test_approx_eq tril (LinAlg. BLAS. syr2k (' L' ,' N' ,U,V)) tril (U* V.' + V* U.' )
17
- @test_approx_eq triu (LinAlg. BLAS. syr2k (' U' ,' N' ,U,V)) triu (U* V.' + V* U.' )
18
- @test_approx_eq tril (LinAlg. BLAS. syr2k (' L' ,' T' ,U,V)) tril (U.' * V + V.' * U)
19
- @test_approx_eq triu (LinAlg. BLAS. syr2k (' U' ,' T' ,U,V)) triu (U.' * V + V.' * U)
16
+ @test tril (LinAlg. BLAS. syr2k (' L' ,' N' ,U,V)) ≈ tril (U* V.' + V* U.' )
17
+ @test triu (LinAlg. BLAS. syr2k (' U' ,' N' ,U,V)) ≈ triu (U* V.' + V* U.' )
18
+ @test tril (LinAlg. BLAS. syr2k (' L' ,' T' ,U,V)) ≈ tril (U.' * V + V.' * U)
19
+ @test triu (LinAlg. BLAS. syr2k (' U' ,' T' ,U,V)) ≈ triu (U.' * V + V.' * U)
20
20
end
21
21
22
22
for elty in (Complex64, Complex128)
@@ -28,10 +28,10 @@ for elty in (Complex64, Complex128)
28
28
end
29
29
U = convert (Array{elty, 2 }, U)
30
30
V = convert (Array{elty, 2 }, V)
31
- @test_approx_eq tril (LinAlg. BLAS. her2k (' L' ,' N' ,U,V)) tril (U* V' + V* U' )
32
- @test_approx_eq triu (LinAlg. BLAS. her2k (' U' ,' N' ,U,V)) triu (U* V' + V* U' )
33
- @test_approx_eq tril (LinAlg. BLAS. her2k (' L' ,' C' ,U,V)) tril (U' * V + V' * U)
34
- @test_approx_eq triu (LinAlg. BLAS. her2k (' U' ,' C' ,U,V)) triu (U' * V + V' * U)
31
+ @test tril (LinAlg. BLAS. her2k (' L' ,' N' ,U,V)) ≈ tril (U* V' + V* U' )
32
+ @test triu (LinAlg. BLAS. her2k (' U' ,' N' ,U,V)) ≈ triu (U* V' + V* U' )
33
+ @test tril (LinAlg. BLAS. her2k (' L' ,' C' ,U,V)) ≈ tril (U' * V + V' * U)
34
+ @test triu (LinAlg. BLAS. her2k (' U' ,' C' ,U,V)) ≈ triu (U' * V + V' * U)
35
35
end
36
36
37
37
# # BLAS tests - testing the interface code to BLAS routines
@@ -55,13 +55,13 @@ for elty in [Float32, Float64, Complex64, Complex128]
55
55
if elty <: Real
56
56
x1 = convert (Vector{elty}, randn (n))
57
57
x2 = convert (Vector{elty}, randn (n))
58
- @test_approx_eq BLAS. dot (x1,x2) sum (x1.* x2)
58
+ @test BLAS. dot (x1,x2) ≈ sum (x1.* x2)
59
59
@test_throws DimensionMismatch BLAS. dot (x1,rand (elty, n + 1 ))
60
60
else
61
61
z1 = convert (Vector{elty}, complex (randn (n),randn (n)))
62
62
z2 = convert (Vector{elty}, complex (randn (n),randn (n)))
63
- @test_approx_eq BLAS. dotc (z1,z2) sum (conj (z1).* z2)
64
- @test_approx_eq BLAS. dotu (z1,z2) sum (z1.* z2)
63
+ @test BLAS. dotc (z1,z2) ≈ sum (conj (z1).* z2)
64
+ @test BLAS. dotu (z1,z2) ≈ sum (z1.* z2)
65
65
@test_throws DimensionMismatch BLAS. dotc (z1,rand (elty, n + 1 ))
66
66
@test_throws DimensionMismatch BLAS. dotu (z1,rand (elty, n + 1 ))
67
67
end
@@ -80,22 +80,22 @@ for elty in [Float32, Float64, Complex64, Complex128]
80
80
x1 = convert (Vector{elty}, randn (n))
81
81
x2 = convert (Vector{elty}, randn (n))
82
82
α = rand (elty)
83
- @test_approx_eq BLAS. axpy! (α,copy (x1),copy (x2)) x2 + α* x1
83
+ @test BLAS. axpy! (α,copy (x1),copy (x2)) ≈ x2 + α* x1
84
84
@test_throws DimensionMismatch BLAS. axpy! (α, copy (x1), rand (elty, n + 1 ))
85
85
@test_throws DimensionMismatch BLAS. axpy! (α, copy (x1), 1 : div (n,2 ), copy (x2), 1 : n)
86
86
@test_throws ArgumentError BLAS. axpy! (α, copy (x1), 0 : div (n,2 ), copy (x2), 1 : (div (n, 2 ) + 1 ))
87
87
@test_throws ArgumentError BLAS. axpy! (α, copy (x1), 1 : div (n,2 ), copy (x2), 0 : (div (n, 2 ) - 1 ))
88
- @test_approx_eq BLAS. axpy! (α,copy (x1),1 : n,copy (x2),1 : n) x2 + α* x1
88
+ @test BLAS. axpy! (α,copy (x1),1 : n,copy (x2),1 : n) ≈ x2 + α* x1
89
89
else
90
90
z1 = convert (Vector{elty}, complex (randn (n), randn (n)))
91
91
z2 = convert (Vector{elty}, complex (randn (n), randn (n)))
92
92
α = rand (elty)
93
- @test_approx_eq BLAS. axpy! (α, copy (z1), copy (z2)) z2 + α * z1
93
+ @test BLAS. axpy! (α, copy (z1), copy (z2)) ≈ z2 + α * z1
94
94
@test_throws DimensionMismatch BLAS. axpy! (α, copy (z1), rand (elty, n + 1 ))
95
95
@test_throws DimensionMismatch BLAS. axpy! (α, copy (z1), 1 : div (n, 2 ), copy (z2), 1 : (div (n, 2 ) + 1 ))
96
96
@test_throws ArgumentError BLAS. axpy! (α, copy (z1), 0 : div (n,2 ), copy (z2), 1 : (div (n, 2 ) + 1 ))
97
97
@test_throws ArgumentError BLAS. axpy! (α, copy (z1), 1 : div (n,2 ), copy (z2), 0 : (div (n, 2 ) - 1 ))
98
- @test_approx_eq BLAS. axpy! (α,copy (z1),1 : n,copy (z2),1 : n) z2 + α* z1
98
+ @test BLAS. axpy! (α,copy (z1),1 : n,copy (z2),1 : n) ≈ z2 + α* z1
99
99
end
100
100
101
101
# nrm2, iamax, and asum for StridedVectors
@@ -117,7 +117,7 @@ for elty in [Float32, Float64, Complex64, Complex128]
117
117
# trsv
118
118
A = triu (rand (elty,n,n))
119
119
x = rand (elty,n)
120
- @test_approx_eq A\ x BLAS. trsv (' U' ,' N' ,' N' ,A,x)
120
+ @test A\ x ≈ BLAS. trsv (' U' ,' N' ,' N' ,A,x)
121
121
@test_throws DimensionMismatch BLAS. trsv (' U' ,' N' ,' N' ,A,ones (elty,n+ 1 ))
122
122
123
123
# ger, her, syr
@@ -126,20 +126,20 @@ for elty in [Float32, Float64, Complex64, Complex128]
126
126
x = rand (elty,n)
127
127
y = rand (elty,n)
128
128
129
- @test_approx_eq BLAS. ger! (α,x,y,copy (A)) A + α* x* y'
129
+ @test BLAS. ger! (α,x,y,copy (A)) ≈ A + α* x* y'
130
130
@test_throws DimensionMismatch BLAS. ger! (α,ones (elty,n+ 1 ),y,copy (A))
131
131
132
132
A = rand (elty,n,n)
133
133
A = A + A.'
134
134
@test issymmetric (A)
135
- @test_approx_eq triu (BLAS. syr! (' U' ,α,x,copy (A))) triu (A + α* x* x.' )
135
+ @test triu (BLAS. syr! (' U' ,α,x,copy (A))) ≈ triu (A + α* x* x.' )
136
136
@test_throws DimensionMismatch BLAS. syr! (' U' ,α,ones (elty,n+ 1 ),copy (A))
137
137
138
138
if elty <: Complex
139
139
A = rand (elty,n,n)
140
140
A = A + A'
141
141
α = real (α)
142
- @test_approx_eq triu (BLAS. her! (' U' ,α,x,copy (A))) triu (A + α* x* x' )
142
+ @test triu (BLAS. her! (' U' ,α,x,copy (A))) ≈ triu (A + α* x* x' )
143
143
@test_throws DimensionMismatch BLAS. her! (' U' ,α,ones (elty,n+ 1 ),copy (A))
144
144
end
145
145
@@ -159,19 +159,19 @@ for elty in [Float32, Float64, Complex64, Complex128]
159
159
Aherm = A + A'
160
160
Asymm = A + A.'
161
161
162
- @test_approx_eq BLAS. symv (' U' ,Asymm,x) Asymm* x
162
+ @test BLAS. symv (' U' ,Asymm,x) ≈ Asymm* x
163
163
@test_throws DimensionMismatch BLAS. symv! (' U' ,one (elty),Asymm,x,one (elty),ones (elty,n+ 1 ))
164
164
@test_throws DimensionMismatch BLAS. symv (' U' ,ones (elty,n,n+ 1 ),x)
165
165
if elty <: BlasComplex
166
- @test_approx_eq BLAS. hemv (' U' ,Aherm,x) Aherm* x
166
+ @test BLAS. hemv (' U' ,Aherm,x) ≈ Aherm* x
167
167
@test_throws DimensionMismatch BLAS. hemv (' U' ,ones (elty,n,n+ 1 ),x)
168
168
@test_throws DimensionMismatch BLAS. hemv! (' U' ,one (elty),Aherm,x,one (elty),ones (elty,n+ 1 ))
169
169
end
170
170
171
171
# trmv
172
172
A = triu (rand (elty,n,n))
173
173
x = rand (elty,n)
174
- @test_approx_eq BLAS. trmv (' U' ,' N' ,' N' ,A,x) A* x
174
+ @test BLAS. trmv (' U' ,' N' ,' N' ,A,x) ≈ A* x
175
175
176
176
# symm error throwing
177
177
@test_throws DimensionMismatch BLAS. symm (' L' ,' U' ,ones (elty,n,n- 1 ),rand (elty,n,n))
@@ -192,7 +192,7 @@ for elty in [Float32, Float64, Complex64, Complex128]
192
192
# trsm
193
193
A = triu (rand (elty,n,n))
194
194
B = rand (elty,(n,n))
195
- @test_approx_eq BLAS. trsm (' L' ,' U' ,' N' ,' N' ,one (elty),A,B) A\ B
195
+ @test BLAS. trsm (' L' ,' U' ,' N' ,' N' ,one (elty),A,B) ≈ A\ B
196
196
197
197
# gbmv - will work for SymTridiagonal,Tridiagonal,Bidiagonal!
198
198
TD = Tridiagonal (rand (elty,n- 1 ),rand (elty,n),rand (elty,n- 1 ))
@@ -202,7 +202,7 @@ for elty in [Float32, Float64, Complex64, Complex128]
202
202
fTD[1 ,2 : n] = TD. du
203
203
fTD[2 ,:] = TD. d
204
204
fTD[3 ,1 : n- 1 ] = TD. dl
205
- @test_approx_eq BLAS. gbmv (' N' ,n,1 ,1 ,fTD,x) TD* x
205
+ @test BLAS. gbmv (' N' ,n,1 ,1 ,fTD,x) ≈ TD* x
206
206
207
207
# sbmv - will work for SymTridiagonal only!
208
208
if elty <: BlasReal
@@ -212,15 +212,15 @@ for elty in [Float32, Float64, Complex64, Complex128]
212
212
fST = zeros (elty,2 ,n)
213
213
fST[1 ,2 : n] = ST. ev
214
214
fST[2 ,:] = ST. dv
215
- @test_approx_eq BLAS. sbmv (' U' ,1 ,fST,x) ST* x
215
+ @test BLAS. sbmv (' U' ,1 ,fST,x) ≈ ST* x
216
216
else
217
217
dv = real (rand (elty,n))
218
218
ev = rand (elty,n- 1 )
219
219
bH = zeros (elty,2 ,n)
220
220
bH[1 ,2 : n] = ev
221
221
bH[2 ,:] = dv
222
222
fullH = diagm (dv) + diagm (conj (ev),- 1 ) + diagm (ev,1 )
223
- @test_approx_eq BLAS. hbmv (' U' ,1 ,bH,x) fullH* x
223
+ @test BLAS. hbmv (' U' ,1 ,bH,x) ≈ fullH* x
224
224
end
225
225
end
226
226
0 commit comments