Skip to content

Commit

Permalink
Fix for #48911
Browse files Browse the repository at this point in the history
1. Fix output permutation when A.P is not the identity matrix.
2. Fix the application of the elementary transformation (correct complex conjugation) to the solution as per LAPACK zlarzb https://netlib.org/lapack/explore-html/d5/ddd/zlarzb_8f_source.html
3. Align the final permutation with LAPACK's ZGELSY at https://netlib.org/lapack/explore-html/d8/d6e/zgelsy_8f_source.html
4. Fix a complex conjugate bug in the original solution for #48911, align with LAPACK zlarzb, https://netlib.org/lapack/explore-html/d5/ddd/zlarzb_8f_source.html
5. Improve permutation performance
  • Loading branch information
aravindh-krishnamoorthy committed Apr 27, 2023
1 parent bc2fa50 commit 53bf195
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions stdlib/LinearAlgebra/src/qr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -601,19 +601,20 @@ function _wide_qr_ldiv!(A::QR{T}, B::AbstractMatrix{T}) where T
B[m + 1:mB,1:nB] .= zero(T)
for j = 1:nB
for k = 1:m
vBj = B[k,j]
vBj = B[k,j]'
for i = m + 1:n
vBj += B[i,j]*R[k,i]'
vBj += B[i,j]'*R[k,i]'
end
vBj *= τ[k]
B[k,j] -= vBj
B[k,j] -= vBj'
for i = m + 1:n
B[i,j] -= R[k,i]*vBj
B[i,j] -= R[k,i]'*vBj'
end
end
end
end
end
B[A.p,:] = B[1:n,:]
return B
end

Expand Down

0 comments on commit 53bf195

Please sign in to comment.