@@ -246,20 +246,23 @@ function qrfactPivotedUnblocked!(A::StridedMatrix)
246
246
end
247
247
248
248
# LAPACK version
249
- qr! (A:: StridedMatrix{<:BlasFloat} , :: Val{false} ) = QRCompactWY (LAPACK. geqrt! (A, min (min (size (A)... ), 36 ))... )
249
+ qr! (A:: StridedMatrix{<:BlasFloat} , :: Val{false} = Val (false ); blocksize= 36 ) =
250
+ QRCompactWY (LAPACK. geqrt! (A, min (min (size (A)... ), blocksize))... )
250
251
qr! (A:: StridedMatrix{<:BlasFloat} , :: Val{true} ) = QRPivoted (LAPACK. geqp3! (A)... )
251
- qr! (A:: StridedMatrix{<:BlasFloat} ) = qr! (A, Val (false ))
252
252
253
253
# Generic fallbacks
254
254
255
255
"""
256
- qr!(A, pivot=Val(false))
256
+ qr!(A, pivot=Val(false); blocksize )
257
257
258
258
`qr!` is the same as [`qr`](@ref) when `A` is a subtype of
259
259
`StridedMatrix`, but saves space by overwriting the input `A`, instead of creating a copy.
260
260
An [`InexactError`](@ref) exception is thrown if the factorization produces a number not
261
261
representable by the element type of `A`, e.g. for integer types.
262
262
263
+ !!! compat "Julia 1.4"
264
+ The `blocksize` keyword argument requires Julia 1.4 or later.
265
+
263
266
# Examples
264
267
```jldoctest
265
268
julia> a = [1. 2.; 3. 4.]
@@ -296,7 +299,7 @@ qr!(A::StridedMatrix) = qr!(A, Val(false))
296
299
_qreltype (:: Type{T} ) where T = typeof (zero (T)/ sqrt (abs2 (one (T))))
297
300
298
301
"""
299
- qr(A, pivot=Val(false)) -> F
302
+ qr(A, pivot=Val(false); blocksize ) -> F
300
303
301
304
Compute the QR factorization of the matrix `A`: an orthogonal (or unitary if `A` is
302
305
complex-valued) matrix `Q`, and an upper triangular matrix `R` such that
@@ -336,6 +339,13 @@ and `F.Q*A` are supported. A `Q` matrix can be converted into a regular matrix w
336
339
`m`×`m` orthogonal matrix, use `F.Q*Matrix(I,m,m)`. If `m<=n`, then `Matrix(F.Q)` yields an `m`×`m`
337
340
orthogonal matrix.
338
341
342
+ The block size for QR decomposition can be specified by keyword argument
343
+ `blocksize :: Integer` when `pivot == Val(false)` and `A isa StridedMatrix{<:BlasFloat}`.
344
+ It is ignored when `blocksize > minimum(size(A))`. See [`QRCompactWY`](@ref).
345
+
346
+ !!! compat "Julia 1.4"
347
+ The `blocksize` keyword argument requires Julia 1.4 or later.
348
+
339
349
# Examples
340
350
```jldoctest
341
351
julia> A = [3.0 -6.0; 4.0 -8.0; 0.0 1.0]
@@ -366,17 +376,11 @@ true
366
376
elementary reflectors, so that the `Q` and `R` matrices can be stored
367
377
compactly rather as two separate dense matrices.
368
378
"""
369
- function qr (A:: AbstractMatrix{T} , arg) where T
370
- require_one_based_indexing (A)
371
- AA = similar (A, _qreltype (T), size (A))
372
- copyto! (AA, A)
373
- return qr! (AA, arg)
374
- end
375
- function qr (A:: AbstractMatrix{T} ) where T
379
+ function qr (A:: AbstractMatrix{T} , arg... ; kwargs... ) where T
376
380
require_one_based_indexing (A)
377
381
AA = similar (A, _qreltype (T), size (A))
378
382
copyto! (AA, A)
379
- return qr! (AA)
383
+ return qr! (AA, arg ... ; kwargs ... )
380
384
end
381
385
qr (x:: Number ) = qr (fill (x,1 ,1 ))
382
386
function qr (v:: AbstractVector )
0 commit comments