MIR2012 Lec1
MIR2012 Lec1
MIR2012 Lec1
Term II – 2012
Computer pseudo-code:
Computational Complexity:
Flop Count and Order of Complexity
Real numbers are normally stored in computers in a
floating-point format.
Arithmetic operations that a computer performs on
these numbers are called floating-point operations (flops)
Example: Update
1 Multiplication + 1 Addition = 2 flops
Matrix-vector multiplication : 2 nm flops or O(nm)
For nxn matrix (n1) vector: O(n2) operation
Doubling problem size quadruples effort to solve
Matrix-Matrix Multiplication
If A is an nm matrix, and X is mp, we can form the
product B = AX, which is np such that,
Pseudo-code:
2mnp flops
Examples:
2-norm: Euclidean distance
1-norm: (taxicab norm or Manhattan norm)
-norm:
Vector Norm
Example:
draw the circles defined by the following equations: ||x||1= 1 ,
||x||2= 1 , ||x||= 1
y
-1 1 x
-1
Matrix Norm
A matrix norm is a function that assigns to each Anxn a
real number ||A|| such that:
Theoretically important
Expensive to compute
Frobenius norm is NOT the matrix 2-norm (=max eigenvalue)
Theorem:
Examples:
Condition Number
Consider a linear system equation and its perturbation:
Then, or
Hence,
Also,
Combining equations:
Determinant = 1
Condition number = 1 (ideal)
Orthogonal transformations preserve length
Orthogonal transformations preserve angle
Example: rotators and reflectors
QR Decomposition
Any nxn matrix A can be decomposed as a product QR
where Q is an orthogonal matrix and R is an upper
triangular matrix
Solution of Ax=b is again straightforward:
QRx=b
Let Rx= y and solve Qy=b (solution is simply y= QTb)
Then solve triangular system Rx=y as before
Advantage of QR solution: excellent numerical stability
Overdetermined case (A is nxm with n>m): QR
decomposition is still possible with :
Singular Value Decomposition (SVD)
Let A be an nxm nonzero matrix with rank r. Then A can
be expressed as a product:
Where:
U is an nxn orthogonal matrix
V is an mxm orthogonal matrix
is an nxm diagonal matrix of singular values in the form:
Solution of Least Squares Using SVD
Condition number can be shown to be equal to:
http://en.wikipedia.org/wiki/Conjugate_gradient_method
Conjugate Gradient (CG) Method
To compute the coefficients:
http://en.wikipedia.org/wiki/Conjugate_gradient_method
Iterative Conjugate Gradient Method
Need to solve systems where n
is so large
Direct method take too much time
Careful choice of directions
Start with Ax-b as p0
Takes a few iterations to reach
reasonable accuracy
In all above problems involving linear system solution, use the Hilbert matrix as your A matrix, use a
random x vector, compute b=Ax and use A and b to compute as estimate of the x vector then compare it
to what you have to test your system
You can use available Octave/Matlab functions and write your own code for parts that are not available.