Handout 10
Handout 10
Householder Triangularization
QnQn−1 . . . Q1A
is upper-triangular.
IDEA: Each matrix Qk is designed to introduce zeros
below the diagonal in column k while preserving all zeros
previously introduced.
10-2
Here is a 5 × 3 example:
× × × × × ×
× × × 0 × ×
Q1
× × × 0 × ×
× × × −→ 0 × ×
× × × 0 × ×
× × × × × ×
× × × ×
Q2
× × 0 ×
−→
× × 0 ×
× × 0 ×
× × × × × ×
× × × ×
Q3
× ×
−→
× 0
× 0
10-3
Thus,
QnQn−1 . . . Q1A = R
is upper-triangular.
Householder reflectors
We now investigate the construction of the Qk .
Each Qk is chosen to be an orthogonal matrix of the form
' (
I 0
Qk =
0 F
where
I is (k − 1) × (k − 1)
F is (m − k + 1) × (m − k + 1) and orthogonal
Hence,
2vv T
F =I− T
v v
so that the only difference between the full rank and or-
thogonal F and the rank (m − 1) and orthogonal P is
the factor of 2.
10-6
!
v = −sgn(x1)%x%e1 − x
10-7
where x1 is the first component of x and
+
+1 if x1 ≥ 0
sgn(x1) =
−1 otherwise
10-8
ALGORITHM 10.1: HOUSEHOLDER QR FACTOR-
IZATION
for k = 1 to n do
x = A(k : m, k)
vk = sgn(x1)%x%2e1 + x % This is −v, but
% that doesn’t matter
vk = %vvk%2
k
A(k : m, k : n) = A(k : m, k : n)
−2vk vkT A(k : m, k : n)
end for
Applying or forming Q
This algorithm reduces A to upper triangular form (the
“R” in the QR factorization).
The “Q” of this factorization (or even the Q̂) has not
been constructed.
The reason is that this takes additional work!
Quite often we do not need Q anyway, only its effect on
some vector
i.e., we only need the product Qx or QT x.
For this we note
QT = QnQn−1 . . . Q1
and
Q = Q1Q2 . . . Qn
10-9
(why?)
e.g. To solve Ax = b by QR factorization, we write
QRx = b, then Rx = QT b
→ so the only way we ever need Q is in QT b.
Recall A = QR =⇒ R = QT A
i.e., the same process that reduced A to R is equivalent
to multiplication by QT .
ALGORITHM 10.2: CALCULATION OF QT b
for k = 1 to n do
b(k : m) = b(k : m) − 2vk vkT b(k : m)
end for
Similarly, calculation of Qx can be achieved by the same
process reversed.
ALGORITHM 10.3: CALCULATION OF Qx
for k = n downto 1 do
x(k : m) = x(k : m) − 2vk vkT x(k : m)
end for
Operation count
The work involved in Algorithm 10.1 is dominated by the
inner most loop
A(k : m, j) − 2vk vkT A(k : m, j)
Schematically,
here iswhat is going
on for a 5 × 4 matrix:
× × × × ∗ ∗ ∗ ∗
× × × × 0 ∗ ∗ ∗
× × × × −→ 0 ∗ ∗ ∗
× × × × 0 ∗ ∗ ∗
× × × × 0 ∗ ∗ ∗
original matrix step 1
× × × × × × × ×
∗ ∗ ∗ × × ×
−→
0 ∗
∗ −→ ∗ ∗
0 ∗ ∗ 0 ∗
0 ∗ ∗ 0 ∗
step 2 step 3
× × × ×
× × ×
−→ × ×
∗
0
step 4
At step k, rows 1 to k − 1 are unchanged and columns 1
to k are zero.
So, we do not operate on any of these elements.
10-11
So, at step k, we only operate on (m − k + 1)(n − k) + 1
elements.
∴ operation count
, n .
-
∼ (m − k + 1)(n − k) + 1
k=1
elements * 4 operations/elements
n
-
∼ 4 mn − (m + n + 1)k + k 2
'k=1
2 n(n + 1)
= 4 mn − (m + n + 1) +
2 (
n(n + 1)(2n + 1)
6
' 2 (
mn n3 2 2 3
∼ 4 − = 2mn − n
2 6 3
10-12