Skip to content

Commit 3ddcbdb

Browse files
authored
row/colsupport for QRPackedQ and adjoint (#227)
* row/colsupport for QRPackedQ and adjoint * Update test_ldiv.jl
1 parent f79766a commit 3ddcbdb

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ArrayLayouts"
22
uuid = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
33
authors = ["Sheehan Olver <[email protected]>"]
4-
version = "1.9.1"
4+
version = "1.9.2"
55

66
[deps]
77
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"

src/factorizations.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ MemoryLayout(::Type{<:LinearAlgebra.QRCompactWYQ{<:Any,S}}) where {S} =
122122
adjointlayout(::Type, ::QRPackedQLayout{SLAY,TLAY}) where {SLAY,TLAY} = AdjQRPackedQLayout{SLAY,TLAY}()
123123
adjointlayout(::Type, ::QRCompactWYQLayout{SLAY,TLAY}) where {SLAY,TLAY} = AdjQRCompactWYQLayout{SLAY,TLAY}()
124124

125+
colsupport(::QRPackedQLayout, Q, j) = oneto(maximum(colsupport(Q.factors, j)))
126+
rowsupport(::QRPackedQLayout, Q, k) = minimum(rowsupport(Q.factors, k)):size(Q,2)
127+
colsupport(::AdjQRPackedQLayout, Q, j) = minimum(colsupport(Q'.factors, j)):size(Q,1)
128+
rowsupport(::AdjQRPackedQLayout, Q, k) = oneto(maximum(rowsupport(Q'.factors, k)))
129+
130+
125131
copy(M::Lmul{<:AbstractQLayout}) = copyto!(similar(M), M)
126132
mulreduce(M::Mul{<:AbstractQLayout,<:AbstractQLayout}) = Lmul(M)
127133
mulreduce(M::Mul{<:AbstractQLayout}) = Lmul(M)

test/test_ldiv.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,15 @@ import ArrayLayouts: ApplyBroadcastStyle, QRCompactWYQLayout, QRCompactWYLayout,
258258
@test ArrayLayouts.ldiv!(F, v) === v
259259
@test ArrayLayouts.ldiv!(F, view(copy(b),:)) A \ b
260260
end
261+
262+
@testset "row/colsupport" begin
263+
n = 10
264+
B = Bidiagonal(randn(n), randn(n-1), :L)
265+
Q = LinearAlgebra.qrfactUnblocked!(Matrix(B))
266+
Q = LinearAlgebra.QRPackedQ(Tridiagonal(Q.factors), Q.τ)
267+
@test rowsupport(Q, 4) colsupport(Q', 4) 3:10
268+
@test colsupport(Q, 4) rowsupport(Q', 4) Base.OneTo(5)
269+
end
261270
end
262271
end
263272

0 commit comments

Comments
 (0)