Cheating
Cheating
e⊤
i A
(1)
= e⊤ ⊤
i A − ℓi1 e1 A, 1 ≤ i ≤ 4, li1 = ai1 /a11
ℓ41
In this way,
e⊤
i A
(1)
= e⊤ (1) ⊤ ⊤
i (A − ℓ e1 A) = ei M1 A
M1 = I − ℓ(1) e⊤
1.
1
× × × ×
· + + +
A(1) = M1 A =
·
.
+ + +
· + + +
Here, we have introduced the convention that × indicates an entry unchanged
from the previous step, whereas + indicates an entry that has possibly changed.
Entries that must be zero are indicated by a dot (·). It might happen that
some of the × and + are also zero.
Let
M̂1 = I − ℓ̂1 e⊤
1
produces
× × × ×
· + + +
A(1) = M̂1 P1 A =
·
.
+ + +
· + + +
2
In the second step, suppose that
(1) (1)
|a42 | = max |ai2 |,
2≤i≤4
giving
3
Proof.
For any matrix A ∈ Rn×n ,
n n
! n n
!
X X X X
(Ax) · y = aij xj yi = xj aij yi = x · (A⊤ y).
i=1 j=1 j=1 i=1
v = λ(x − y)
H = I − 2v̂v̂⊤
y = Hx and x = Hy.
4
and define w ∈ Rm by
ai ,
if 1 ≤ i ≤ j − 1,
wi = −σ∥aj:m ∥, if i = j,
0, if j + 1 ≤ i ≤ m,
so that
j−1
X m
X
2 2 2
∥w∥ = |ai | + ∥aj:m ∥ = |ai |2 = ∥a∥2 .
i=1 i=1
5
If Q = [Q1 Q2 ] with Q1 ∈ Rm×n and Q2 ∈ Rm×(m−n) , and
R1
R= with R1 ∈ Rn×n and 0 ∈ R(m−n)×n .
0
Since QR = Q1 R1 + Q2 0 = Q1 R1 , we obtain the reduced QR-factorisation,
A = Q1 R1 .
A vector x ∈ Rn is a least-squares solution of (3) iff
6
where 1 ≤ p < q ≤ n and c2 + s2 = 1.
Given a ∈ Rn , we can choose G so that b = Ga satisfies
q
bp = a2p + a2q , bq = 0, bi = ai for i ∈ / {p, q}.
ap −aq
c= q and s = q .
a2p + a2q a2p + a2q
Definition
We say that A = R⊤ R is a Cholesky factorisation if R is upper triangular.
Consider the 3 × 3 case
a11 a12 a13 r11 r12 r13
A = a21
a22 a23 and R = · r22 r23 .
a31 a32 a33 · · r33
We find that
2
r11 r11 r12 r11 r13
R⊤ R = r11 r12 2
r12 2
+ r22 r12 r13 + r22 r23 .
2 2 2
r11 r13 r13 r12 + r23 r22 r13 + r23 + r33
and
j−1
X
2
ajj = (rjj ) + (rkj )2 for 1 ≤ j ≤ n.
k=1
Thus, we require
i−1
!
1 X
rij = aij − rki rkj for 1 ≤ i < j ≤ n,
rii
k=1
and v
u
u j−1
X
rjj = tajj − (rkj )2 for 1 ≤ j ≤ n.
k=1
7
Let A ∈ Rm×n .
1. The upper bandwidth of aij = 0 is the smallest integer U = U(A) such
that
aij = 0 whenever j − i > U.
2. The lower bandwidth of aij = 0 is the smallest integer L = L(A) such that
aij = 0 whenever i − j > L.
Theorem
Let A ∈ Rm×n and B ∈ Rn×p . U(AB) ≤ U(A) + U(B). L(AB) ≤ L(A) +
L(B).
Theorem
Assume that A ∈ Rn×n has the LU-factorisation A = LU (with no pivoting).
U(U) ≤ U(A). L(L) ≤ L(A).
We can use the LAPACK band storage scheme to store A in an (L+1+U)×n
array AB by setting
AB[U + 1 + i − j, j] = aij
for max(1, j − U) ≤ i ≤ min(m, j + L).
Again with n = 5, L = 2 and U = 1, the band LU-factorisation can be
re-written so that it overwrites A with
∗ u12 u23 u34 u45
u11 u22 u33 u44 u55
ℓ21 ℓ32 ℓ43 ℓ54 ∗
ℓ31 ℓ42 ℓ54 ∗ ∗
Theorem
Suppose that PA = LU is the LU-factorisation of A with pivoting.
U(U) ≤ L(A) + U(A). L(L) ≤ L(A).
Theorem
Let A = QR as above. U(R) ≤ L(A) + U(A). L(Q) ≤ L(A).
Example
Consider once again the matrix
0 −2 1 0 0 −3 0 1
0 1 2 0 −5 1 1 0
A= 1 0 0 −7 0 0 0 3 .
−2 0 1 8 0 3 −1 0
0 5 −6 0 1 0 0 0
8
Storing in CSC format, we have
colptr = [1, 3, 6, 10, 12, 14, 17, 19, 21],
rowval = [3, 4, 1, 2, 5, 1, 2, 4, 5, 3, 4, 2, 5, 1, 2, 4, 2, 4, 1, 3],
nzval= [1, -2, -2, 1, 5, 1, 2, 1, -6, -7, 8, -5, 1, -3, 1, 3, 1, -1, 1, 3].