Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion base/linalg/factorization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ function qrfact!{T}(A::AbstractMatrix{T}, pivot::Union(Type{Val{false}}, Type{Va
end
QR(A, τ)
end
qrfact!{T<:BlasFloat}(A::StridedMatrix{T}, pivot::Union(Type{Val{false}}, Type{Val{true}})=Val{false}) = pivot==Val{true} ? QRPivoted(LAPACK.geqp3!(A)...) : QRCompactWY(LAPACK.geqrt!(A, min(minimum(size(A)), 36))...)
qrfact!{T<:BlasFloat}(A::StridedMatrix{T}, pivot::Type{Val{false}} = Val{false}) = QRCompactWY(LAPACK.geqrt!(A, min(minimum(size(A)), 36))...)
qrfact!{T<:BlasFloat}(A::StridedMatrix{T}, pivot::Type{Val{true}}) = QRPivoted(LAPACK.geqp3!(A)...)
qrfact{T<:BlasFloat}(A::StridedMatrix{T}, pivot::Union(Type{Val{false}}, Type{Val{true}})=Val{false}) = qrfact!(copy(A), pivot)
copy_oftype{T}(A::StridedMatrix{T}, ::Type{T}) = copy(A)
copy_oftype{T,S}(A::StridedMatrix{T}, ::Type{S}) = convert(AbstractMatrix{S}, A)
Expand Down
8 changes: 6 additions & 2 deletions test/linalg1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ debug && println("Bunch-Kaufman factors of a pos-def matrix")
debug && println("QR decomposition (without pivoting)")
for i = 1:2
let a = i == 1 ? a : sub(a, 1:n - 1, 1:n - 1), b = i == 1 ? b : sub(b, 1:n - 1), n = i == 1 ? n : n - 1
qra = qrfact(a, Val{false})
@inferred qrfact(a)
if eltya <: BlasFloat
@inferred qrfact(a, Val{true})
end
qra = @inferred qrfact(a, Val{false})
q, r = qra[:Q], qra[:R]
@test_approx_eq q'*full(q, thin = false) eye(n)
@test_approx_eq q*full(q, thin = false)' eye(n)
Expand All @@ -68,7 +72,7 @@ debug && println("QR decomposition (without pivoting)")
@test_approx_eq full(qra) a

debug && println("Thin QR decomposition (without pivoting)")
qra = qrfact(a[:,1:n1], Val{false})
qra = @inferred qrfact(a[:,1:n1], Val{false})
q,r = qra[:Q], qra[:R]
@test_approx_eq q'*full(q, thin=false) eye(n)
@test_approx_eq q'*full(q) eye(n, n1)
Expand Down