Skip to content

Commit 2215344

Browse files
Support and test complex instance types
1 parent b3a3246 commit 2215344

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/ArrayInterface.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ Returns an instance of the SVD factorization object with the correct type
666666
cheaply.
667667
"""
668668
function svd_instance(A::Matrix{T}) where {T}
669-
LinearAlgebra.SVD(zeros(T,0,0),zeros(T,0),zeros(T,0,0))
669+
LinearAlgebra.SVD(zeros(T,0,0),zeros(real(T),0),zeros(T,0,0))
670670
end
671671

672672
"""

test/core.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,16 +261,18 @@ end
261261
end
262262

263263
@testset "linearalgebra instances" begin
264-
for A in [rand(2,2), rand(Float32,2,2), rand(BigFloat,2,2)]
264+
for A in [rand(2,2), rand(Float32,2,2), rand(BigFloat,2,2), rand(ComplexF32,2,2), rand(ComplexF64,2,2)]
265265

266266
@test ArrayInterface.lu_instance(A) isa typeof(lu(A))
267267
@test ArrayInterface.qr_instance(A) isa typeof(qr(A))
268268

269269
if !(eltype(A) <: BigFloat)
270-
@test ArrayInterface.bunchkaufman_instance(A' * A) isa typeof(bunchkaufman(A' * A))
271270
@test ArrayInterface.cholesky_instance(A' * A) isa typeof(cholesky(A' * A))
272-
@test ArrayInterface.ldlt_instance(SymTridiagonal(A' * A)) isa typeof(ldlt(SymTridiagonal(A' * A)))
273271
@test ArrayInterface.svd_instance(A) isa typeof(svd(A))
272+
if !(eltype(A) <: Union{ComplexF16,ComplexF32,ComplexF64})
273+
@test ArrayInterface.bunchkaufman_instance(A' * A) isa typeof(bunchkaufman(A' * A))
274+
@test ArrayInterface.ldlt_instance(SymTridiagonal(A' * A)) isa typeof(ldlt(SymTridiagonal(A' * A)))
275+
end
274276
end
275277
end
276278

0 commit comments

Comments
 (0)