Professional Documents
Culture Documents
Solving Linear Systems: Iterative Methods and Sparse Systems
Solving Linear Systems: Iterative Methods and Sparse Systems
Solving Linear Systems: Iterative Methods and Sparse Systems
COS 323
Direct vs. Iterative Methods
A* A uv T A(I A 1uv T )
A
* 1
(I A 1uv T ) 1 A 1
Let x A 1uv T
Note that x 2 A 1u v T A 1u v T
Scalar! Call it
x 2 A 1uv T A 1uv T x
Sherman-Morrison Formula
x2 x
x I x x 1
x
x I x 0
1
x
Ix I x I
1
x
I I x I
1
x
I x
1
I
1
A 1uv T A 1
A * 1
A 1
1 v T A 1u
Sherman-Morrison Formula
1 1
T
* 1 A u v A b
x A b A 1b
1 v T A 1u
So, to solve A* x b,
z vT y
solve Ay b, Az u , x y
1 vT z
Applying Sherman-Morrison
a11
11
a12
12 16
a16
• Let’s consider a21
a22
22
a23
23
a32 a33 a34
xb
cyclic tridiagonal again:
32 33 34
a43 a44 a45
43 44 45
a54
54
a55
55
a56
56
a61
61
a65 a66
66
a1111 1 a12
12 1 1
a21 21
a22
22
a23
23
a32 a33 a34
• Take A
32 33
a43
34
a44 a45
, u , v
43 45
a54
54
a55
55
a56
56
a65
65
a66
66
a 61 a
61 16
16 a
61
61 a16
16
Applying Sherman-Morrison
• Three arrays
– Values: actual numbers in the matrix
– Cols: column of corresponding entry in values
– Rows: index of first entry in each row
– Example: (zero-based)
0 3 2 3
values 3 2 3 2 5 1 2 3
2 0 0 5
0 cols 1 2 3 0 3 1 2 3
0 0 0
rows 0 3 5 5 8
0 1 2 3
Compressed Sparse Row Format
0 3 2 3
values 32325123
2 0 0 5
0 0 0 0 cols 12303123
0 1 2 3 rows 03558
• Multiplying Ax:
Solve Ax=b
Minimize f(x) = xTAx – 2bTx
ax = b
Solving Sparse Systems
• Preferred method:
conjugate gradients
• Recall: plain gradient
descent has a problem…
Solving Sparse Systems
• … that’s solved by
conjugate gradients
k
g kT g k
Solving Sparse Systems
f ( x) x T A x 2b T x
f ( x) 2 Ax b
dt
d Ax b
T
t min i T i
di Adi
xi 1 xi t min d i
Solving Sparse Systems