Skip to content

Commit 88bbbfb

Browse files
Merge pull request #26 from tkf/qr
Mark AbstractQ and LQPackedQ as non-fast_scalar_indexing
2 parents 7e6fbf1 + b48314e commit 88bbbfb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/ArrayInterface.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Query whether an array type has fast scalar indexing
5050
"""
5151
fast_scalar_indexing(x) = true
5252
fast_scalar_indexing(x::AbstractArray) = fast_scalar_indexing(typeof(x))
53+
fast_scalar_indexing(::Type{<:LinearAlgebra.AbstractQ}) = false
54+
fast_scalar_indexing(::Type{<:LinearAlgebra.LQPackedQ}) = false
5355

5456
"""
5557
allowed_getindex(x,i...)

test/runtests.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using ArrayInterface, Test
22
using Base: setindex
3-
import ArrayInterface: has_sparsestruct, findstructralnz
3+
import ArrayInterface: has_sparsestruct, findstructralnz, fast_scalar_indexing
44
@test ArrayInterface.ismutable(rand(3))
55

66
using StaticArrays
@@ -39,6 +39,10 @@ Sp=sparse([1,2,3],[1,2,3],[1,2,3])
3939
rowind,colind=findstructralnz(Sp)
4040
@test [Tri[rowind[i],colind[i]] for i in 1:length(rowind)]==[1,2,3]
4141

42+
@test !fast_scalar_indexing(qr(rand(10, 10)).Q)
43+
@test !fast_scalar_indexing(qr(rand(10, 10), Val(true)).Q)
44+
@test !fast_scalar_indexing(lq(rand(10, 10)).Q)
45+
4246
using BandedMatrices
4347

4448
B=BandedMatrix(Ones(5,5), (-1,2))

0 commit comments

Comments
 (0)