1
- qrf! (A,τ) = _qrf! (MemoryLayout (typeof (A)) ,MemoryLayout (typeof (τ) ),A,τ)
1
+ qrf! (A,τ) = _qrf! (MemoryLayout (A) ,MemoryLayout (τ ),A,τ)
2
2
_qrf! (:: AbstractColumnMajor ,:: AbstractStridedLayout ,A:: AbstractMatrix{T} ,τ:: AbstractVector{T} ) where T<: BlasFloat =
3
3
LAPACK. geqrf! (A,τ)
4
4
_apply_qr! (:: AbstractColumnMajor , :: AbstractStridedLayout , :: AbstractStridedLayout , A:: AbstractMatrix{T} , τ:: AbstractVector{T} , B:: AbstractVecOrMat{T} ) where T<: BlasReal =
5
5
LAPACK. ormqr! (' L' ,' T' ,A,τ,B)
6
6
_apply_qr! (:: AbstractColumnMajor , :: AbstractStridedLayout , :: AbstractStridedLayout , A:: AbstractMatrix{T} , τ:: AbstractVector{T} , B:: AbstractVecOrMat{T} ) where T<: BlasComplex =
7
7
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)
9
9
10
- qlf! (A,τ) = _qlf! (MemoryLayout (typeof (A)) ,MemoryLayout (typeof (τ) ),A,τ)
10
+ qlf! (A,τ) = _qlf! (MemoryLayout (A) ,MemoryLayout (τ ),A,τ)
11
11
_qlf! (:: AbstractColumnMajor ,:: AbstractStridedLayout ,A:: AbstractMatrix{T} ,τ:: AbstractVector{T} ) where T<: BlasFloat =
12
12
LAPACK. geqlf! (A,τ)
13
13
_apply_ql! (:: AbstractColumnMajor , :: AbstractStridedLayout , :: AbstractStridedLayout , A:: AbstractMatrix{T} , τ:: AbstractVector{T} , B:: AbstractVecOrMat{T} ) where T<: BlasReal =
14
14
LAPACK. ormql! (' L' ,' T' ,A,τ,B)
15
15
_apply_ql! (:: AbstractColumnMajor , :: AbstractStridedLayout , :: AbstractStridedLayout , A:: AbstractMatrix{T} , τ:: AbstractVector{T} , B:: AbstractVecOrMat{T} ) where T<: BlasComplex =
16
16
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)
18
18
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} )
20
27
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)
28
33
qrf! (V,t)
29
34
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 ))
31
36
end
32
37
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,)))
34
45
end
35
46
36
47
function ql! (A:: BlockBandedMatrix{T} ) where T
@@ -57,11 +68,13 @@ function ql!(A::BlockBandedMatrix{T}) where T
57
68
QL (A,τ. blocks)
58
69
end
59
70
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)
61
73
_ql (:: AbstractBlockBandedLayout , _, A) = ql! (BlockBandedMatrix (A, (blockbandwidth (A,1 )+ blockbandwidth (A,2 ),blockbandwidth (A,2 ))))
62
74
_factorize (:: AbstractBlockBandedLayout , _, A) = qr (A)
63
75
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
65
78
Q = parent (adjQ)
66
79
A = Q. factors
67
80
l,u = blockbandwidths (A)
@@ -78,23 +91,22 @@ function lmul!(adjQ::Adjoint{<:Any,<:QRPackedQ{<:Any,<:BlockSkylineMatrix}}, Bin
78
91
end
79
92
Bin
80
93
end
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)
84
96
A = Q. factors
85
97
l,u = blockbandwidths (A)
86
98
N,M = blocksize (A)
87
99
# impose block structure
88
100
ax1 = (axes (A,1 ),)
89
101
τ = PseudoBlockArray (Q. τ, ax1)
90
- B = PseudoBlockArray (Bin , ax1)
102
+ B = PseudoBlockArray (Mul . B , ax1)
91
103
for K = N: - 1 : 1
92
104
KR = Block .(max (1 ,K- u): K)
93
105
V = view (A,KR,Block (K))
94
106
t = view (τ,Block (K))
95
107
apply_ql! (V, t, view (B,KR))
96
108
end
97
- Bin
109
+ Mul . B
98
110
end
99
111
100
112
# avoid LinearALgebra Strided obsession
0 commit comments