1- qrf! (A,τ) = _qrf! (MemoryLayout (typeof (A)) ,MemoryLayout (typeof (τ) ),A,τ)
1+ qrf! (A,τ) = _qrf! (MemoryLayout (A) ,MemoryLayout (τ ),A,τ)
22_qrf! (:: AbstractColumnMajor ,:: AbstractStridedLayout ,A:: AbstractMatrix{T} ,τ:: AbstractVector{T} ) where T<: BlasFloat =
33 LAPACK. geqrf! (A,τ)
44_apply_qr! (:: AbstractColumnMajor , :: AbstractStridedLayout , :: AbstractStridedLayout , A:: AbstractMatrix{T} , τ:: AbstractVector{T} , B:: AbstractVecOrMat{T} ) where T<: BlasReal =
55 LAPACK. ormqr! (' L' ,' T' ,A,τ,B)
66_apply_qr! (:: AbstractColumnMajor , :: AbstractStridedLayout , :: AbstractStridedLayout , A:: AbstractMatrix{T} , τ:: AbstractVector{T} , B:: AbstractVecOrMat{T} ) where T<: BlasComplex =
77 LAPACK. ormqr! (' L' ,' C' ,A,τ,B)
8- apply_qr! (A, τ, B) = _apply_qr! (MemoryLayout (typeof (A)) , MemoryLayout (typeof (τ)) , MemoryLayout (typeof (B) ), A, τ, B)
8+ apply_qr! (A, τ, B) = _apply_qr! (MemoryLayout (A) , MemoryLayout (τ) , MemoryLayout (B ), A, τ, B)
99
10- qlf! (A,τ) = _qlf! (MemoryLayout (typeof (A)) ,MemoryLayout (typeof (τ) ),A,τ)
10+ qlf! (A,τ) = _qlf! (MemoryLayout (A) ,MemoryLayout (τ ),A,τ)
1111_qlf! (:: AbstractColumnMajor ,:: AbstractStridedLayout ,A:: AbstractMatrix{T} ,τ:: AbstractVector{T} ) where T<: BlasFloat =
1212 LAPACK. geqlf! (A,τ)
1313_apply_ql! (:: AbstractColumnMajor , :: AbstractStridedLayout , :: AbstractStridedLayout , A:: AbstractMatrix{T} , τ:: AbstractVector{T} , B:: AbstractVecOrMat{T} ) where T<: BlasReal =
1414 LAPACK. ormql! (' L' ,' T' ,A,τ,B)
1515_apply_ql! (:: AbstractColumnMajor , :: AbstractStridedLayout , :: AbstractStridedLayout , A:: AbstractMatrix{T} , τ:: AbstractVector{T} , B:: AbstractVecOrMat{T} ) where T<: BlasComplex =
1616 LAPACK. ormql! (' L' ,' C' ,A,τ,B)
17- apply_ql! (A, τ, B) = _apply_ql! (MemoryLayout (typeof (A)) , MemoryLayout (typeof (τ)) , MemoryLayout (typeof (B) ), A, τ, B)
17+ apply_ql! (A, τ, B) = _apply_ql! (MemoryLayout (A) , MemoryLayout (τ) , MemoryLayout (B ), A, τ, B)
1818
19- function qr! (A:: BlockBandedMatrix{T} ) where T
19+ function _blockbanded_qr! (A:: AbstractMatrix , τ:: AbstractVector )
20+ M,N = Block .(blocksize (A))
21+ (M < N ? axes (A,1 ) : axes (A,2 )) == axes (τ,1 ) || throw (DimensionMismatch (" " ))
22+ _blockbanded_qr! (A, τ, min (N,M))
23+ QR (A,τ. blocks)
24+ end
25+
26+ function _blockbanded_qr! (A:: AbstractMatrix , τ:: AbstractVector , NCOLS:: Block{1} )
2027 l,u = blockbandwidths (A)
21- M,N = blocksize (A)
22- ax1 = M < N ? axes (A,1 ) : axes (A,2 )
23- τ = PseudoBlockVector {T} (undef, (ax1,))
24- for K = 1 : min (N,M)
25- KR = Block .(K: min (K+ l,M))
26- V = view (A,KR,Block (K))
27- t = view (τ,Block (K))
28+ M,N = Block .(blocksize (A))
29+ for K = Block (1 ): NCOLS
30+ KR = K: min (K+ l,M)
31+ V = view (A,KR,K)
32+ t = view (τ,K)
2833 qrf! (V,t)
2934 for J = K+ 1 : min (K+ u,N)
30- apply_qr! (V, t, view (A,KR,Block (J) ))
35+ apply_qr! (V, t, view (A,KR,J ))
3136 end
3237 end
33- QR (A,τ. blocks)
38+ A,τ
39+ end
40+
41+ function qr! (A:: BlockBandedMatrix{T} ) where T
42+ M,N = blocksize (A)
43+ ax1 = M < N ? axes (A,1 ) : axes (A,2 )
44+ _blockbanded_qr! (A, PseudoBlockVector {T} (undef, (ax1,)))
3445end
3546
3647function ql! (A:: BlockBandedMatrix{T} ) where T
@@ -57,11 +68,13 @@ function ql!(A::BlockBandedMatrix{T}) where T
5768 QL (A,τ. blocks)
5869end
5970
60- _qr (:: AbstractBlockBandedLayout , _, A) = qr! (BlockBandedMatrix (A, (blockbandwidth (A,1 ), blockbandwidth (A,1 )+ blockbandwidth (A,2 ))))
71+ _qr (:: AbstractBlockBandedLayout , :: Tuple{Integer,Integer} , A) = qr! (BlockBandedMatrix (A, (blockbandwidth (A,1 ), blockbandwidth (A,1 )+ blockbandwidth (A,2 ))))
72+ _qr (lay:: AbstractBlockBandedLayout , ax:: Tuple{AbstractUnitRange{Int},AbstractUnitRange{Int}} , A) = _qr (lay, map (length, ax), A)
6173_ql (:: AbstractBlockBandedLayout , _, A) = ql! (BlockBandedMatrix (A, (blockbandwidth (A,1 )+ blockbandwidth (A,2 ),blockbandwidth (A,2 ))))
6274_factorize (:: AbstractBlockBandedLayout , _, A) = qr (A)
6375
64- function lmul! (adjQ:: Adjoint{<:Any,<:QRPackedQ{<:Any,<:BlockSkylineMatrix}} , Bin:: AbstractVector )
76+ function materialize! (Mul:: Lmul{<:AdjQRPackedQLayout{<:AbstractBlockBandedLayout}} )
77+ adjQ,Bin = Mul. A,Mul. B
6578 Q = parent (adjQ)
6679 A = Q. factors
6780 l,u = blockbandwidths (A)
@@ -78,23 +91,22 @@ function lmul!(adjQ::Adjoint{<:Any,<:QRPackedQ{<:Any,<:BlockSkylineMatrix}}, Bin
7891 end
7992 Bin
8093end
81-
82- function lmul! (adjQ:: Adjoint{<:Any,<:QLPackedQ{<:Any,<:BlockSkylineMatrix}} , Bin:: AbstractVector )
83- Q = parent (adjQ)
94+ function materialize! (Mul:: Lmul{<:AdjQLPackedQLayout{<:AbstractBlockBandedLayout}} )
95+ Q = parent (Mul. A)
8496 A = Q. factors
8597 l,u = blockbandwidths (A)
8698 N,M = blocksize (A)
8799 # impose block structure
88100 ax1 = (axes (A,1 ),)
89101 τ = PseudoBlockArray (Q. τ, ax1)
90- B = PseudoBlockArray (Bin , ax1)
102+ B = PseudoBlockArray (Mul . B , ax1)
91103 for K = N: - 1 : 1
92104 KR = Block .(max (1 ,K- u): K)
93105 V = view (A,KR,Block (K))
94106 t = view (τ,Block (K))
95107 apply_ql! (V, t, view (B,KR))
96108 end
97- Bin
109+ Mul . B
98110end
99111
100112# avoid LinearALgebra Strided obsession
0 commit comments