Skip to content

Commit f4a042c

Browse files
Merge pull request #406 from JuliaArrays/qr_bigfloat
Fix BigFloat QR instance and test better
2 parents ba02e0c + a26b85a commit f4a042c

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/ArrayInterface.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,10 @@ function qr_instance(A::Matrix{T}) where {T}
576576
LinearAlgebra.QRCompactWYQ(zeros(T,0,0),zeros(T,0,0))
577577
end
578578

579+
function qr_instance(A::Matrix{BigFloat})
580+
LinearAlgebra.QR(zeros(BigFloat,0,0),zeros(BigFloat,0))
581+
end
582+
579583
# Could be optimized but this should work for any real case.
580584
function qr_instance(jac_prototype::SparseMatrixCSC)
581585
qr(sparse(rand(1,1)))

test/core.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,18 @@ end
259259
@test !ArrayInterface.ensures_sorted([])
260260
@test ArrayInterface.ensures_sorted(1:10)
261261
end
262+
263+
@testset "linearalgebra instances" begin
264+
for A in [rand(2,2), rand(Float32,2,2), rand(BigFloat,2,2)]
265+
266+
@test ArrayInterface.lu_instance(A) isa typeof(lu(A))
267+
@test ArrayInterface.qr_instance(A) isa typeof(qr(A))
268+
269+
if !(eltype(A) <: BigFloat)
270+
@test ArrayInterface.bunchkaufman_instance(A) isa typeof(bunchkaufman(A' * A))
271+
@test ArrayInterface.cholesky_instance(A) isa typeof(cholesky(A' * A))
272+
@test ArrayInterface.ldlt_instance(A) isa typeof(ldlt(SymTridiagonal(A' * A)))
273+
@test ArrayInterface.svd_instance(A) isa typeof(svd(A))
274+
end
275+
end
276+
end

0 commit comments

Comments
 (0)