Previous Up Next

2.48.2  QR decomposition : qr

qr takes as argument a numeric square matrix A of size n.
qr factorizes numerically this matrix as Q*R where Q is an orthogonal matrix (tQ*Q=I) and R is an upper triangular matrix. qr(A) returns only R, run Q=A*inv(R) to get Q.
Input :

qr([[3,5],[4,5]])

Output is the matrix R :

[[-5,-7],[0,-1]]

Input :

qr([[1,2],[3,4]])

Output is the matrix R :

[[-3.16227766017,-4.42718872424],[0,-0.632455532034]]

Previous Up Next