Question about QR decomposition
Pixie8888 opened this issue · 3 comments
Hi @Pixie412,
Thanks for your interest in our work!
[1] Trefethen, L. N., & Bau III, D. (1997). Numerical linear algebra (Vol. 50). Siam.
[2] Terao, T., Ozaki, K., & Ogita, T. (2020). LU-Cholesky QR algorithms for thin QR decomposition. Parallel Computing, 92, 102571.
Hi,
Why not using SVD to get the left/right singular vectors as the basis?
Hi @Pixie412,
I am sorry for the late reply, we have missed the notification.
Yes, you can also use SVD to find the same orthogonal projection; they are equivalent. Please see the equivalence in the code below. Please let us know if you have further questions.
Let me also clarify our paper's specific notation: we concatanate our base representations into matrix
As you suggested, reduced left singular matrix,
Test:
julia> using LinearAlgebra
julia> A = randn(512, 64);
julia> function find_projection_with_QR(A)
F = qr(A) # full QR
Qr = F.Q[:, 1:size(A, 2)] # reduced Q
return Qr * transpose(Qr)
end
find_projection_with_QR (generic function with 1 method)
julia> function find_projection_with_SVD(A)
F = svd(A; full=true) # full SVD
Ur = F.U[:, 1:size(A, 2)] # reduced U
return Ur * transpose(Ur)
end
find_projection_with_SVD (generic function with 1 method)
julia> find_projection_with_QR(A) ≈ find_projection_with_SVD(A)
true