Skip to content

Commit 00e6288

Browse files
committed
Replace some Array constructors with convert
1 parent 2e169af commit 00e6288

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

test/diagonal.jl

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ LinearAlgebra.istril(N::NotDiagonal) = istril(N.a)
100100
@test typeof(convert(Diagonal{ComplexF32},D)) <: Diagonal{ComplexF32}
101101
@test typeof(convert(AbstractMatrix{ComplexF32},D)) <: Diagonal{ComplexF32}
102102

103-
@test Array(real(D)) == real(M)
104-
@test Array(abs.(D)) == abs.(M)
105-
@test Array(imag(D)) == imag(M)
103+
@test convert(Array, real(D)) == real(M)
104+
@test convert(Array, abs.(D)) == abs.(M)
105+
@test convert(Array, imag(D)) == imag(M)
106106

107107
@test parent(D) == dd
108108
@test D[1,1] == dd[1]
@@ -242,9 +242,9 @@ LinearAlgebra.istril(N::NotDiagonal) = istril(N.a)
242242
@test Array(D*a) DM*a
243243
@test Array(D/a) DM/a
244244
if elty <: Real
245-
@test Array(abs.(D)^a) abs.(DM)^a
245+
@test convert(Array, abs.(D)^a) abs.(DM)^a
246246
else
247-
@test Array(D^a) DM^a rtol=max(eps(relty), 1e-15) # TODO: improve precision
247+
@test convert(Array, D^a) DM^a rtol=max(eps(relty), 1e-15) # TODO: improve precision
248248
end
249249
@test Diagonal(1:100)^2 == Diagonal((1:100).^2)
250250
p = 3
@@ -285,24 +285,25 @@ LinearAlgebra.istril(N::NotDiagonal) = istril(N.a)
285285
Mherm = Array(Aherm)
286286
for op in (+, -)
287287
@test op(Asym, D) isa Symmetric
288-
@test Array(op(Asym, D)) Array(Symmetric(op(Msym, M)))
288+
@test convert(Array, op(Asym, D)) Array(Symmetric(op(Msym, M)))
289289
@test op(D, Asym) isa Symmetric
290-
@test Array(op(D, Asym)) Array(Symmetric(op(M, Msym)))
290+
@test convert(Array, op(D, Asym)) Array(Symmetric(op(M, Msym)))
291291
if !(elty <: Real)
292292
Dr = real(D)
293293
Mr = Array(Dr)
294294
@test op(Aherm, Dr) isa Hermitian
295-
@test Array(op(Aherm, Dr)) Array(Hermitian(op(Mherm, Mr)))
295+
@test convert(Array, op(Aherm, Dr)) Array(Hermitian(op(Mherm, Mr)))
296296
@test op(Dr, Aherm) isa Hermitian
297-
@test Array(op(Dr, Aherm)) Array(Hermitian(op(Mr, Mherm)))
297+
@test convert(Array, op(Dr, Aherm)) Array(Hermitian(op(Mr, Mherm)))
298298
end
299299
end
300-
@test Array(D*transpose(Asym)) M * Array(transpose(Asym))
300+
Msym = Array(Asym)
301+
@test Array(D*transpose(Asym)) M * transpose(Msym)
301302
@test Array(D*adjoint(Asym)) M * Array(adjoint(Asym))
302303
@test Array(D*transpose(Aherm)) M * Array(transpose(Aherm))
303304
@test Array(D*adjoint(Aherm)) M * Array(adjoint(Aherm))
304-
@test Array(transpose(Asym)*transpose(D)) Array(transpose(Asym)) * Array(transpose(D))
305-
@test Array(transpose(D)*transpose(Asym)) Array(transpose(D)) * Array(transpose(Asym))
305+
@test Array(Asym*transpose(D)) Msym * Array(transpose(D))
306+
@test Array(transpose(D)*Asym) Array(transpose(D)) * Msym
306307
@test Array(adjoint(Aherm)*adjoint(D)) Array(adjoint(Aherm)) * Array(adjoint(D))
307308
@test Array(adjoint(D)*adjoint(Aherm)) Array(adjoint(D)) * Array(adjoint(Aherm))
308309

0 commit comments

Comments
 (0)