Slide 1 / 39 Projection and its Importance in Scientific Computing ________________________________________________ CS 594-004 Lecture Notes 02/21/2007.

Slides:



Advertisements
Similar presentations
B.Macukow 1 Lecture 12 Neural Networks. B.Macukow 2 Neural Networks for Matrix Algebra Problems.
Advertisements

Solving Linear Systems (Numerical Recipes, Chap 2)
By S Ziaei-Rad Mechanical Engineering Department, IUT.
Asymptotic error expansion Example 1: Numerical differentiation –Truncation error via Taylor expansion.
Data mining and statistical learning - lecture 6
1 Chapter 4 Interpolation and Approximation Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.
Iterative Methods and QR Factorization Lecture 5 Alessandra Nardi Thanks to Prof. Jacob White, Suvranu De, Deepak Ramaswamy, Michal Rewienski, and Karen.
Modern iterative methods For basic iterative methods, converge linearly Modern iterative methods, converge faster –Krylov subspace method Steepest descent.
1cs542g-term Notes  Make-up lecture tomorrow 1-2, room 204.
BVP Weak Formulation Weak Formulation ( variational formulation) where Multiply equation (1) by and then integrate over the domain Green’s theorem gives.
ECIV 720 A Advanced Structural Mechanics and Analysis
Signal , Weight Vector Spaces and Linear Transformations
1cs542g-term Notes  Simpler right-looking derivation (sorry):
Chapter 5 Orthogonality
12/21/2001Numerical methods in continuum mechanics1 Continuum Mechanics On the scale of the object to be studied the density and other fluid properties.
3D Geometry for Computer Graphics. 2 The plan today Least squares approach  General / Polynomial fitting  Linear systems of equations  Local polynomial.
1cs542g-term Notes  r 2 log r is technically not defined at r=0 but can be smoothly continued to =0 there  Question (not required in assignment):
Weak Formulation ( variational formulation)
The Terms that You Have to Know! Basis, Linear independent, Orthogonal Column space, Row space, Rank Linear combination Linear transformation Inner product.
Lecture 12 Least Square Approximation Shang-Hua Teng.
Lecture 9 Interpolation and Splines. Lingo Interpolation – filling in gaps in data Find a function f(x) that 1) goes through all your data points 2) does.
Linear Least Squares QR Factorization. Systems of linear equations Problem to solve: M x = b Given M x = b : Is there a solution? Is the solution unique?
ECE 530 – Analysis Techniques for Large-Scale Electrical Systems
Finite element method 1 Finite Elements  Basic formulation  Basis functions  Stiffness matrix  Poisson‘s equation  Regular grid  Boundary conditions.
ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.
Introduction The central problems of Linear Algebra are to study the properties of matrices and to investigate the solutions of systems of linear equations.
1 MAC 2103 Module 10 lnner Product Spaces I. 2 Rev.F09 Learning Objectives Upon completing this module, you should be able to: 1. Define and find the.
Length and Dot Product in R n Notes: is called a unit vector. Notes: The length of a vector is also called its norm. Chapter 5 Inner Product Spaces.
Function approximation: Fourier, Chebyshev, Lagrange
Computational Methods in Physics PHYS 3437 Dr Rob Thacker Dept of Astronomy & Physics (MM-301C)
Chapter 5: The Orthogonality and Least Squares
CHAPTER FIVE Orthogonality Why orthogonal? Least square problem Accuracy of Numerical computation.
CIS V/EE894R/ME894V A Case Study in Computational Science & Engineering HW 5 Repeat the HW associated with the FD LBI except that you will now use.
MAT 4725 Numerical Analysis Section 8.2 Orthogonal Polynomials and Least Squares Approximations (Part II)
Scientific Computing Linear Least Squares. Interpolation vs Approximation Recall: Given a set of (x,y) data points, Interpolation is the process of finding.
Linear Algebra (Aljabar Linier) Week 10 Universitas Multimedia Nusantara Serpong, Tangerang Dr. Ananda Kusuma
Finite Element Method.
Chapter Content Real Vector Spaces Subspaces Linear Independence
1 Chapter 5 – Orthogonality and Least Squares Outline 5.1 Orthonormal Bases and Orthogonal Projections 5.2 Gram-Schmidt Process and QR Factorization 5.3.
Orthogonality and Least Squares
Practical Dynamic Programming in Ljungqvist – Sargent (2004) Presented by Edson Silveira Sobrinho for Dynamic Macro class University of Houston Economics.
Discontinuous Galerkin Methods Li, Yang FerienAkademie 2008.
1 Spring 2003 Prof. Tim Warburton MA557/MA578/CS557 Lecture 8.
6. Introduction to Spectral method. Finite difference method – approximate a function locally using lower order interpolating polynomials. Spectral method.
AGC DSP AGC DSP Professor A G Constantinides©1 Hilbert Spaces Linear Transformations and Least Squares: Hilbert Spaces.
Elementary Linear Algebra Anton & Rorres, 9th Edition
MATH 685/ CSI 700/ OR 682 Lecture Notes Lecture 4. Least squares.
Section 5.1 Length and Dot Product in ℝ n. Let v = ‹v 1­­, v 2, v 3,..., v n › and w = ‹w 1­­, w 2, w 3,..., w n › be vectors in ℝ n. The dot product.
1 EEE 431 Computational Methods in Electrodynamics Lecture 18 By Dr. Rasime Uyguroglu
CHAP 3 WEIGHTED RESIDUAL AND ENERGY METHOD FOR 1D PROBLEMS
1 Chapter 7 Numerical Methods for the Solution of Systems of Equations.
Lecture 6 - Single Variable Problems & Systems of Equations CVEN 302 June 14, 2002.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
1 MAC 2103 Module 11 lnner Product Spaces II. 2 Rev.F09 Learning Objectives Upon completing this module, you should be able to: 1. Construct an orthonormal.
1 Chapter 4 Interpolation and Approximation Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.
ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.
Finite Element Method. History Application Consider the two point boundary value problem.
A Parallel Hierarchical Solver for the Poisson Equation Seung Lee Deparment of Mechanical Engineering
Parameter estimation class 5 Multiple View Geometry CPSC 689 Slides modified from Marc Pollefeys’ Comp
Runge Kutta schemes Taylor series method Numeric solutions of ordinary differential equations.
X1X1 X2X2  Basic Kinematics Real Applications Simple Shear Trivial geometry Proscribed homogenous deformations Linear constitutive.
Let W be a subspace of R n, y any vector in R n, and the orthogonal projection of y onto W. …
MAT 4725 Numerical Analysis Section 8.2 Orthogonal Polynomials and Least Squares Approximations (Part II)
Introduction The central problems of Linear Algebra are to study the properties of matrices and to investigate the solutions of systems of linear equations.
Introduction The central problems of Linear Algebra are to study the properties of matrices and to investigate the solutions of systems of linear equations.
d-Fold Hermite-Gauss Quadrature and Computation of Special Functions
Chapter 10: Solving Linear Systems of Equations
~ Least Squares example
Approximation of Functions
Approximation of Functions
Presentation transcript:

Slide 1 / 39 Projection and its Importance in Scientific Computing ________________________________________________ CS Lecture Notes 02/21/2007 Stan Tomov Innovative Computing Laboratory Computer Science Department The University of Tennessee February 21, 2007

Slide 2 / 39 Contact information office : Claxton 330 phone : (865) Additional reference materials: [1] R.Barrett, M.Berry, T.F.Chan, J.Demmel, J.Donato, J. Dongarra, V. Eijkhout, R.Pozo, C.Romine, and H.Van der Vorst, Templates for the Solution of Linear Systems: Building Blocks for Iterative Methods (2 nd edition) [2] Yousef Saad, Iterative methods for sparse linear systems (1st edition)

Slide 3 / 39 Topics Projection in Scientific Computing (lecture 1) PDEs, Numerical solution, Tools, etc. (lecture 2, 02/28/07) Sparse matrices, parallel implementations (lecture 3, 03/21/07) Iterative Methods (lectures 4 and 5, 04/11 and 04/18/07)

Slide 4 / 39 Outline Part I –Fundamentals Part II –Projection in Linear Algebra Part III –Projection in Functional Analysis (e.g. PDEs)

Slide 5 / 39 Part I Fundamentals

Slide 6 / 39 What is Projection? Here are two examples (from linear algebra) (from functional analysis) u PuPu e P : orthogonal projection of vector u on e 01 1e = 1 Pu u = f(x) P : best approximation (projection) of f(x) in span{ e } ⊂ C[0,1]

Slide 7 / 39 Definition Projection is a linear transformation P from a linear space V to itself such that P 2 = P equivalently Let V is direct sum of subspaces V 1 and V 2 V = V 1 V 2 i.e. for u ∈ V there are unique u 1 ∈ V 1 and u 2 ∈ V 2 s.t. u = u 1 +u 2 Then P: VV 1 is defined for u ∈ V as Pu ≡ u 1

Slide 8 / 39 Importance in Scientific Computing To compute approximations Pu u where dim V 1 << dim V V = V 1 V 2 When computation directly in V is not feasible or even possible. A few examples: –Interpolation (via polynomial interpolation/projection) –Image compression –Sparse iterative linear solvers and eigensolvers –Finite Element/Volume Method approximations –Least-squares approximations, etc.

Slide 9 / 39 Projection in R 2 In R 2 with Euclidean inner-product, i.e. for x, y ∈ R 2 (x, y) = x 1 y 1 + x 2 y 2 ( = y T x = x ⋅ y ) and || x || = (x, x) 1/2 PuPu e u e Pu = e (Exercise) (u, e) || e || 2 P : orthogonal projection of vector u on e i.e. for || e || = 1 Pu = (u, e) e

Slide 10 / 39 Projection in R n / C n Similarly to R 2 P : Orthogonal projection of u into span{e 1,..., e m }, m ≤ n. Let e i, i = 1... m is orthonormal basis, i.e. (e i, e j ) = 0 for i ≠ j and (e i, e j ) = 1 for i=j P u = (u, e 1 ) e (u, e m ) e m ( Exercise ) Orthogonal projection of u on e 1

Slide 11 / 39 How to get an orthonormal basis? Can get one from every subspace by Gram-Schmidt orthogonalization: Input : m linearly independent vectors x 1,..., x m Output : m orthonormal vectors x 1,..., x m 1. x 1 = x 1 / || x 1 || 2. do i = 2, m 3. x i = x i - (x i, x 1 ) x (x i, x i-1 ) x i-1 (Exercise: x i x 1,..., x i-1 ) 4. x i = x i / || x i || 5. enddo Known as Classical Gram-Schmidt (CGM) orthogonalization Orthogonal projection of x i on x 1

Slide 12 / 39 How to get an orthonormal basis? What if we replace line 3 with the following (3')? 3. x i = x i - (x i, x 1 ) x (x i, x i-1 ) x i-1 3'. do j = 1, i-1 x i = x i – (x i, x j ) x j enddo Equivalent in exact arithmetic (Exercise) but not with round-off errors (next) ! Known as Modified Gram-Schmidt (MGS) orthogonalization xixi

Slide 13 / 39 CGS vs MGS Results from Julien Langou: Scalability of MGS and CGS on two different clusters for matrices of various size

Slide 14 / 39 CGS vs MGS Results from Julien Langou: Accuracy of MGS vs CGS on matrices of increasing condition number

Slide 15 / 39 QR factorization Let A = [x 1,..., x m ] be the input for CGS/MGS and Q = [q 1,..., q m ] the output; R : an upper m m triangular matrix defined from the CGR/MGS. Then A = Q R

Slide 16 / 39 Other QR factorizations What about the following? 1. G = A T A 2. G = L L T (Cholesky factorization) 3. Q = A (L T ) -1 Is Q orthonormal, i.e. A = QL T to be a QR factorization (Exercise) When is this feasible and how compares to CGS and MGS?

Slide 17 / 39 Other QR factorizations Feasible when n >> m Allows efficient parallel implementation: blocking both computation and communication ATAT GA = P1 P2... In accuracy is comparable to MGS In scalability is comparable to CGS Exercise

Slide 18 / 39 How is done in LAPACK? Using Householder reflectors H = I – 2 w w T w = ? so that H x 1 = e 1 w =... (compute or look at the reference books) Allows us to construct X k H k-1... H 1 X = w x Hx Q (Exercise) LAPACK implementation : “delayed update” of the trailing matrix + “accumulate transformation” to apply it as BLAS 3

Slide 19 / 39 Part II Projection in Linear Algebra

Slide 20 / 39 Projection into general basis How to define projection without orthogonalization of a basis? –Sometimes is not feasible to orthogonalize –Often the case in functional analysis (e.g. Finite Element Method, Finite Volume Method, etc.) where the basis is “linearly independent” functions (more later, and Lecture 2) We saw if X = [x 1,..., x m ] is an orthonormal basis (*) P u = (u, x 1 ) x (u, x m ) x m How does (*) change if X are just linearly independent ? P u = ?

Slide 21 / 39 Projection into a general basis The problem: Find the coefficients C = (c 1... c m ) T in P u = c 1 x 1 + c 2 x c m x m = X C so that u – Pu ⊥ span{x 1,..., x m } or ⇔ so that the error e in (1) u = P u + e is ⊥ span{x 1,..., x m }

Slide 22 / 39 Projection into a general basis (1) u = P u + e = c 1 x 1 + c 2 x c m x m + e Multiply (1) on both sides by “test” vector/function x j (terminology from functional analysis) for j = 1,..., m (u, x j ) = c 1 (x 1, x j )+ c 2 (x 2, x j ) c m (x m, x j ) + (e, x j ) i.e. m equations for m unknowns In matrix notations (X T X) C = X T u (Exercise) X T Pu = X T u X T X is the so called Gram matrix (nonsingular; why?) 0

Slide 23 / 39 Normal equations System (X T X) C = X T u is known also as Normal Equations Can be solved using the Method of Normal Equations from slide # 16 (with the Cholesky factorization)

Slide 24 / 39 Least Squares (LS) System (X T X) C = X T u gives also the solution of the LS problem min || X C – u || since || v 1 – u || 2 = || (v 1 – Pu) – e || 2 = || v 1 – Pu || 2 + || e || 2 ≤ || e || 2 = || Pu – u || 2 for ∀ v 1 ∈ V 1 C∈RmC∈Rm P u

Slide 25 / 39 LS Note that the usual notations for LS is: For A ∈ R nm, b ∈ R n find min || A x – b || Solving LS with QR factorization Let A = Q R, Q T A = R = R 1, Q T b = c m 0 d n - m Then || Ax – b || 2 = || Q T Ax – Q T b || 2 = || R 1 x – c || 2 + || d || 2 i.e. we get minimum if x is such that R 1 x = c x∈Rmx∈Rm

Slide 26 / 39 Projection and iterative solvers The problem : Solve Ax = b in R n Iterative solution: at iteration i extract an approximate x i from just a subspace V = span[v 1,..., v m ] of R n How? As on slide 22, impose constraints: b – Ax subspace W = span[w 1,...,w m ] of R n, i.e. (*) (Ax, w i ) = (b, w i ) for ∀ w i ∈ W= span[w 1,...,w m ] Conditions (*) known also as Petrov-Galerkin conditions Projection is orthogonal: V and W are the same (Galerkin conditions) or oblique : V and W are different

Slide 27 / 39 Matrix representation Let V = [v 1,..., v m ], W = [w 1,...,w m ] Find y ∈ R m s.t. x = x 0 + V y solves Ax = b, i.e. A V y = b – Ax 0 = r 0 subject to the orthogonality constraints: W T A V y = W T r 0 The choice for V and W is crucial and determines various methods (more in Lectures 4 and 5)

Slide 28 / 39 A General Projection Algorithm Prototype from Y.Saad's book

Slide 29 / 39 Projection and Eigen-Solvers The problem : Solve Ax = x in R n As in linear solvers: at iteration i extract an approximate x i from a subspace V = span[v 1,..., v m ] of R n How? As on slides 22 and 26, impose constraints: x – Ax subspace W = span[w 1,...,w m ] of R n, i.e. (*) (Ax, w i ) = (x, w i ) for ∀ w i ∈ W= span[w 1,...,w m ] This procedure is known as Rayleigh-Ritz Again projection can be orthogonal or oblique

Slide 30 / 39 Matrix representation Let V = [v 1,..., v m ], W = [w 1,...,w m ] Find y ∈ R m s.t. x = V y solves Ax = x, i.e. A V y = Vy subject to the orthogonality constraints: W T A V y = W T Vy The choice for V and W is crucial and determines various methods (more in Lectures 4 and 5)

Slide 31 / 39 Part III Projection in PDEs

Slide 32 / 39 Projection in Functional Spaces The discussion so far can be applied to any functional inner- product space (examples to follow) An important space is C[a, b], the space of continuous functions on [a, b], with inner-product a (f, g) = ∫ f(x) g(x) dx b and induced norm || f || = (f, f) 1/2

Slide 33 / 39 Projection in Functional Spaces Projection P: V V 1 where V = V 1 V 2 In functional analysis and scientific computing V 1 is usually taken as –Piecewise polynomials In PDE approximation (FEM/FVM), Numerical integration, etc. –Trigonometric functions { sin(n x), cos(n x) } n=0,..., x [0, 2] Orthogonal relative to 2 (f, g) = ∫ f(x) g(x) dx (Exercise) 0

Slide 34 / 39 Normal equations / LS Exercise: f(x) = sin(x) Find the projection in V 1 = span{x, x 3, x 5 } on interval [-1, 1] using inner-product 1 (f, g) = ∫ f(x) g(x) dx -1 and norm || f || = (f,f) 1/2

Slide 35 / 39 Normal equations / LS Leads to Gram matrix that is very ill- conditioned (called Hilbert matrix: Gram matrix for polynomials 1, x, x 2, x 3,...) For numerical stability is better to orthogonalize the polynomials There are numerous examples of orthonormal polynomial sets * Legendre, Chebyshev, Hermite, etc * Check the literature for more if interested

Slide 36 / 39 Integration via Polynomial Interpolation Take ∫ f(x) dx ∫ p(x) dx where p is a polynomial approximation to f Taking p a polynomial interpolating f at n+1 fixed nodes xi leads to quadrature formulas ∫ f(x) dx A0 f(x0) An f(xn) that are exact exact for polynomials of degree ≤ n Smart choice of the nodes xi (Gaussian quadrature) leads to formulas that are exact for polynomials of degree ≤ 2n+1

Slide 37 / 39 Galerkin Projection Numerical PDE discretizations have a common concept: –Represent computational domain with mesh –Approximate functions and operators over the mesh

Slide 38 / 39 Galerkin Projection Finite dimensional spaces (e.g. V 1 ) can can be piecewise polynomials defined over the mesh, e.g. Numerical solution of PDE (e.g. FEM) –Boundary value problem: Au = f, subject to boundary conditions –Get a “weak” formulation: (Au,  ) = (f,  ) - multiply by test function  and integrate over the domain a( u,  ) = for   S –Galerkin (FEM) problem: Find u h  S h  S s.t. a( u h,  h ) = for   h  S h ii i

Slide 39 / 39 Learning Goals The idea and application of Petrov-Galerkin conditions as a way of defining computationally feasible/possible formulations (approximations) Some generic examples demonstrating from –Linear algebra – Functional analysis (to get more specific in the following lectures)