Skip to content

Commit 1af0411

Browse files
authored
Add applyqr! for non-BLAS types (#120)
* conj and trans layouts are bandedblockbanded * Start blockbandwidths of banded matrix * shifts properly * Support Slice in sublayout * tests pass * Drop Julia v1.5 * add tests * increase coverage * applyqr! for non-BLAS * v0.11.1 * add bigfloat qr tests
1 parent 71e486c commit 1af0411

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "BlockBandedMatrices"
22
uuid = "ffab5731-97b5-5995-9138-79e8c1846df0"
3-
version = "0.11"
3+
version = "0.11.1"
44

55
[deps]
66
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
@@ -17,7 +17,7 @@ ArrayLayouts = "0.7"
1717
BandedMatrices = "0.16.8"
1818
BlockArrays = "0.16.6"
1919
FillArrays = "0.11, 0.12"
20-
MatrixFactorizations = "0.7.1, 0.8"
20+
MatrixFactorizations = "0.8.5"
2121
julia = "1.6"
2222

2323
[extras]

src/blockskylineqr.jl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
qrf!(A,τ) = _qrf!(MemoryLayout(A),MemoryLayout(τ),A,τ)
2-
_qrf!(::AbstractColumnMajor,::AbstractStridedLayout,A::AbstractMatrix{T}::AbstractVector{T}) where T<:BlasFloat =
3-
LAPACK.geqrf!(A,τ)
41
_apply_qr!(::AbstractColumnMajor, ::AbstractStridedLayout, ::AbstractStridedLayout, A::AbstractMatrix{T}, τ::AbstractVector{T}, B::AbstractVecOrMat{T}) where T<:BlasReal =
52
LAPACK.ormqr!('L','T',A,τ,B)
63
_apply_qr!(::AbstractColumnMajor, ::AbstractStridedLayout, ::AbstractStridedLayout, A::AbstractMatrix{T}, τ::AbstractVector{T}, B::AbstractVecOrMat{T}) where T<:BlasComplex =
74
LAPACK.ormqr!('L','C',A,τ,B)
5+
_apply_qr!(_, _, _, A::AbstractMatrix, τ::AbstractVector, B::AbstractVecOrMat) = lmul!(MatrixFactorizations.QRPackedQ(A, τ)', B)
86
apply_qr!(A, τ, B) = _apply_qr!(MemoryLayout(A), MemoryLayout(τ), MemoryLayout(B), A, τ, B)
97

108
qlf!(A,τ) = _qlf!(MemoryLayout(A),MemoryLayout(τ),A,τ)
@@ -30,7 +28,7 @@ function _blockbanded_qr!(A::AbstractMatrix, τ::AbstractVector, NCOLS::Block{1}
3028
KR = K:min(K+l,M)
3129
V = view(A,KR,K)
3230
t = view(τ,K)
33-
qrf!(V,t)
31+
MatrixFactorizations.qrfactUnblocked!(V,t)
3432
for J = K+1:min(K+u,N)
3533
apply_qr!(V, t, view(A,KR,J))
3634
end
@@ -41,7 +39,7 @@ end
4139
function qr!(A::BlockBandedMatrix{T}) where T
4240
M,N = blocksize(A)
4341
ax1 = M < N ? axes(A,1) : axes(A,2)
44-
_blockbanded_qr!(A, PseudoBlockVector{T}(undef, (ax1,)))
42+
_blockbanded_qr!(A, PseudoBlockVector(zeros(T,length(ax1)), (ax1,)))
4543
end
4644

4745
function ql!(A::BlockBandedMatrix{T}) where T

test/test_blockskylineqr.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,15 @@ import BlockBandedMatrices: blockcolsupport
177177
B = [Matrix(I,2,2); zeros(size(T,1)-2,2)]
178178
@test ((T - z*I)\b)[1] (F\b)[1] (F \ B)[1,1] ((T - z*I)\B)[1,1] -0.1309123477325813 + 0.28471699370329884im
179179
end
180+
181+
@testset "BigFloat QR" begin
182+
N = 5
183+
A = BlockBandedMatrix{BigFloat}(undef, 1:N,1:N, (2,1))
184+
A.data .= randn.()
185+
@test qr(A).Q qr(Float64.(A)).Q
186+
b = randn(size(A,1))
187+
@test qr(A .+ 0im)\b qr(A)\b A\b
188+
end
180189
end
181190

182191

0 commit comments

Comments
 (0)