Download presentation

Presentation is loading. Please wait.

Published byJohnathan Maul Modified about 1 year ago

1
Chapter 11 Gaussian Elimination (I) Speaker: Lung-Sheng Chien Reference book: David Kincaid, Numerical Analysis

2
OutLine Basic operation of matrix - representation - three elementary matrices Example of Gaussian Elimination (GE) Formal description of GE MATLAB usage

3
Matrix notation in MATLAB

4
x1 x2 x3 x4 6 x1 + (-2) x2 + 2 x3 + 4 x4 12 x1 + (-8) x2 + 6 x x4 3 x1 + (-13) x2 + 9 x3 + 3 x4 (-6) x1 + 4 x2 + 1 x3 + (-18) x x1 x2 x3 x x x x x4 Matrix-vector product Inner-product based outer-product based

5
Inner-product based outer-product based Matrix-vector product: MATLAB implementation matvec.m Question: which one is better

6
Logical index : 2D physical index : 1D Column-major nature in MATLAB Question: how does column-major affect inner-product based matrix-vector product and outer-product based matrix-vector product?

7
is outer-product representationwhere Matrix representation: outer-product

8
Elementary matrix [1] (1) The interchange of two rows in A: Define permutation matrix Question 1: whyQuestion 2: how to easily obtain How to explain?

9
Question: such that implies Direct calculation Concatenation of permutation matrices

10
(2) Multiplying one row by a nonzero constant: Elementary matrix [2] Define scaling matrix How to explain? since

11
(3) Adding to one row a multiple of another: Elementary matrix [3] Define GE (Gaussian Elimination) matrix How to explain? outer-product representation

12
Use MATLAB notation

13
such that Concatenation of GE matrices Suppose Question:

14
OutLine Basic operation of matrix Example of Gaussian Elimination (GE) - forward elimination to upper triangle form - backward substitution Formal description of GE MATLAB usage

15
x1 x2 x3 x x1 x2 x3 x x1 x2 x3 x

16
x1 x2 x3 x x1 x2 x3 x First row does not change thereafter x1 x2 x3 x

17
x1 x2 x3 x x1 x2 x3 x x1 x2 x3 x

18
x1 x2 x3 x x1 x2 x3 x x1 x2 x3 x x1 x2 x3 x4 12 Backward substitution: inner-product-based

19
x1 x2 x3 x x1 x2 x x x1 x2 x x1 x2 126 Backward substitution: outer-product-based

20
OutLine Basic operation of matrix Example of Gaussian Elimination (GE) Formal description of GE - component-wise and column-wise representation - recursive structure MATLAB usage

21
x1 x2 x3 x x1 x2 x3 x x1 x2 x3 x x1 x2 x3 x

22
x1 x2 x3 x x1 x2 x3 x Exercise: checkby MATLAB Eliminate first column: component-wise where

23
Exercise: check by MATLAB Eliminate first column: column-wise defineand then Notation:

24
x1 x2 x3 x x1 x2 x3 x x1 x2 x3 x Eliminate second column: component-wise

25
define Exercise: check, why? Give a simple explanation. Notation: Eliminate second column: column-wise

26
x1 x2 x3 x x1 x2 x3 x Eliminate third column: component-wise define then

27
Notation: Exercise: check LU-decomposition Question: Do you have any effective method to write down matrix LU-decomposition Question: why don’t we care about right hand side vector

28
Question 3: How to measure “goodness of LU-decomposition“? Question 2: does any invertible matrix has LU-decomposition? Question 4: what is order of performance of LU-decomposition (operation count)? Question 5: How to parallelize LU-decomposition? Question 6: How to implement LU-decomposition with help of GPU? Problems about LU-decomposition Question 1: what condition does LU-decomposition fail?

29
OutLine Basic operation of matrix Example of Gaussian Elimination (GE) Formal description of GE MATLAB usage - website resource - “help” command - M-file

30
MATLAB website

31
MATLAB: create matrix

32
MATLAB: LU-factorization

33
Start MATLAB 2008

34
Command “help” : documentation != in C

35
Loop in MATLAB

36
Decision-making in MATLAB

37
IO in MATLAB

38
LU-factorization in MATLAB

39
Inner-product based matvec.m M-file in MATLAB Description of function matvec, write specificaiton of input parameter Consistency check

40
Move to working directory working directory M-file

41
Execute M-file Construct matrix Execute M-file, like function call in C-language

42
Forward substitutionsince backward substitutionsince Write MATLAB code to do forward substitution and backward substitution Exercise: forward / backward substitution

43
LU-decomposition Exercise: LU-decomposition You should find recursive structure of the decomposition

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google