Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/ArrayInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,10 @@ function qr_instance(A::Matrix{T}) where {T}
LinearAlgebra.QRCompactWYQ(zeros(T,0,0),zeros(T,0,0))
end

function qr_instance(A::Matrix{BigFloat})
LinearAlgebra.QR(zeros(BigFloat,0,0),zeros(BigFloat,0))
end

# Could be optimized but this should work for any real case.
function qr_instance(jac_prototype::SparseMatrixCSC)
qr(sparse(rand(1,1)))
Expand Down
15 changes: 15 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,18 @@ end
@test !ArrayInterface.ensures_sorted([])
@test ArrayInterface.ensures_sorted(1:10)
end

@testset "linearalgebra instances" begin
for A in [rand(2,2), rand(Float32,2,2), rand(BigFloat,2,2)]

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

if !(eltype(A) <: BigFloat)
@test ArrayInterface.bunchkaufman_instance(A) isa typeof(bunchkaufman(A' * A))
@test ArrayInterface.cholesky_instance(A) isa typeof(cholesky(A' * A))
@test ArrayInterface.ldlt_instance(A) isa typeof(ldlt(SymTridiagonal(A' * A)))
@test ArrayInterface.svd_instance(A) isa typeof(svd(A))
end
end
end