119119
120120function householder_qr! (
121121 driver:: Union{LAPACK, CUSOLVER, ROCSOLVER} , A:: AbstractMatrix , Q:: AbstractMatrix , R:: AbstractMatrix ;
122- positive = true , pivoted = false ,
123- blocksize = ((driver != = LAPACK () || pivoted || A === Q) ? 1 : YALAPACK. default_qr_blocksize (A))
122+ positive:: Bool = true , pivoted:: Bool = false ,
123+ blocksize:: Int = ((driver != = LAPACK () || pivoted || A === Q) ? 1 : YALAPACK. default_qr_blocksize (A))
124124 )
125125 # error messages for disallowing driver - setting combinations
126126 (blocksize == 1 || driver === LAPACK ()) ||
@@ -160,7 +160,6 @@ function householder_qr!(
160160 end
161161 end
162162
163-
164163 if positive # already fix Q even if we do not need R
165164 if driver === LAPACK ()
166165 @inbounds for j in 1 : minmn
@@ -201,9 +200,16 @@ function householder_qr!(
201200 return Q, R
202201end
203202function householder_qr! (
204- :: Native , A:: AbstractMatrix , Q:: AbstractMatrix , R:: AbstractMatrix ;
205- positive:: Bool = true # always true regardless of setting
203+ driver :: Native , A:: AbstractMatrix , Q:: AbstractMatrix , R:: AbstractMatrix ;
204+ positive:: Bool = true , pivoted :: Bool = false , blocksize :: Int = 1
206205 )
206+ # error messages for disallowing driver - setting combinations
207+ blocksize == 1 ||
208+ throw (ArgumentError (lazy " $driver does not provide a blocked QR decomposition" ))
209+ pivoted &&
210+ throw (ArgumentError (lazy " $driver does not provide a pivoted QR decomposition" ))
211+ # positive = true regardless of setting
212+
207213 m, n = size (A)
208214 minmn = min (m, n)
209215 @inbounds for j in 1 : minmn
238244
239245function householder_qr_null! (
240246 driver:: Union{LAPACK, CUSOLVER, ROCSOLVER} , A:: AbstractMatrix , N:: AbstractMatrix ;
241- positive = true , pivoted = false ,
242- blocksize = ((driver != = LAPACK () || pivoted) ? 1 : YALAPACK. default_qr_blocksize (A))
247+ positive:: Bool = true , pivoted:: Bool = false ,
248+ blocksize:: Int = ((driver != = LAPACK () || pivoted) ? 1 : YALAPACK. default_qr_blocksize (A))
243249 )
244250 # error messages for disallowing driver - setting combinations
245251 (blocksize == 1 || driver === LAPACK ()) ||
@@ -265,20 +271,28 @@ function householder_qr_null!(
265271 return N
266272end
267273function householder_qr_null! (
268- :: Native , A:: AbstractMatrix , N:: AbstractMatrix ;
269- positive:: Bool = true
274+ driver :: Native , A:: AbstractMatrix , N:: AbstractMatrix ;
275+ positive:: Bool = true , pivoted :: Bool = false , blocksize :: Int = 1
270276 )
277+ # error messages for disallowing driver - setting combinations
278+ blocksize == 1 ||
279+ throw (ArgumentError (lazy " $driver does not provide a blocked QR decomposition" ))
280+ pivoted &&
281+ throw (ArgumentError (lazy " $driver does not provide a pivoted QR decomposition" ))
282+
271283 m, n = size (A)
272284 minmn = min (m, n)
285+
273286 @inbounds for j in 1 : minmn
274287 β, v, ν = _householder! (view (A, j: m, j), 1 )
275288 H = HouseholderReflection (β, v, j: m)
276289 lmul! (H, A; cols = (j + 1 ): n)
277- # A[j,j] == 1; store β instead
290+ # A[j, j] == 1; store β instead
278291 A[j, j] = β
279292 end
293+
280294 # build N
281- fill ! (N, zero ( eltype (N)) )
295+ zero ! (N)
282296 one! (view (N, (minmn + 1 ): m, 1 : (m - minmn)))
283297 @inbounds for j in minmn: - 1 : 1
284298 β = A[j, j]
0 commit comments