Docsity

Computational Methods: Matrix-Vector Products, Norms, and Solving Linear Systems - Prof. R, Study notes of Computer Science

Partial preview of the text

Download Computational Methods: Matrix-Vector Products, Norms, and Solving Linear Systems - Prof. R and more Study notes Computer Science in PDF only on Docsity!

Computational Methods CMSC/AMSC/MAPL 460

Vectors, Matrices, Linear Systems, LU

Decomposition,

Ramani Duraiswami, Dept. of Computer Science

Some special matrices

•^

Matlab code

-^

How many operations andmemory does this take?

-^

Vectorized operations

-^

Matrix may be sparse, i.e. most elements are zero.

-^

How many operations/memory?

-^

Answer still

N

2

unless we avoid

referring to the zero elementsaltogether

Matrix-vector product

•^

Matrix-vector multiplication applies a lineartransformation to a vector:

-^

Recall how to do matrix multiplication

-^

How many operations does a matrix vectorproduct take?

⎤ ⎥ ⎥ ⎥⎦ ⎡⎤ ⎢⎥ ⎢⎥ ⎢⎥⎣⎦

⎡ ⎢ ⎢ ⎢⎣

x v y v^ z v

M

M

M

M

M

M

M

M

M

v

M

33

32

31

23

22

21

13

12

11

Matrix-vector product

Ways to implement a matrix vector product

•^

Access matrix– Element-by-element

along rows

  • Element-by-element

along columns

  • As column vectors– As row vectors -^

Discuss advantages

Matrix norms

•^

Can be defined usingcorresponding vectornorms– Two norm– One norm– Infinity norm

-^

Two norm is hard todefine … need to findmaximum singular value– related to idea that matrix

acting on unit sphere convertsit in to an ellipsoid

•^

Frobenius norm is definedjust using matrix elements

Solving Linear Systems

•^

One idea compute inverse

-^

Not usually a good idea– (unless inverse is computable

easily and accurately using somematrix property)

•^

Leads to increased errors, and ismore expensive usually

Representing linear systems as matrix-vector

equations

•^

Represent it as a matrix-vector equation (linear system)

-^

We will apply the familiar elimination technique, andthen see its matrix equivalent

Solving a triangular system

Gaussian Elimination

•^

Zero elements offirst column below 1

st^

row

  • multiplying 1

st^

row

by 0.3 and add to 2

nd

row

  • multiplying 1

st^

row

by -0.5 and add to 3

rd

row

  • Results in -^

Zero elements offirst column below 2

nd

row

  • Swap rows– Multiply 2

nd

row by

0.04 and add to 3

rd

Gaussian Elimination: LU Matrix decomposition

•^

It turns out that Gaussian elimination corresponds to aparticular matrix decomposition …– Product of permutation, lower triangular and upper triangular

matrices

•^

What is a permutation matrix?– It rearranges a system of equations

and changes the order.

  • Multiplying by it swaps the order

of rows in a matrix

  • Essentially a rearrangement of

the identity

  • Nice property: transpose is its

inverse:

PP

T=I

LU Decomposition

•^

What is an upper triangularmatrix?– Elements below diagonal are zero

-^

Lower triangular matrix

-^

Elements above diagonal are zero

-^

Unit lower triangular matrix

-^

Elements along diagonal are one

-^

Upper triangular part of GaussElimination is clear …–

final matrix we end up with

•^

What about lower triangular and permutation?