Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

np.linalg.qr(A) or scipy.linalg.orth(A) for finding the orthogonal basis (python)

If I have a vector space spanned by five vectors v1....v5, to find the orthogonal basis for A where A=[v1,v2...v5] and A is 5Xn

should I use np.linalg.qr(A) or scipy.linalg.orth(A)??

Thanks in advance

like image 619
Abrar Avatar asked Oct 29 '25 05:10

Abrar


1 Answers

Note that sp.linalg.orth uses the SVD while np.linalg.qr uses a QR factorization. Both factorizations are obtained via wrappers for LAPACK functions.

I don't think there is a strong preference for one over the other. The SVD will be slightly more stable but also a bit slower to compute. In practice I don't think you will really see much of a difference.

like image 198
tch Avatar answered Oct 31 '25 13:10

tch