Python Lab 6: Gram--Schmidt and QR factorization
Open 06_Gram_Schmidt_QR.ipynb and enter k=$k.
Apply Gram--Schmidt to the columns of
A=\begin{bmatrix}1 & 1\\1 & 0\\0 & $k\end{bmatrix}
=\begin{bmatrix}a_1 & a_2\end{bmatrix}.
-
Compute q_1=a_1/\lVert a_1\rVert. Its first component is
first component of q one
and its third component is
third component of q one
.
$q1First=1/sqrt(2) and $q1Third=0
-
Let u_2=a_2-(q_1^Ta_2)q_1. To avoid fractions, enter
the components of 2u_2. First component:
first component of twice u two
; second component:
second component of twice u two
; third component:
third component of twice u two
.
$u21=1 and $u22=-1 and $u23=$twiceU2Third
-
In A=QR, compute
r_{12}=q_1^Ta_2=
entry r one two
and
r_{22}=\lVert u_2\rVert=
entry r two two
.
$r12Input=$rTwelve and $r22Input=$rTwentyTwo
-
Which calculation verifies that the columns of Q are orthonormal?
matrix test for orthonormal columns
Q^TQ=I
Q+Q^T=I
Q^2=0
QQ^T=0
$orthChoice.selectedIndex=1
-
NumPy's qr routine may return columns with signs opposite
to your hand calculation. Why can both results be correct?
reason QR signs can differ
QR factorization is invalid for rectangular matrices.
Changing a column of Q and the corresponding row of R by the same sign preserves QR.
NumPy ignores negative entries.
The columns of Q do not need to be orthogonal.
$signChoice.selectedIndex=2