diff --git a/src/ArrayInterface.jl b/src/ArrayInterface.jl index dd6123810..5f07f6da3 100644 --- a/src/ArrayInterface.jl +++ b/src/ArrayInterface.jl @@ -50,6 +50,8 @@ Query whether an array type has fast scalar indexing """ fast_scalar_indexing(x) = true fast_scalar_indexing(x::AbstractArray) = fast_scalar_indexing(typeof(x)) +fast_scalar_indexing(::Type{<:LinearAlgebra.AbstractQ}) = false +fast_scalar_indexing(::Type{<:LinearAlgebra.LQPackedQ}) = false """ allowed_getindex(x,i...) diff --git a/test/runtests.jl b/test/runtests.jl index c5979f4d0..c77bf0527 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,6 @@ using ArrayInterface, Test using Base: setindex -import ArrayInterface: has_sparsestruct, findstructralnz +import ArrayInterface: has_sparsestruct, findstructralnz, fast_scalar_indexing @test ArrayInterface.ismutable(rand(3)) using StaticArrays @@ -39,6 +39,10 @@ Sp=sparse([1,2,3],[1,2,3],[1,2,3]) rowind,colind=findstructralnz(Sp) @test [Tri[rowind[i],colind[i]] for i in 1:length(rowind)]==[1,2,3] +@test !fast_scalar_indexing(qr(rand(10, 10)).Q) +@test !fast_scalar_indexing(qr(rand(10, 10), Val(true)).Q) +@test !fast_scalar_indexing(lq(rand(10, 10)).Q) + using BandedMatrices B=BandedMatrix(Ones(5,5), (-1,2))