@@ -3,20 +3,20 @@ _thin_must_hold(thin) =
3
3
import Base. qr
4
4
5
5
6
+ """
7
+ qr(A::StaticMatrix, pivot=Val{false}; thin=true) -> Q, R, [p]
8
+
9
+ Compute the QR factorization of `A` such that `A = Q*R` or `A[:,p] = Q*R`, see [`qr`](@ref).
10
+ This function is not support `thin=false` keyword option due to type inference instability.
11
+ To use this option call `StaticArrays._qr(Size(A), A, pivot, Val{false})` instead.
12
+ """
6
13
@inline function qr (A:: StaticMatrix , pivot:: Union{Type{Val{false}}, Type{Val{true}}} = Val{false }; thin:: Bool = true )
7
14
_thin_must_hold (thin)
8
- return qr (Size (A), A, pivot, Val{true })
15
+ return _qr (Size (A), A, pivot, Val{true })
9
16
end
10
17
11
18
12
- """
13
- qr(Size(A), A::StaticMatrix, pivot=Val{false}, thin=Val{true}) -> Q, R, [p]
14
-
15
- Compute the QR factorization of `A` such that `A = Q*R` or `A[:,p] = Q*R`, see [`qr`](@ref).
16
- This function is exported to allow bypass the type instability problem in base `qr` function
17
- with keyword `thin` parameter in the interface.
18
- """
19
- @generated function qr (:: Size{sA} , A:: StaticMatrix{<:Any, <:Any, TA} , pivot:: Union{Type{Val{false}}, Type{Val{true}}} = Val{false }, thin:: Union{Type{Val{false}}, Type{Val{true}}} = Val{true }) where {sA, TA}
19
+ @generated function _qr (:: Size{sA} , A:: StaticMatrix{<:Any, <:Any, TA} , pivot:: Union{Type{Val{false}}, Type{Val{true}}} = Val{false }, thin:: Union{Type{Val{false}}, Type{Val{true}}} = Val{true }) where {sA, TA}
20
20
21
21
isthin = thin <: Type{Val{true}}
22
22
@@ -36,7 +36,7 @@ with keyword `thin` parameter in the interface.
36
36
if (sA[1 ]* sA[1 ] + sA[1 ]* sA[2 ])÷ 2 * diagsize (Size (A)) < 17 * 17 * 17
37
37
return quote
38
38
@_inline_meta
39
- return qr_unrolled (Size (A), A, thin)
39
+ return qr_unrolled (Size (A), A, pivot, thin)
40
40
end
41
41
else
42
42
return quote
58
58
# in the case of `thin=false` Q is full, but R is still reduced, see [`qr`](@ref).
59
59
#
60
60
# For original source code see below.
61
- @generated function qr_unrolled (:: Size{sA} , A:: StaticMatrix{<:Any, <:Any, TA} , thin:: Union{Type{Val{false}},Type{Val{true}}} = Val{true }) where {sA, TA}
61
+ @generated function qr_unrolled (:: Size{sA} , A:: StaticMatrix{<:Any, <:Any, TA} , pivot :: Type{Val{false}} , thin:: Union{Type{Val{false}},Type{Val{true}}} = Val{true }) where {sA, TA}
62
62
m, n = sA[1 ], sA[2 ]
63
63
64
64
Q = [Symbol (" Q_$(i) _$(j) " ) for i = 1 : m, j = 1 : m]
0 commit comments