steepest decent and conjugate gradients (cg). solving of the linear equation system

68
Steepest Decent and Conjugate Gradients (CG)

Upload: oscar-hancock

Post on 18-Dec-2015

218 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent and Conjugate Gradients (CG)

Page 2: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent and Conjugate Gradients (CG)

• Solving of the linear equation system bAx

Page 3: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent and Conjugate Gradients (CG)

• Solving of the linear equation system

• Problem: dimension n too big, or not enough time for gauss elimination

Iterative methods are used to get an approximate solution.

bAx

Page 4: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent and Conjugate Gradients (CG)

• Solving of the linear equation system

• Problem: dimension n too big, or not enough time for gauss elimination

Iterative methods are used to get an approximate solution.

• Definition Iterative method: given starting point , do steps

hopefully converge to the right solution

bAx

0x,, 21 xx

x

Page 5: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

starting issues

Page 6: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

starting issues

• Solving is equivalent to minimizing bAx cxbAxxxf TT

2

1:)(

Page 7: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

starting issues

• Solving is equivalent to minimizing

• A has to be symmetric positive definite:

bAx cxbAxxxf TT

2

1:)(

00 xAxxAA TT

Page 8: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

starting issues

• 02

1

2

1)(

!

bAxbAxxAxfsymmetricA

T

Page 9: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

starting issues

• If A is also positive definite the solution of is the minimum

02

1

2

1)(

!

bAxbAxxAxfsymmetricA

T

bAx

Page 10: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

starting issues

• If A is also positive definite the solution of is the minimum

02

1

2

1)(

!

bAxbAxxAxfsymmetricA

T

bAx

00

11

2

1

2

1)(

d

TT AddcbAbdbAf

Page 11: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

starting issues

• error:

The norm of the error shows how far we are away from the exact solution, but can’t be computed without knowing of the exact solution .

xxe ii :

x

Page 12: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

starting issues

• error:

The norm of the error shows how far we are away from the exact solution, but can’t be computed without knowing of the exact solution .

• residual:

can be calculated

xxe ii :

x)(: xfAeAxbr iii

Page 13: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent

Page 14: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent

• We are at the point . How do we reach ?ix 1ix

Page 15: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent

• We are at the point . How do we reach ?

• Idea: go into the direction in which decreases most quickly ( )

ix 1ix

)(xf

ii rxf )(

Page 16: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent

• We are at the point . How do we reach ?

• Idea: go into the direction in which decreases most quickly ( )

• how far should we go?

ix 1ix

)(xf

ii rxf )(

Page 17: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent

• We are at the point . How do we reach ?

• Idea: go into the direction in which decreases most quickly ( )

• how far should we go?

Choose so that is minimized:

ix 1ix

)(xf

ii rxf )(

)( ii rxf

Page 18: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent

• We are at the point . How do we reach ?

• Idea: go into the direction in which decreases most quickly ( )

• how far should we go?

Choose so that is minimized:

ix 1ix

)(xf

ii rxf )(

)( ii rxf

0)( ii rxfd

d

Page 19: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent

• We are at the point . How do we reach ?

• Idea: go into the direction in which decreases most quickly ( )

• how far should we go?

Choose so that is minimized:

ix 1ix

)(xf

ii rxf )(

)( ii rxf

0)( ii rxfd

d

0)( iT

ii rrxf

Page 20: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent

• We are at the point . How do we reach ?

• Idea: go into the direction in which decreases most quickly ( )

• how far should we go?

Choose so that is minimized:

ix 1ix

)(xf

ii rxf )(

)( ii rxf

0)( ii rxfd

d

0)( iT

ii rrxf

0))(( iT

ii rbrxA

Page 21: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent

• We are at the point . How do we reach ?

• Idea: go into the direction in which decreases most quickly ( )

• how far should we go?

Choose so that is minimized:

ix 1ix

)(xf

ii rxf )(

)( ii rxf

0)( ii rxfd

d

0)( iT

ii rrxf

0))(( iT

ii rbrxA

iT

r

iiT

i rAxbrAr

i

)()(

Page 22: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent

• We are at the point . How do we reach ?

• Idea: go into the direction in which decreases most quickly ( )

• how far should we go?

Choose so that is minimized:

ix 1ix

)(xf

ii rxf )(

)( ii rxf

0)( ii rxfd

d

0)( iT

ii rrxf

0))(( iT

ii rbrxA

iT

r

iiT

i rAxbrAr

i

)()( i

Ti

iTi

Arr

rr

Page 23: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent

one step of steepest decent can be calculated as follows:

iiii

Ti

iTi

i

ii

rxx

Arr

rr

Axbr

1

Page 24: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent

one step of steepest decent can be calculated as follows:

• stopping criterion: or with an given small

It would be better to use the error instead of the residual, but you can’t calculate the error.

iiii

Ti

iTi

i

ii

rxx

Arr

rr

Axbr

1

maxii 0rri

Page 25: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent

Method of steepest decent:

1

)(

0

00max

0

0

ii

Axbr

rxxArr

rr

rrrrandiiwhile

rr

Axbr

i

T

T

TT

Page 26: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent

• As you can see the starting point is important!

Page 27: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent

• As you can see the starting point is important!

When you know anything about the solution use it to guess a good starting point. Otherwise you can choose a starting point you want e.g. .00 x

Page 28: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent - Convergence

Page 29: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent - Convergence

• Definition energy norm: Axxx T

A:

Page 30: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent - Convergence

• Definition energy norm:

• Definition condition:

( is the largest and the smallest eigenvalue of A)

Axxx T

A:

min

max:

max min

Page 31: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Steepest Decent - Convergence

• Definition energy norm:

• Definition condition:

( is the largest and the smallest eigenvalue of A)

convergence gets worse when the condition gets larger

Axxx T

A:

min

max:

max min

A

i

Aiee 01

1

Page 32: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

Page 33: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• is there a better direction?

Page 34: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• is there a better direction?

• Idea: orthogonal search directions110 ,,, nddd

Page 35: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• is there a better direction?

• Idea: orthogonal search directions110 ,,, nddd

1

0

n

iiidx

Page 36: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• is there a better direction?

• Idea: orthogonal search directions

• only walk once in each direction and minimize

110 ,,, nddd

1

0

n

iiidx

Page 37: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• is there a better direction?

• Idea: orthogonal search directions

• only walk once in each direction and minimize

maximal n steps are needed to reach the exact solution

110 ,,, nddd

1

0

n

iiidx

Page 38: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• is there a better direction?

• Idea: orthogonal search directions

• only walk once in each direction and minimize

maximal n steps are needed to reach the exact solution

has to be orthogonal to

110 ,,, nddd

1

0

n

iiidx

1 ie id

Page 39: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• example with the coordinate axes as orthogonal search directions:

Page 40: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• example with the coordinate axes as orthogonal search directions:

Problem: can’t be computed

because

(you don’t know !)

iTi

iTi

idd

ed

ie

Page 41: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• new idea: A-orthogonal110 ,,, nddd

Page 42: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• new idea: A-orthogonal

• Definition A-orthogonal: A-orthogonal

(reminder: orthogonal: )

110 ,,, nddd

ji dd , 0 jTi Add

ji dd , 0 jTi dd

Page 43: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• new idea: A-orthogonal

• Definition A-orthogonal: A-orthogonal

(reminder: orthogonal: )

• now has to be A-orthogonal to

110 ,,, nddd

ji dd , 0 jTi Add

ji dd , 0 jTi dd

1ie id

Page 44: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• new idea: A-orthogonal

• Definition A-orthogonal: A-orthogonal

(reminder: orthogonal: )

• now has to be A-orthogonal to

110 ,,, nddd

ji dd , 0 jTi Add

ji dd , 0 jTi dd

1ie id

iTi

iTi

iTi

iTi

i Add

rd

Add

Aed

Page 45: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• new idea: A-orthogonal

• Definition A-orthogonal: A-orthogonal

(reminder: orthogonal: )

• now has to be A-orthogonal to

can be computed!

110 ,,, nddd

ji dd , 0 jTi Add

ji dd , 0 jTi dd

1ie id

iTi

iTi

iTi

iTi

i Add

rd

Add

Aed

Page 46: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• A set of A-orthogonal directions can be found with n linearly independent vectors and conjugate Gram-Schmidt (same idea as Gram-Schmidt).

iu

Page 47: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• Gram-Schmidt:

linearly independent vectors10 ,, nuu

Page 48: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• Gram-Schmidt:

linearly independent vectors10 ,, nuu

jTj

jTi

ij

i

jjijii

dd

du

dudi

ud

1

0

00

:0

Page 49: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• Gram-Schmidt:

linearly independent vectors

• conjugate Gram-Schmidt:

10 ,, nuu

jTj

jTi

ij Add

Adu

jTj

jTi

ij

i

jjijii

dd

du

dudi

ud

1

0

00

:0

Page 50: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• A set of A-orthogonal directions can be found with n linearly independent vectors and conjugate Gram-Schmidt (same idea as Gram-Schmidt).

• CG works by setting (makes conjugate Gram-Schmidt easy)

iu

ii ru

Page 51: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• A set of A-orthogonal directions can be found with n linearly independent vectors and conjugate Gram-Schmidt (same idea as Gram-Schmidt).

• CG works by setting (makes conjugate Gram-Schmidt easy)

with1 iiii drd 11

i

Ti

iTi

i rr

rr

ii ru

iu

Page 52: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• 0:1

0

1

n

jkk

Tik

n

jkkk

Tii

Tij

Ti AdddAdAedrdji

Page 53: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

0:1

0

1

n

jkk

Tik

n

jkkk

Tii

Tij

Ti AdddAdAedrdji

1

0

i

kkikii dud

Page 54: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

0:1

0

1

n

jkk

Tik

n

jkkk

Tii

Tij

Ti AdddAdAedrdji

1

0

i

kkikii dud

1

00

0:i

kjk

jTkikj

Tij

Ti rdrurdji

Page 55: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

0:1

0

1

n

jkk

Tik

n

jkkk

Tii

Tij

Ti AdddAdAedrdji

1

0

i

kkikii dud

1

00

0:i

kjk

jTkikj

Tij

Ti rdrurdji

jiru jTi 0

Page 56: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

0:1

0

1

n

jkk

Tik

n

jkkk

Tii

Tij

Ti AdddAdAedrdji

1

0

i

kkikii dud

1

00

0:i

kjk

jTkikj

Tij

Ti rdrurdji

jiru jTi 0

ijjTi

jTiii

rr

jirrru

0:

Page 57: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

0:1

0

1

n

jkk

Tik

n

jkkk

Tii

Tij

Ti AdddAdAedrdji

ijjTi

jTiii

rr

jirrru

0:

iTi

i

kjk

jTkiki

Tii

Ti rurdrurd

1

00

Page 58: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

• jiAdd

Adr

jTj

jTi

ij

Page 59: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

jiAdd

Adr

jTj

jTi

ij

jjjjjjjj AdrdeAAer )(11

Page 60: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

jiAdd

Adr

jTj

jTi

ij

jjjjjjjj AdrdeAAer )(11

jTijj

Tij

Ti Adrrrrr 1

Page 61: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

jiAdd

Adr

jTj

jTi

ij

jjjjjjjj AdrdeAAer )(11

jTijj

Tij

Ti Adrrrrr 1

1 jTij

Tij

Tij rrrrAdr

Page 62: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

1 jTij

Tij

Tij rrrrAdr

10

11

jiji

jirr

jirr

Adr

rr

i

iTi

i

iTi

jTi

ijjTi

Page 63: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

10 ji

ij

Page 64: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients

1

10

1111111

jirr

rr

rd

rr

Add

rrji

iTi

iTi

iTi

iTi

def

iTii

iTiij

Page 65: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Method of Conjugate Gradients:

00

0

i

rr

rd

Axbr

1

)( 00max

ii

drd

rr

rr

Axbr

rr

dxxAdd

rr

rrrrandiiwhile

oldTold

T

old

T

T

TT

Page 66: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients - Convergence

Page 67: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients - Convergence

• A

i

Aiee 0

1

12

Page 68: Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system

Conjugate Gradients - Convergence

• for steepest decent for CG

Convergence of CG is much better!

A

i

Aiee 0

1

12