CEE 618 Scientific Parallel Computing (Lecture 3)
|
|
- Aron Baldwin
- 6 years ago
- Views:
Transcription
1 1 / 36 CEE 618 Scientific Parallel Computing (Lecture 3) Linear Algebra Basics using LAPACK Albert S. Kim Department of Civil and Environmental Engineering University of Hawai i at Manoa 2540 Dole Street, Holmes 383, Honolulu, Hawaii 96822
2 2 / 36 Table of Contents 1 Partial Differential Equation: Althernative Method 2 Linear Algebra LU decomposition Numerical Recipes in FORTRAN Linea Algeb PACAKage 3 Eigen Value & Eigen Vector 4 PBS(Portable Batch System
3 Partial Differential Equation: Althernative Method Outline 3 / 36 1 Partial Differential Equation: Althernative Method 2 Linear Algebra LU decomposition Numerical Recipes in FORTRAN Linea Algeb PACAKage 3 Eigen Value & Eigen Vector 4 PBS(Portable Batch System
4 Partial Differential Equation: Althernative Method Convection-Diffusion-Reaction Equation General form C = (D C) (vc) kc (1) t In a steady state without convection and reaction In 2D with a constant diffusion coefficient 0 = (D C) (2) 0 = 2 C x C y 2 (3) Mathematically identical to heat diffusion (C T ) 0 = 2 T x T y 2 (4) Examples? Let s watach some videos in 4 / 36
5 Partial Differential Equation: Althernative Method Example problem 5 / 36 Solve the following equation using the method of separation of variables: 2 C x C y 2 = 0 (5) Boundary conditions (0 < x, y < L) 1 C (x = 0, y) = 0 2 C (x, y = 0) = 0 3 C (x, y = L) = 0 4 C (x = L, y) = 10 sin ( ) πy L Figure: How does your solution look like?
6 Partial Differential Equation: Althernative Method Solution 6 / By the method of the separation of variables C (x, y) = X (x) Y (y) (6) Prove. C = 10 πx πy sinh sin sinh π L L (7)
7 Partial Differential Equation: Althernative Method 7 / 36
8 Partial Differential Equation: Althernative Method Solution 8 / By MS Excel: I am nothing but an average of my neighbors. C ij = C i+1,j + C i 1,j + C i,j+1 + C i,j 1 4 (8) Excel setup 1 Open MS Excel 2 Go to File 3 Click Options 4 Go to Formulas 5 Click Enable iterative calculation
9 9 / 36 Outline Linear Algebra 1 Partial Differential Equation: Althernative Method 2 Linear Algebra LU decomposition Numerical Recipes in FORTRAN Linea Algeb PACAKage 3 Eigen Value & Eigen Vector 4 PBS(Portable Batch System
10 10 / 36 Example Linear Algebra Tony is two years odlder than Sam and the sum of their current ages is twenty. How old are Tony and Sam? Use a two by two matrix to solve this problem. T S = 2 (9) T + S = 20 (10)
11 11 / 36 A Linear System Linear Algebra LU decomposition A = a 11 a 12 a 1n a 21 a 22 a 2n a n1 a n2 a nn A x = b (11) x 1 b 1 x 2 b 2, x = and b =.. x n b n n n n 1 n 1 where A is a n n square matrix, and b is a n 1 column vector, of which all elements are known. Then, how can we calculate x?
12 12 / 36 LU decomposition Linear Algebra LU decomposition The square matrix A can be decomposed into A = L U (12) where L and U are lower and upper triangular matrixes, respectively, and calculated as α β 11 β 12 β 1n α 21 α 22 0 L =......, U = 0 β 22 β 2n α n1 α n2 α nn 0 0 β nn Then, A x = (L U) x = L (U x) = b (13) Let s set U x = y, then L y = b (14)
13 Linear Algebra LU decomposition Forward substitution with known L and b to solve for y L y = b α α 21 α α n1 α n2 α nn y 1 y 2. y n = b 1 b 2. b n Then, y 1 = b 1, y 2 = b 2 α 11 y 1, α 11 α (15) Using back substitution, y i = 1 i 1 b i α ij y j α ii (16) j=1 where i = 2, 3,..., n. 13 / 36
14 Linear Algebra LU decomposition Backward substitution with U and y to solve for x Then, β 11 β 12 β 1n β n 1,n 1 β n 1,n 0 0 β nn x n = y n, β nn Using back substitution, x i = 1 β ii where i = n 1, n 2,..., 1. U x = y (17) x 1. x n 1 = x n y 1. y n 1 y n x n 1 = y n 1 β n 1,n x n β n 1,n 1,... (18) y i n j=i+1 β ij x j (19) 14 / 36
15 15 / 36 Linear Algebra LU decomposition Combined matrix of α s and β s with less memory Using α ii = 1 where i = 1, 2,..., n L U C = β 11 β 12 β 13 β 1,n 1 β 1n α 21 β 22 β 23 β 2,n 1 β 2n α 31 α 32 β 33 β 3,n 1 β 3n α n 1,1 α n 1,2 α n 1,3 β n 1,n 1 β n 1,n α n1 α n2 α n3 α n,n 1 β nn
16 16 / 36 Example: Linear Algebra LU decomposition A = A x = b (20), b = 1 0 0, x = x 1 x 2 x 3 =? (21) C = , x = (22) However, C does not directrly represent L and U of matrix A because pivoting exchanges row index during the LU decomposition.
17 Makefile Linear Algebra LU decomposition 1 Use files in /opt/cee618s13/class03/ to solve this problem using ludcmp and lubksb subroutines from NRF Use LAPACK routines 2 of DGETRF and DGETRS. 3 Check how to link LAPACK in Makefile. 1 Section 2.3 of Numerical Recipes in FORTRAN 77, available at 2 LAPACK user s guide at 17 / 36
18 18 / 36 Linear Algebra Numerical Recipes in FORTRAN Using subroutines in NRF: ludcmp & lubksb 1 program LU i m p l i c i t none 3 i n t e g e r : : i, j, indx ( 3 ) r e a l : : a ( 3, 3 ) = ( / 1., 1., 2., 3., 1., 3., 1., 2., 4. / ) 5 r e a l : : d, b ( 3 ) = ( / 1., 0., 0. / ) 7 open (11, f i l e = l u. dat )! Display the given matrix, A and b 9 w r i t e ( 1 1, * ) do i =1,3 1 w r i t e (11, " (4(2 x, F12. 6 ) ) " ) ( a ( i, j ), j =1,3), b ( i ) enddo 3! Decomposition of the given m a trix A c a l l ludcmp ( a, 3, 3, indx, d ) 5! Display the decomposed matrix, A and b w r i t e ( 1 1, * ) 7 do i =1,3 w r i t e (11, " (4(2 x, F12. 6 ) ) " ) ( a ( i, j ), j =1,3) 9 enddo! Solving f o r x w ith the decomposed matrix using b a c k s u b s i t u t i o n 1 c a l l lubksb ( a, 3, 3, indx, b )! Display the decomposed matrix, A and the solution x 3 w r i t e ( 1 1, * ) do i =1,3 5 w r i t e (11, " (4(2 x, F12. 6 ) ) " ) ( a ( i, j ), j =1,3), b ( i ) enddo 7 stop end./codes/lu/lu3.f90
19 19 / 36 Linear Algebra Results using ludcmp & lubksb Numerical Recipes in FORTRAN = (23) /codes/LU/lu.dat
20 Linear Algebra Numerical Recipes in FORTRAN SUBROUTINE ludcmp ( a, n, np, indx, d ) 2 INTEGER n, np, indx ( n ),NMAX REAL d, a ( np, np ), TINY 4 PARAMETER (NMAX=500,TINY=1.0e 20) INTEGER i, imax, j, k 6 REAL aamax, dum, sum, vv (NMAX) d=1. 8 do 12 i =1,n aamax=0. 0 do 11 j =1,n i f ( abs ( a ( i, j ) ). gt. aamax ) aamax=abs ( a ( i, j ) ) 2 11 continue i f ( aamax. eq. 0. ) pause s i n g u l a r m a t r ix i n ludcmp 4 vv ( i ) = 1. / aamax 12 continue 6 do 19 j =1,n do 14 i =1, j 1 8 sum=a ( i, j ) do 13 k =1, i 1 0 sum=sum a ( i, k ) * a ( k, j ) 13 continue 2 a ( i, j ) =sum 14 continue 20 / 36
21 Linear Algebra Numerical Recipes in FORTRAN 1 SUBROUTINE lubksb ( a, n, np, indx, b ) INTEGER n, np, indx ( n ) 3 REAL a ( np, np ), b ( n ) INTEGER i, i i, j, l l 5 REAL sum i i =0 7 do 12 i =1,n l l =indx ( i ) 9 sum=b ( l l ) b ( l l ) =b ( i ) 1 i f ( i i. ne. 0 ) then do 11 j = i i, i 1 3 sum=sum a ( i, j ) * b ( j ) 11 continue 5 else i f (sum. ne. 0. ) then i i = i 7 e n d i f b ( i ) =sum 9 12 continue do 14 i =n,1, 1 1 sum=b ( i ) do 13 j = i +1,n 3 sum=sum a ( i, j ) * b ( j ) 21 / 36
22 22 / 36 Linear Algebra Linea Algeb PACAKage Using subroutines in LAPACK: dgetrf & dgetrs program LUlapack 2 i m p l i c i t none i n t e g e r : : i, j, i p i v ( 3 ), i n f o 4 double p r e c i s i o n : : a ( 3, 3 ) = ( / 1., 1., 2., 3., 1., 3., 1., 2., 4. / ) double p r e c i s i o n : : b ( 3 ) = ( / 1., 0., 0. / ) 6 open (11, f i l e = lu l a p a c k. dat ) 8! Display the given matrix, A and b w r i t e ( 1 1, * ) 0 do i =1,3 w r i t e (11, " (4(2 x, F12. 6 ) ) " ) ( a ( i, j ), j =1,3), b ( i ) 2 end do! Decomposition of the given matrix A 4 c a l l d g e t r f (3,3, a, 3, i p i v, i n f o )! Display the decomposed matrix, A and b 6 w r i t e ( 1 1, * ) do i =1,3 8 w r i t e (11, " (4(2 x, F12. 6 ) ) " ) ( a ( i, j ), j =1,3), b ( i ) end do 0! Solving f o r x with the decomposed matrix using b a c k s u b s i t u t i o n c a l l dgetrs ( N,3,1, a, 3, i p i v, b, 3, i n f o ) 2! Display the decomposed matrix, A and the solution x w r i t e ( 1 1, * ) 4 do i =1,3 w r i t e (11, " (4(2 x, F12. 6 ) ) " ) ( a ( i, j ), j =1,3), b ( i ) 6 end do stop 8 end./codes/lulapack/lu3dlapack.f90
23 23 / 36 Archives Linear Algebra Linea Algeb PACAKage Linear Equations at Individual at Single, REAL at Double, REAL at dgetrf at dgetrs at dgetri at
24 24 / 36 Specifically Linear Algebra Linea Algeb PACAKage call dgetrf ( 3, 3, a, 3, ipiv, info ) call dgetrs( N, 3, 1, a, 3, ipiv, b, 3, info )
25 25 / 36 Outline Eigen Value & Eigen Vector 1 Partial Differential Equation: Althernative Method 2 Linear Algebra LU decomposition Numerical Recipes in FORTRAN Linea Algeb PACAKage 3 Eigen Value & Eigen Vector 4 PBS(Portable Batch System
26 Eigen Value & Eigen Vector Eigen Value & Eigen Vector Example: Rotate to principal axes the quadratic surface In matrix form this equation is or x 2 + 6xy 2y 2 2yz + z 2 = 24 (24) ( x y ) z x y z = 24 (25) X T MX = 24 (26) The characteristic equation of this matrix is 1 µ µ µ = µ3 +13µ 12 = (µ 1) (µ + 4) (µ 3) = 0 (27) The characteristic values are µ = 1, 4, / 36
27 Eigen Value & Eigen Vector 27 / 36 From ( x y ) z x y z = 24 (28) relative to the principal axes (x, y, z ), the quadratic sufrace equation becomes ( x y z ) = 24 (29) or or where x 2 + ( 4) y z 2 = 24 (30) x y z X T M X = 24 (31) M = (32)
28 Eigen Value & Eigen Vector 28 / 36 Eigen vectors are ( 1 10, ( 3 5,, ( 3, 2, ) 0 3, ) 1 35 ) 1 14 for µ = 1 (33) for µ = 4 (34) for µ = 3 (35) or x y z C X = X X T C T = X T = x y z (36)
29 Eigen Value & Eigen Vector 29 / 36 In other words, = (37) In the eigen vector matrix, the columns can be exchanged and signs can be reverted. It is a matter of using right-handed or left-haded coordinates. Using transformed coordinates makes the problem mathematically so convenient. In quantum mechanics, eigen values are energy and eigen vectors are quantum states.
30 Eigen Value & Eigen Vector./codes/eigen/eigvv.f90 30 / 36 PROGRAM EIGENVV 2 IMPLICIT NONE INTEGER : : I, INFO, J, N, LWORK 4 DOUBLE PRECISION : : DUMMY(1,1) DOUBLE PRECISION, ALLOCATABLE, DIMENSION ( :, : ) : : A, B, VR 6 DOUBLE PRECISION, ALLOCATABLE, DIMENSION ( : ) : : ALPHAR, ALPHAI, BETA, WORK open (11, f i l e = mat. i n, s t a t u s = old ) 8 read ( 1 1, * ) N LWORK = 8 * N 0 a l l o c a t e (A(N,N),B(N,N),ALPHAR(N),ALPHAI (N),BETA(N),VR(N,N),WORK(LWORK) ) B = 0. 0 ; do i = 1, N; B( i, i ) = 1. 0 ; end do 2 READ ( 1 1, * ) ( ( A( I, J ), J =1,N), I =1,N) CALL DGGEV( N, V,N,A,N,B,N, ALPHAR, ALPHAI,BETA,DUMMY,1,VR,N,WORK,LWORK, INFO ) 4 w r i t e ( *, * ) Eigen values are ( diagonal ) : w r i t e ( *, " ( 3(2X, F12. 8 ) ) " ) ( ( A( i, j ), J =1,N), I =1,N) 6 w r i t e ( *, * ) c a l l eigvec_norm (N,VR) 8 w r i t e ( *, * ) Eigen vectors are : w r i t e ( *, " ( 3(2X, F12. 8 ) ) " ) ( (VR( i, j ), J =1,N), I =1,N) 0 w r i t e ( *, * ) deallocate (A,B,ALPHAR, ALPHAI,BETA,VR,WORK) 2 contains 4 subroutine eigvec_norm (N,VR) 6 DOUBLE PRECISION : : VR(N,N) i n t e g e r : : N, i, j 8 double p r e c i s i o n : : norm do i = 1, 3 0 norm = DOT_PRODUCT (VR( :, i ), VR( :, i ) ) VR( :, i ) = VR( :, i ) / s q r t ( norm ) 2 enddo end subroutine eigvec_norm 4 end program
31 31 / 36 Makefile Eigen Value & Eigen Vector s r c r o o t =eigvv 2 s r c f i l e =$ ( s r c r o o t ). f90 e x e f i l e =$ ( s r c r o o t ). x 4 a l l : 6 i f o r t $ ( s r c f i l e ) o $ ( e x e f i l e ) l l a p a c k 8 run :. / $ ( e x e f i l e ) 0 2 e d i t : vim $ ( s r c f i l e ) 4 clean : 6 rm f *. x *. o./codes/eigen/makefile
32 32 / 36 Output Eigen Value & Eigen Vector. / eigvv. x 2 Eigen values are ( diagonal ) : Eigen vectors are : /codes/eigen/output.dat
33 33 / 36 Outline PBS(Portable Batch System 1 Partial Differential Equation: Althernative Method 2 Linear Algebra LU decomposition Numerical Recipes in FORTRAN Linea Algeb PACAKage 3 Eigen Value & Eigen Vector 4 PBS(Portable Batch System
34 PBS(Portable Batch System sample0.pbs & sample1.pbs 34 / 36 1 #PBS S / bin / bash #PBS V 3 uname n echo $PBS_O_JOBID./codes/PBS/sample0.pbs #! / bin / bash 2 #PBS l w a l l t i m e =12:00:00 #PBS N MyJob 4 #PBS V uname n 6 echo $PBS_O_JOBID cd $PBS_O_WORKDIR 8 pwd./codes/pbs/sample1.pbs
35 PBS(Portable Batch System sample2.pbs 35 / 36 1 #! / bin / bash #PBS l host= f r a c t a l 3 #PBS l w a l l t i m e =12:00:00 #PBS l s e l e c t =1: mpiprocs =4: ncpus=4 5 #PBS N Sample #PBS V 7 #PBS j oe cd $PBS_O_WORKDIR 9 ### put your s p e c i f i c job here a f t e r time command ### time l s laf 1 ####################################################### q s t a t f $PBS_JOBID./codes/PBS/sample2.pbs
36 36 / 36 Commands PBS(Portable Batch System 1 $ qsub < sample0.pbs 2 $ qstat The first comman is to submit a job described in "sample0.pbs" to a queueing system, i.e. "torque". The second comman is to monitor a status of the job, of which job number was assigned automatically by the first command. Observe the directory since each command of "qsub" will generate two files with the job number. Look at contents of newly generated files.
CEE 618 Scientific Parallel Computing (Lecture 7): OpenMP (con td) and Matrix Multiplication
1 / 26 CEE 618 Scientific Parallel Computing (Lecture 7): OpenMP (con td) and Matrix Multiplication Albert S. Kim Department of Civil and Environmental Engineering University of Hawai i at Manoa 2540 Dole
More informationLinear Algebra Section 2.6 : LU Decomposition Section 2.7 : Permutations and transposes Wednesday, February 13th Math 301 Week #4
Linear Algebra Section. : LU Decomposition Section. : Permutations and transposes Wednesday, February 1th Math 01 Week # 1 The LU Decomposition We learned last time that we can factor a invertible matrix
More informationMATH 3511 Lecture 1. Solving Linear Systems 1
MATH 3511 Lecture 1 Solving Linear Systems 1 Dmitriy Leykekhman Spring 2012 Goals Review of basic linear algebra Solution of simple linear systems Gaussian elimination D Leykekhman - MATH 3511 Introduction
More informationDirect Methods for Solving Linear Systems. Matrix Factorization
Direct Methods for Solving Linear Systems Matrix Factorization Numerical Analysis (9th Edition) R L Burden & J D Faires Beamer Presentation Slides prepared by John Carroll Dublin City University c 2011
More informationLinear Algebraic Equations
Linear Algebraic Equations 1 Fundamentals Consider the set of linear algebraic equations n a ij x i b i represented by Ax b j with [A b ] [A b] and (1a) r(a) rank of A (1b) Then Axb has a solution iff
More informationBASIC COURSE ON NUMERICAL COMPUTATION: PRACTICAL WORK
BASIC COURSE ON NUMERICAL COMPUTATION: PRACTICAL WORK M. LAINE Abstract. We solved the Poisson equation using the finite difference approximation and the conjugate gradient (CG) method, with and without
More informationCEE 618 Scientific Parallel Computing (Lecture 12)
1 / 26 CEE 618 Scientific Parallel Computing (Lecture 12) Dissipative Hydrodynamics (DHD) Albert S. Kim Department of Civil and Environmental Engineering University of Hawai i at Manoa 2540 Dole Street,
More informationSolution of Linear Equations
Solution of Linear Equations (Com S 477/577 Notes) Yan-Bin Jia Sep 7, 07 We have discussed general methods for solving arbitrary equations, and looked at the special class of polynomial equations A subclass
More informationPowerPoints organized by Dr. Michael R. Gustafson II, Duke University
Part 3 Chapter 10 LU Factorization PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
More informationEigenvalue problems. Eigenvalue problems
Determination of eigenvalues and eigenvectors Ax x, where A is an N N matrix, eigenvector x 0, and eigenvalues are in general complex numbers In physics: - Energy eigenvalues in a quantum mechanical system
More informationFORCE ENERGY. only if F = F(r). 1 Nano-scale (10 9 m) 2 Nano to Micro-scale (10 6 m) 3 Nano to Meso-scale (10 3 m)
What is the force? CEE 618 Scientific Parallel Computing (Lecture 12) Dissipative Hydrodynamics (DHD) Albert S. Kim Department of Civil and Environmental Engineering University of Hawai i at Manoa 2540
More informationToday s class. Linear Algebraic Equations LU Decomposition. Numerical Methods, Fall 2011 Lecture 8. Prof. Jinbo Bi CSE, UConn
Today s class Linear Algebraic Equations LU Decomposition 1 Linear Algebraic Equations Gaussian Elimination works well for solving linear systems of the form: AX = B What if you have to solve the linear
More informationSystems of Linear Equations
Systems of Linear Equations Last time, we found that solving equations such as Poisson s equation or Laplace s equation on a grid is equivalent to solving a system of linear equations. There are many other
More informationThomas Algorithm for Tridiagonal Matrix
P a g e 1 Thomas Algorithm for Tridiagonal Matrix Special Matrices Some matrices have a particular structure that can be exploited to develop efficient solution schemes. Two of those such systems are banded
More informationDEN: Linear algebra numerical view (GEM: Gauss elimination method for reducing a full rank matrix to upper-triangular
form) Given: matrix C = (c i,j ) n,m i,j=1 ODE and num math: Linear algebra (N) [lectures] c phabala 2016 DEN: Linear algebra numerical view (GEM: Gauss elimination method for reducing a full rank matrix
More informationF08BEF (SGEQPF/DGEQPF) NAG Fortran Library Routine Document
NAG Fortran Library Routine Document Note. Before using this routine, please read the Users Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent
More informationLecture 2 INF-MAT : , LU, symmetric LU, Positve (semi)definite, Cholesky, Semi-Cholesky
Lecture 2 INF-MAT 4350 2009: 7.1-7.6, LU, symmetric LU, Positve (semi)definite, Cholesky, Semi-Cholesky Tom Lyche and Michael Floater Centre of Mathematics for Applications, Department of Informatics,
More informationIntel Math Kernel Library (Intel MKL) LAPACK
Intel Math Kernel Library (Intel MKL) LAPACK Linear equations Victor Kostin Intel MKL Dense Solvers team manager LAPACK http://www.netlib.org/lapack Systems of Linear Equations Linear Least Squares Eigenvalue
More informationLinear Systems of n equations for n unknowns
Linear Systems of n equations for n unknowns In many application problems we want to find n unknowns, and we have n linear equations Example: Find x,x,x such that the following three equations hold: x
More informationModule 5.2: nag sym lin sys Symmetric Systems of Linear Equations. Contents
Linear Equations Module Contents Module 5.2: nag sym lin sys Symmetric Systems of Linear Equations nag sym lin sys provides a procedure for solving real or complex, symmetric or Hermitian systems of linear
More informationCS412: Lecture #17. Mridul Aanjaneya. March 19, 2015
CS: Lecture #7 Mridul Aanjaneya March 9, 5 Solving linear systems of equations Consider a lower triangular matrix L: l l l L = l 3 l 3 l 33 l n l nn A procedure similar to that for upper triangular systems
More informationNumerical Linear Algebra
Numerical Linear Algebra Direct Methods Philippe B. Laval KSU Fall 2017 Philippe B. Laval (KSU) Linear Systems: Direct Solution Methods Fall 2017 1 / 14 Introduction The solution of linear systems is one
More informationReview of Vectors and Matrices
A P P E N D I X D Review of Vectors and Matrices D. VECTORS D.. Definition of a Vector Let p, p, Á, p n be any n real numbers and P an ordered set of these real numbers that is, P = p, p, Á, p n Then P
More informationThis ensures that we walk downhill. For fixed λ not even this may be the case.
Gradient Descent Objective Function Some differentiable function f : R n R. Gradient Descent Start with some x 0, i = 0 and learning rate λ repeat x i+1 = x i λ f(x i ) until f(x i+1 ) ɛ Line Search Variant
More informationRoundoff Error. Monday, August 29, 11
Roundoff Error A round-off error (rounding error), is the difference between the calculated approximation of a number and its exact mathematical value. Numerical analysis specifically tries to estimate
More informationLinear Algebra: Characteristic Value Problem
Linear Algebra: Characteristic Value Problem . The Characteristic Value Problem Let < be the set of real numbers and { be the set of complex numbers. Given an n n real matrix A; does there exist a number
More informationLecture 8: Fast Linear Solvers (Part 7)
Lecture 8: Fast Linear Solvers (Part 7) 1 Modified Gram-Schmidt Process with Reorthogonalization Test Reorthogonalization If Av k 2 + δ v k+1 2 = Av k 2 to working precision. δ = 10 3 2 Householder Arnoldi
More informationLecture 6. Numerical methods. Approximation of functions
Lecture 6 Numerical methods Approximation of functions Lecture 6 OUTLINE 1. Approximation and interpolation 2. Least-square method basis functions design matrix residual weighted least squares normal equation
More informationSolving linear systems (6 lectures)
Chapter 2 Solving linear systems (6 lectures) 2.1 Solving linear systems: LU factorization (1 lectures) Reference: [Trefethen, Bau III] Lecture 20, 21 How do you solve Ax = b? (2.1.1) In numerical linear
More informationMAT 2037 LINEAR ALGEBRA I web:
MAT 237 LINEAR ALGEBRA I 2625 Dokuz Eylül University, Faculty of Science, Department of Mathematics web: Instructor: Engin Mermut http://kisideuedutr/enginmermut/ HOMEWORK 2 MATRIX ALGEBRA Textbook: Linear
More informationNAG Library Routine Document F07HAF (DPBSV)
NAG Library Routine Document (DPBSV) Note: before using this routine, please read the Users Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent
More informationSection 4.5 Eigenvalues of Symmetric Tridiagonal Matrices
Section 4.5 Eigenvalues of Symmetric Tridiagonal Matrices Key Terms Symmetric matrix Tridiagonal matrix Orthogonal matrix QR-factorization Rotation matrices (plane rotations) Eigenvalues We will now complete
More informationLINEAR SYSTEMS (11) Intensive Computation
LINEAR SYSTEMS () Intensive Computation 27-8 prof. Annalisa Massini Viviana Arrigoni EXACT METHODS:. GAUSSIAN ELIMINATION. 2. CHOLESKY DECOMPOSITION. ITERATIVE METHODS:. JACOBI. 2. GAUSS-SEIDEL 2 CHOLESKY
More informationy b where U. matrix inverse A 1 ( L. 1 U 1. L 1 U 13 U 23 U 33 U 13 2 U 12 1
LU decomposition -- manual demonstration Instructor: Nam Sun Wang lu-manualmcd LU decomposition, where L is a lower-triangular matrix with as the diagonal elements and U is an upper-triangular matrix Just
More informationNumerical Linear Algebra
Numerical Linear Algebra By: David McQuilling; Jesus Caban Deng Li Jan.,31,006 CS51 Solving Linear Equations u + v = 8 4u + 9v = 1 A x b 4 9 u v = 8 1 Gaussian Elimination Start with the matrix representation
More informationGEOS Chem v7 Adjoint User's Guide
GEOS Chem v7 Adjoint User's Guide An adjoint model for GEOS-Chem to perform 4D-Var Data Assimilation and Sensitivity Analysis Kumaresh Singh, Adrian Sandu & Paul Eller Department of Computer Science Virginia
More informationMatrix Eigensystem Tutorial For Parallel Computation
Matrix Eigensystem Tutorial For Parallel Computation High Performance Computing Center (HPC) http://www.hpc.unm.edu 5/21/2003 1 Topic Outline Slide Main purpose of this tutorial 5 The assumptions made
More informationElementary Linear Algebra
Matrices J MUSCAT Elementary Linear Algebra Matrices Definition Dr J Muscat 2002 A matrix is a rectangular array of numbers, arranged in rows and columns a a 2 a 3 a n a 2 a 22 a 23 a 2n A = a m a mn We
More informationNAG Library Routine Document F08QUF (ZTRSEN)
F08 Least-squares and Eigenvalue Problems (LAPACK) F08QUF NAG Library Routine Document F08QUF (ZTRSEN) Note: before using this routine, please read the Users Note for your implementation to check the interpretation
More informationPHYS-4007/5007: Computational Physics Course Lecture Notes Section VII
PHYS-4007/5007: Computational Physics Course Lecture Notes Section VII Dr Donald G Luttermoser East Tennessee State University Version 71 Abstract These class notes are designed for use of the instructor
More informationMatrix decompositions
Matrix decompositions Zdeněk Dvořák May 19, 2015 Lemma 1 (Schur decomposition). If A is a symmetric real matrix, then there exists an orthogonal matrix Q and a diagonal matrix D such that A = QDQ T. The
More informationFirst example, moments of inertia. I m,n = m i r 2 i m,n. m i r i,m r i,n. Symmetric second rank tensor x. i =1
Eigenvalue Problems Eigenvalue problems arise in many contexts in physics. In matrix form, Ax = x This is somewhat different from our previous SLE, which had the form Ax = b where A, b were assumed known.
More information5. Surface Temperatures
5. Surface Temperatures For this case we are given a thin rectangular sheet of metal, whose temperature we can conveniently measure at any points along its four edges. If the edge temperatures are held
More information2.3 LU Decomposition and Its Applications
2.3 LU Decomposition and Its Applications 43 Isaacson, E., and Keller, H.B. 1966, Analysis of Numerical Methods (New York: Wiley), 2.1. Johnson, L.W., and Riess, R.D. 1982, Numerical Analysis, 2nd ed.
More informationF04JGF NAG Fortran Library Routine Document
F4 Simultaneous Linear Equations F4JGF NAG Fortran Library Routine Document Note. Before using this routine, please read the Users Note for your implementation to check the interpretation of bold italicised
More informationNumerical Linear Algebra
Chapter 3 Numerical Linear Algebra We review some techniques used to solve Ax = b where A is an n n matrix, and x and b are n 1 vectors (column vectors). We then review eigenvalues and eigenvectors and
More informationModule 6.6: nag nsym gen eig Nonsymmetric Generalized Eigenvalue Problems. Contents
Eigenvalue and Least-squares Problems Module Contents Module 6.6: nag nsym gen eig Nonsymmetric Generalized Eigenvalue Problems nag nsym gen eig provides procedures for solving nonsymmetric generalized
More informationNumerical Methods I Solving Square Linear Systems: GEM and LU factorization
Numerical Methods I Solving Square Linear Systems: GEM and LU factorization Aleksandar Donev Courant Institute, NYU 1 donev@courant.nyu.edu 1 MATH-GA 2011.003 / CSCI-GA 2945.003, Fall 2014 September 18th,
More informationNAG Fortran Library Routine Document F04CFF.1
F04 Simultaneous Linear Equations NAG Fortran Library Routine Document Note: before using this routine, please read the Users Note for your implementation to check the interpretation of bold italicised
More informationLecture 13 Stability of LU Factorization; Cholesky Factorization. Songting Luo. Department of Mathematics Iowa State University
Lecture 13 Stability of LU Factorization; Cholesky Factorization Songting Luo Department of Mathematics Iowa State University MATH 562 Numerical Analysis II ongting Luo ( Department of Mathematics Iowa
More informationExample: Current in an Electrical Circuit. Solving Linear Systems:Direct Methods. Linear Systems of Equations. Solving Linear Systems: Direct Methods
Example: Current in an Electrical Circuit Solving Linear Systems:Direct Methods A number of engineering problems or models can be formulated in terms of systems of equations Examples: Electrical Circuit
More informationAlgebraic Equations. 2.0 Introduction. Nonsingular versus Singular Sets of Equations. A set of linear algebraic equations looks like this:
Chapter 2. 2.0 Introduction Solution of Linear Algebraic Equations A set of linear algebraic equations looks like this: a 11 x 1 + a 12 x 2 + a 13 x 3 + + a 1N x N = b 1 a 21 x 1 + a 22 x 2 + a 23 x 3
More informationMAT 343 Laboratory 3 The LU factorization
In this laboratory session we will learn how to MAT 343 Laboratory 3 The LU factorization 1. Find the LU factorization of a matrix using elementary matrices 2. Use the MATLAB command lu to find the LU
More informationNumerical Solution Techniques in Mechanical and Aerospace Engineering
Numerical Solution Techniques in Mechanical and Aerospace Engineering Chunlei Liang LECTURE 3 Solvers of linear algebraic equations 3.1. Outline of Lecture Finite-difference method for a 2D elliptic PDE
More informationProcess Model Formulation and Solution, 3E4
Process Model Formulation and Solution, 3E4 Section B: Linear Algebraic Equations Instructor: Kevin Dunn dunnkg@mcmasterca Department of Chemical Engineering Course notes: Dr Benoît Chachuat 06 October
More information1.Chapter Objectives
LU Factorization INDEX 1.Chapter objectives 2.Overview of LU factorization 2.1GAUSS ELIMINATION AS LU FACTORIZATION 2.2LU Factorization with Pivoting 2.3 MATLAB Function: lu 3. CHOLESKY FACTORIZATION 3.1
More informationScientific Computing
Scientific Computing Direct solution methods Martin van Gijzen Delft University of Technology October 3, 2018 1 Program October 3 Matrix norms LU decomposition Basic algorithm Cost Stability Pivoting Pivoting
More informationCOMP 558 lecture 18 Nov. 15, 2010
Least squares We have seen several least squares problems thus far, and we will see more in the upcoming lectures. For this reason it is good to have a more general picture of these problems and how to
More informationSolution of Linear systems
Solution of Linear systems Direct Methods Indirect Methods -Elimination Methods -Inverse of a matrix -Cramer s Rule -LU Decomposition Iterative Methods 2 A x = y Works better for coefficient matrices with
More information5.7 Cramer's Rule 1. Using Determinants to Solve Systems Assumes the system of two equations in two unknowns
5.7 Cramer's Rule 1. Using Determinants to Solve Systems Assumes the system of two equations in two unknowns (1) possesses the solution and provided that.. The numerators and denominators are recognized
More informationChapter 4 - MATRIX ALGEBRA. ... a 2j... a 2n. a i1 a i2... a ij... a in
Chapter 4 - MATRIX ALGEBRA 4.1. Matrix Operations A a 11 a 12... a 1j... a 1n a 21. a 22.... a 2j... a 2n. a i1 a i2... a ij... a in... a m1 a m2... a mj... a mn The entry in the ith row and the jth column
More informationM.SC. PHYSICS - II YEAR
MANONMANIAM SUNDARANAR UNIVERSITY DIRECTORATE OF DISTANCE & CONTINUING EDUCATION TIRUNELVELI 627012, TAMIL NADU M.SC. PHYSICS - II YEAR DKP26 - NUMERICAL METHODS (From the academic year 2016-17) Most Student
More informationAdaptive Spike-Based Solver 1.0 User Guide
Intel r Adaptive Spike-Based Solver 10 User Guide I V 1 W 2 I V 2 W 3 I V 3 W 4 I 1 Contents 1 Overview 4 11 A Quick What, Why, and How 4 12 A Hello World Example 7 13 Future Developments 8 14 User Guide
More informationLinear Algebraic Equations
Linear Algebraic Equations Linear Equations: a + a + a + a +... + a = c 11 1 12 2 13 3 14 4 1n n 1 a + a + a + a +... + a = c 21 2 2 23 3 24 4 2n n 2 a + a + a + a +... + a = c 31 1 32 2 33 3 34 4 3n n
More informationLinear Algebra March 16, 2019
Linear Algebra March 16, 2019 2 Contents 0.1 Notation................................ 4 1 Systems of linear equations, and matrices 5 1.1 Systems of linear equations..................... 5 1.2 Augmented
More informationDirect Methods for solving Linear Equation Systems
REVIEW Lecture 5: Systems of Linear Equations Spring 2015 Lecture 6 Direct Methods for solving Linear Equation Systems Determinants and Cramer s Rule Gauss Elimination Algorithm Forward Elimination/Reduction
More informationLinear Equations and Matrix
1/60 Chia-Ping Chen Professor Department of Computer Science and Engineering National Sun Yat-sen University Linear Algebra Gaussian Elimination 2/60 Alpha Go Linear algebra begins with a system of linear
More informationChapter 1: Systems of Linear Equations and Matrices
: Systems of Linear Equations and Matrices Multiple Choice Questions. Which of the following equations is linear? (A) x + 3x 3 + 4x 4 3 = 5 (B) 3x x + x 3 = 5 (C) 5x + 5 x x 3 = x + cos (x ) + 4x 3 = 7.
More informationNAG Library Routine Document F08FAF (DSYEV)
NAG Library Routine Document (DSYEV) Note: before using this routine, please read the Users Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent
More informationNumerical Linear Algebra Primer. Ryan Tibshirani Convex Optimization /36-725
Numerical Linear Algebra Primer Ryan Tibshirani Convex Optimization 10-725/36-725 Last time: proximal gradient descent Consider the problem min g(x) + h(x) with g, h convex, g differentiable, and h simple
More informationPractical Linear Algebra: A Geometry Toolbox
Practical Linear Algebra: A Geometry Toolbox Third edition Chapter 12: Gauss for Linear Systems Gerald Farin & Dianne Hansford CRC Press, Taylor & Francis Group, An A K Peters Book www.farinhansford.com/books/pla
More informationNote Set 3 Numerical Linear Algebra
Note Set 3 Numerical Linear Algebra 3.1 Overview Numerical linear algebra includes a class of problems which involves multiplying vectors and matrices, solving linear equations, computing the inverse of
More informationPositive Definite Matrix
1/29 Chia-Ping Chen Professor Department of Computer Science and Engineering National Sun Yat-sen University Linear Algebra Positive Definite, Negative Definite, Indefinite 2/29 Pure Quadratic Function
More informationReview of matrices. Let m, n IN. A rectangle of numbers written like A =
Review of matrices Let m, n IN. A rectangle of numbers written like a 11 a 12... a 1n a 21 a 22... a 2n A =...... a m1 a m2... a mn where each a ij IR is called a matrix with m rows and n columns or an
More informationLecture 10: Eigenvectors and eigenvalues (Numerical Recipes, Chapter 11)
Lecture 1: Eigenvectors and eigenvalues (Numerical Recipes, Chapter 11) The eigenvalue problem, Ax= λ x, occurs in many, many contexts: classical mechanics, quantum mechanics, optics 22 Eigenvectors and
More information7.2 Linear equation systems. 7.3 Linear least square fit
72 Linear equation systems In the following sections, we will spend some time to solve linear systems of equations This is a tool that will come in handy in many di erent places during this course For
More informationComputational Linear Algebra
Computational Linear Algebra PD Dr. rer. nat. habil. Ralf Peter Mundani Computation in Engineering / BGU Scientific Computing in Computer Science / INF Winter Term 2017/18 Part 2: Direct Methods PD Dr.
More informationPackage geigen. August 22, 2017
Version 2.1 Package geigen ugust 22, 2017 Title Calculate Generalized Eigenvalues, the Generalized Schur Decomposition and the Generalized Singular Value Decomposition of a Matrix Pair with Lapack Date
More informationGaussian Elimination and Back Substitution
Jim Lambers MAT 610 Summer Session 2009-10 Lecture 4 Notes These notes correspond to Sections 31 and 32 in the text Gaussian Elimination and Back Substitution The basic idea behind methods for solving
More information6 Linear Systems of Equations
6 Linear Systems of Equations Read sections 2.1 2.3, 2.4.1 2.4.5, 2.4.7, 2.7 Review questions 2.1 2.37, 2.43 2.67 6.1 Introduction When numerically solving two-point boundary value problems, the differential
More information1 Multiply Eq. E i by λ 0: (λe i ) (E i ) 2 Multiply Eq. E j by λ and add to Eq. E i : (E i + λe j ) (E i )
Direct Methods for Linear Systems Chapter Direct Methods for Solving Linear Systems Per-Olof Persson persson@berkeleyedu Department of Mathematics University of California, Berkeley Math 18A Numerical
More informationLecture 1: Basics Concepts
National Technical University of Athens School of Chemical Engineering Department II: Process Analysis and Plant Design Lecture 1: Basics Concepts Instructor: Α. Kokossis Laboratory teaching staff: Α.
More informationCE 206: Engineering Computation Sessional. System of Linear Equations
CE 6: Engineering Computation Sessional System of Linear Equations Gauss Elimination orward elimination Starting with the first row, add or subtract multiples of that row to eliminate the first coefficient
More information12/1/2015 LINEAR ALGEBRA PRE-MID ASSIGNMENT ASSIGNED BY: PROF. SULEMAN SUBMITTED BY: M. REHAN ASGHAR BSSE 4 ROLL NO: 15126
12/1/2015 LINEAR ALGEBRA PRE-MID ASSIGNMENT ASSIGNED BY: PROF. SULEMAN SUBMITTED BY: M. REHAN ASGHAR Cramer s Rule Solving a physical system of linear equation by using Cramer s rule Cramer s rule is really
More informationMATHEMATICS FOR COMPUTER VISION WEEK 2 LINEAR SYSTEMS. Dr Fabio Cuzzolin MSc in Computer Vision Oxford Brookes University Year
1 MATHEMATICS FOR COMPUTER VISION WEEK 2 LINEAR SYSTEMS Dr Fabio Cuzzolin MSc in Computer Vision Oxford Brookes University Year 2013-14 OUTLINE OF WEEK 2 Linear Systems and solutions Systems of linear
More information. =. a i1 x 1 + a i2 x 2 + a in x n = b i. a 11 a 12 a 1n a 21 a 22 a 1n. i1 a i2 a in
Vectors and Matrices Continued Remember that our goal is to write a system of algebraic equations as a matrix equation. Suppose we have the n linear algebraic equations a x + a 2 x 2 + a n x n = b a 2
More information5 Solving Systems of Linear Equations
106 Systems of LE 5.1 Systems of Linear Equations 5 Solving Systems of Linear Equations 5.1 Systems of Linear Equations System of linear equations: a 11 x 1 + a 12 x 2 +... + a 1n x n = b 1 a 21 x 1 +
More informationAssignment #10: Diagonalization of Symmetric Matrices, Quadratic Forms, Optimization, Singular Value Decomposition. Name:
Assignment #10: Diagonalization of Symmetric Matrices, Quadratic Forms, Optimization, Singular Value Decomposition Due date: Friday, May 4, 2018 (1:35pm) Name: Section Number Assignment #10: Diagonalization
More informationNAG Library Routine Document F08PNF (ZGEES)
F08 Least-squares and Eigenvalue Problems (LAPACK) F08PNF NAG Library Routine Document F08PNF (ZGEES) Note: before using this routine, please read the Users Note for your implementation to check the interpretation
More informationlecture 2 and 3: algorithms for linear algebra
lecture 2 and 3: algorithms for linear algebra STAT 545: Introduction to computational statistics Vinayak Rao Department of Statistics, Purdue University August 27, 2018 Solving a system of linear equations
More informationSolving Linear Systems
Solving Linear Systems Iterative Solutions Methods Philippe B. Laval KSU Fall 2015 Philippe B. Laval (KSU) Linear Systems Fall 2015 1 / 12 Introduction We continue looking how to solve linear systems of
More informationMATH Topics in Applied Mathematics Lecture 12: Evaluation of determinants. Cross product.
MATH 311-504 Topics in Applied Mathematics Lecture 12: Evaluation of determinants. Cross product. Determinant is a scalar assigned to each square matrix. Notation. The determinant of a matrix A = (a ij
More informationSolving Linear Systems
Solving Linear Systems Iterative Solutions Methods Philippe B. Laval KSU Fall 207 Philippe B. Laval (KSU) Linear Systems Fall 207 / 2 Introduction We continue looking how to solve linear systems of the
More informationMultivariate Statistical Analysis
Multivariate Statistical Analysis Fall 2011 C. L. Williams, Ph.D. Lecture 4 for Applied Multivariate Analysis Outline 1 Eigen values and eigen vectors Characteristic equation Some properties of eigendecompositions
More information6. Iterative Methods for Linear Systems. The stepwise approach to the solution...
6 Iterative Methods for Linear Systems The stepwise approach to the solution Miriam Mehl: 6 Iterative Methods for Linear Systems The stepwise approach to the solution, January 18, 2013 1 61 Large Sparse
More informationThe following steps will help you to record your work and save and submit it successfully.
MATH 22AL Lab # 4 1 Objectives In this LAB you will explore the following topics using MATLAB. Properties of invertible matrices. Inverse of a Matrix Explore LU Factorization 2 Recording and submitting
More informationThere is another matrix factorization that is sometimes very useful, the so-called QR decomposition, A = Q R (2.10.1)
2.10 QR Decomposition 91 x(i)=sum/p(i) do 14 i=n,1,-1 Solve L T x = y. sum=x(i) do 13 k=i+1,n sum=sum-a(k,i)*x(k) x(i)=sum/p(i) A typical use of choldc and cholsl is in the inversion of covariance matrices
More information1-D Convection-Diffusion Lab
Computational Fluid Dynamics -D Convection-Diffusion Lab The lab. uses scientificworkplace symbolic calculus and maths editor software (SWP) This file Concevtion-Diffusion-Lab is available from Blackboard
More informationChap 3. Linear Algebra
Chap 3. Linear Algebra Outlines 1. Introduction 2. Basis, Representation, and Orthonormalization 3. Linear Algebraic Equations 4. Similarity Transformation 5. Diagonal Form and Jordan Form 6. Functions
More information