Skip to content

Commit 8587bed

Browse files
Juthokshyatt
authored andcommitted
add gla_householder_qr_null
1 parent 0c86324 commit 8587bed

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ext/MatrixAlgebraKitGenericLinearAlgebraExt.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ function MatrixAlgebraKit.qr_compact!(A::AbstractMatrix, QR, alg::GLA_Householde
7272
return _gla_householder_qr!(A, Q, R; alg.kwargs...)
7373
end
7474

75+
function MatrixAlgebraKit.qr_null!(A::AbstractMatrix, N, alg::GLA_HouseholderQR)
76+
check_input(qr_null!, A, N, alg)
77+
return _gla_householder_qr_null!(A, N; alg.kwargs...)
78+
end
79+
7580
function _gla_householder_qr!(A::AbstractMatrix, Q, R; positive = false, blocksize = 1, pivoted = false)
7681
pivoted && throw(ArgumentError("Only pivoted = false implemented for GLA_HouseholderQR."))
7782
(blocksize == 1) || throw(ArgumentError("Only blocksize = 1 implemented for GLA_HouseholderQR."))
@@ -109,6 +114,21 @@ function _gla_householder_qr!(A::AbstractMatrix, Q, R; positive = false, blocksi
109114
return Q, R
110115
end
111116

117+
function _gla_householder_qr_null!(
118+
A::AbstractMatrix, N::AbstractMatrix;
119+
positive = false, blocksize = 1, pivoted = false
120+
)
121+
pivoted && throw(ArgumentError("Only pivoted = false implemented for GLA_HouseholderQR."))
122+
(blocksize == 1) || throw(ArgumentError("Only blocksize = 1 implemented for GLA_HouseholderQR."))
123+
m, n = size(A)
124+
minmn = min(m, n)
125+
fill!(N, zero(eltype(N)))
126+
one!(view(N, (minmn + 1):m, 1:(m - minmn)))
127+
Q̃, = qr!(A)
128+
lmul!(Q̃, N)
129+
return N
130+
end
131+
112132
function MatrixAlgebraKit.default_lq_algorithm(::Type{T}; kwargs...) where {T <: StridedMatrix{<:Union{Float16, ComplexF16, BigFloat, Complex{BigFloat}}}}
113133
return MatrixAlgebraKit.LQViaTransposedQR(GLA_HouseholderQR(; kwargs...))
114134
end

0 commit comments

Comments
 (0)