SlideShare a Scribd company logo
Solving Poisson Equation using
Conjugate Gradient Method
and its implementation
Jongsu Kim
Theoretical
From the Basics, Ax=b
Linear Systems
𝐴𝑥 = 𝑏
Goal of this presentation
What have you learned?
• Direct Method
• Gauss Elimination
• Thomas Algorithm (TDMA) (for tridiagonal matrix only)
• Iterative Method
• Jacobi method
• SOR method
• Conjugate Gradient Method
• Red Black Jacobi Method
Iterative Method
Start with decomposition
𝐴 = 𝐷 − 𝐸 − 𝐹
Jacobi Method
𝑥 𝑘+1 = 𝐷−1 𝐸 + 𝐹 𝑥 𝑘 + 𝐷−1 𝑏
Gauss-Seidel Method
𝑥 𝑘+1 = (𝐷 − 𝐸)−1
𝐹𝑥 𝑘 + 𝐷 − 𝐸 −1
𝑏
𝐴𝑥 = 𝑏
Backward Gauss-Seidel Iteration
𝐷 − 𝐹 𝑥 𝑘+1 = 𝐸𝑥 𝑘 + 𝑏
(𝑖 = 1, … , 𝑛 − 1, 𝑛)
(𝑖 = 𝑛, 𝑛 − 1 … , )
Splitting of A matrix
Previous method has a common form
𝐴 = 𝐷 − 𝐸 − 𝐹
𝑥 𝑘+1 = 𝐷−1 𝐸 + 𝐹 𝑥 𝑘 + 𝐷−1 𝑏
𝑥 𝑘+1 = (𝐷 − 𝐸)−1 𝐹𝑥 𝑘 + 𝐷 − 𝐸 −1 𝑏
𝐴𝑥 = 𝑏
𝐷 − 𝐹 𝑥 𝑘+1 = 𝐸𝑥 𝑘 + 𝑏
𝑴𝒙 𝒌+𝟏 = 𝑵𝒙 𝒌 + 𝒃 = 𝑴 − 𝑨 𝒙 𝒌 + 𝒃
𝑨 = 𝑴 − 𝑵
Introducing SOR (Successive Over Relaxation) method
𝝎𝑨 = 𝑫 − 𝝎𝑬 − (𝝎𝑭 + 𝟏 − 𝝎 𝑫)
𝑫 − 𝝎𝑬 𝒙 𝒌+𝟏 = 𝝎𝑭 + 𝟏 − 𝝎 𝑫 𝒙 𝒌 + 𝝎𝒃
SOR to SSOR
Gauss Seidel method
𝑥 𝑘+1 = (𝐷 − 𝐸)−1
𝐹𝑥 𝑘 + 𝐷 − 𝐸 −1
𝑏
SOR (Successive Over Relaxation) method
𝐷 − 𝜔𝐸 𝑥 𝑘+1 = 𝜔𝐹 + 1 − 𝜔 𝐷 𝑥 𝑘 + 𝜔𝑏
(𝐷 − 𝐸)𝑥 𝑘+1= 𝐹𝑥 𝑘 + 𝑏
𝐷 − 𝐹 𝑥 𝑘+1 = 𝐸𝑥 𝑘 + 𝑏
Backward Gauss Seidel method
Backward SOR method
𝐷 − 𝜔𝐹 𝑥 𝑘+1 = 𝜔𝐸 + 1 − 𝜔 𝐷 𝑥 𝑘 + 𝜔𝑏
SSOR method
SSOR (Symmetric Successive Over Relaxation) method
SOR step followed by backward SOR step for symmetric matrix
𝐷 − 𝜔𝐸 𝑥 𝑘+1/2 = 𝜔𝐹 + 1 − 𝜔 𝐷 𝑥 𝑘 + 𝜔𝑏
𝐷 − 𝜔𝐹 𝑥 𝑘+1 = 𝜔𝐸 + 1 − 𝜔 𝐷 𝑥 𝑘+1/2 + 𝜔𝑏
𝑥 𝑘+1 = 𝑮 𝝎 𝑥 𝑘 + 𝒇 𝝎
𝑮 𝝎 = 𝐷 − 𝜔𝐹 −1 𝜔𝐸 + 1 − 𝜔 𝐷 × 𝐷 − 𝜔𝐸 −1 𝜔𝐹 + 1 − 𝜔 𝐷
𝒇 𝝎 = 𝜔 𝐷 − 𝜔𝐹 −1
𝐼 + 𝜔𝐸 + 1 − 𝜔 𝐷 𝐷 − 𝜔𝐸 −1
𝑏
Observing that
𝜔𝐸 + 1 − 𝜔 𝐷 𝐷 − 𝜔𝐸 −1 = − 𝐷 − 𝜔𝐸 + 2 − 𝜔 𝐷 𝐷 − 𝜔𝐸 −1
= −𝐼 + 2 − 𝜔 𝐷 𝐷 − 𝜔𝐸 −1
𝒇 𝝎 = 𝜔 2 − 𝜔 𝐷 − 𝜔𝐹 −1
𝐷 𝐷 − 𝜔𝐸 −1
𝑏
Used as preconditioner (explain later)
Preconditioned System
𝒙 𝒌+𝟏 = 𝑮 𝝎 𝒙 𝒌 + 𝒇 𝝎
𝐺 𝐺𝑆 𝐴 = 𝐼 − (𝐷 − 𝐸)−1 𝐴𝐺𝐽𝐴 𝐴 = 𝐼 − 𝐷−1 𝐴,
𝒙 𝒌+𝟏 = 𝑴−𝟏
𝑵𝒙 𝒌 + 𝑴−𝟏
𝒃
We have two forms for iterative method
Ex)
𝐺 = 𝑀−1
𝑁 = 𝑀−1
𝑀 − 𝐴 = 𝐼 − 𝑀−1
𝐴 𝑓 = 𝑀−1
𝑏
𝐼 − 𝐺 𝑥 = 𝑓
Another view…
[𝐼 − (𝐼 − 𝑀−1
𝐴)]𝑥 = 𝑓
𝑀−1
𝐴𝑥 = 𝑓
𝑴−𝟏
𝑨𝒙 = 𝑴−𝟏
𝒃 Preconditioner 𝑀
Preconditioned System
𝑴−𝟏
𝑨𝒙 = 𝑴−𝟏
𝒃 With Preconditioner 𝑀
𝑀 𝐺𝑆 = 𝐷 − 𝐸Gauss-Seidel
𝑀𝑆𝑆𝑂𝑅 =
1
𝜔 2 − 𝜔
𝐷 − 𝜔𝐸 𝐷−1
(𝐷 − 𝜔𝐹)SSOR
𝑀𝐽𝐴 = 𝐷Jacobi
𝑀𝐽𝐴 =
1
𝜔
(𝐷 − 𝜔𝐸)SOR
It may not be “SPARSE” due to inverse (𝑀−1)
How to compute this?
𝑤 = 𝑀−1
𝐴𝑣 𝑟 = 𝐴𝑣 and 𝑀𝑤 = 𝑟
𝐴𝑣 might be expensive. Much better?
𝑤 = 𝑀−1 𝐴𝑣 = 𝑀−1 𝑀 − 𝑁 𝑣 = 𝐼 − 𝑀−1 𝑁 𝑣
𝑟 = 𝑁𝑣
𝑤 = 𝑀−1
𝑟
𝑤 ≔ 𝑣 − 𝑤
N may be sparser than A
and less expensive than 𝐴𝑣
Minimization Problem
Forget about 𝐴𝑥 = 𝑏 temporarily, but thinking about some quadratic function 𝑓
Function Matrix
𝑓(x) =
1
2
𝐴𝑥2
− 𝑏𝑥 + 𝑐 𝑓 𝑥 =
1
2
𝑥 𝑇
𝐴𝑥 − 𝑏 𝑇
𝑥 + 𝑐
𝑓′
x = 𝐴𝑥 − b 𝑓′ x =
1
2
𝐴 𝑇 𝑥 +
1
2
A𝑥 − b
If Matrix 𝐴 is symmetric, 𝐴 𝑇
= 𝐴, then
𝒇′ 𝒙 = 𝑨𝒙 − 𝒃
Setting the gradient to zero, we get the linear system we wish to solve.
Our original GOAL!!
(a) Quadratic form for a positive
definite matrix
(b) Quadratic form for a negative
definite matrix
(c) Singular (and positive-indefinite)
matrix; A line that runs through
bottom of the valley is the set of
solutions
(d) For an indefinite matrix. Saddle
point.
For a Symmetric and Positive Definite Matrix, minimizing
𝑓 𝑥 =
1
2
𝑥 𝑇 𝐴𝑥 − 𝑏 𝑇 𝑥 + 𝑐
Reduced to our solution
Minimization Problem
Steep Descent Method
Choose direction in which 𝑓 decrease most quickly, which is the direction opposite 𝑓′(𝑥 𝑖 )
𝑟(𝑖) = 𝑏 − 𝐴𝑥(𝑖)
−𝑓′ 𝑥 𝑖 = 𝑟(𝑖) = 𝑏 − 𝐴𝑥(𝑖)
𝑥(1) = 𝑥(0) + 𝛼𝑟(0)
To Find 𝛼, set
𝑑
𝑑𝛼
𝑓 𝑥 1 = 0
𝑑
𝑑𝛼
𝑓 𝑥 1 = 𝑓′
𝑥 1
𝑇 𝑑
𝑑𝛼
𝑥(1) = 𝑓′
𝑥 1
𝑇
𝑟(0)
𝑓′
𝑥 𝑖+1
𝑇
and 𝑟(𝑖) are orthogonal!
−𝑓′
𝑥 𝑖+1 = 𝑟(𝑖+1)
𝑓′
𝑥 𝑖+1
𝑇
𝑟(𝑖) = 0
𝑟 𝑖+1
𝑇
𝑟(𝑖) = 0
𝜶 =
𝒓 𝒊
𝑻
𝒓 𝒊
𝒓(𝒊)
𝑻
𝑨𝒓(𝒊)
Conjugate Gradient Method
Steep Descent Method not always converge well
Worst case of steep descent method
• Solid lines : worst convergence line
• Dashed line : steps toward convergence
Why it doesn’t directly go along line for fast
convergence? → related to eigen value
problem
Introducing Conjugate Gradient method
Conjugate Gradient Method
What is the meaning of conjugate?
• Definition : A binomial formed by negating the second term of binomial
• 𝑥 + 𝑦 ← conjugate → 𝑥 − 𝑦
Then, what is the meaning of conjugate gradient?
• Steep descent method often finds itself taking steps in the same direction
• Wouldn’t it better if we got it right the every step?
• Here is a step
• error 𝑒(𝑖) = 𝑥(𝑖) − 𝑥, residual 𝑟(𝑖) = 𝑏 − 𝐴𝑥(𝑖), 𝑑(𝑖) a set of orthogonal search
direction
• for each step, we choose a point 𝑥(𝑖+1) = 𝑥(𝑖) + 𝛼(𝑖) 𝑑(𝑖)
• To find 𝛼, 𝑒(𝑖+1) should be orthogonal to 𝑑(𝑖). (𝑒 𝑖+1 = 𝑒 𝑖 + 𝛼 𝑖 𝑑 𝑖 )
𝑑(𝑖)
𝑇
𝑒(𝑖+1) = 0
𝑑(𝑖)
𝑇
(𝑒 𝑖 +𝛼(𝑖) 𝑑(𝑖)) = 0
𝛼(𝑖) = −
𝑑 𝑖
𝑇
𝑒 𝑖
𝑑(𝑖)
𝑇
𝑑(𝑖)
We don’t know anything about 𝑒(𝑖), because if we know 𝑒(𝑖), it means we know the answer.
Conjugate Gradient Method
Instead of orthogonal, introduce 𝐴-orthogonal
𝒅(𝒊)
𝑻
𝑨𝒅(𝒋) = 𝟎, if 𝑑(𝑖) and 𝑑(𝑗) are 𝐴-orthogonal, or conjugate
𝒆(𝒊+𝟏) is 𝑨-orthogonal to 𝒅(𝒊), and this condition is equivalent to finding the minimum
point along the search direction 𝑑(𝑖) , as in steep descent method
𝑑
𝑑𝛼
𝑓 𝑥 𝑖+1 = 0
𝛼 minimize 𝑓 when directional
derivative is equal to zero
𝑓′ 𝑥 𝑖+1
𝑇 𝑑
𝑑𝛼
𝑥 𝑖+1 = 0
−𝑟 𝑖+1
𝑇
𝑑(𝑖) = 0
Chain rule
𝑓′ 𝑥(𝑖+1) = 𝐴𝑥(𝑖+1) − 𝑏
𝑟(𝑖) = 𝑏 − 𝐴𝑥(𝑖)
𝑥(𝑖+1) = 𝑥(𝑖) + 𝛼(𝑖) 𝑑(𝑖)
𝑑(𝑖)
𝑇
𝐴𝑒(𝑖+1) = 0 𝑥(𝑖+1)
𝑇
𝐴 𝑇
𝑑(𝑖) − 𝑏 𝑇
𝑑 𝑖 = 0
𝑥(𝑖+1)
𝑇
𝐴 𝑇
𝑑(𝑖) − 𝑥 𝑇
𝐴 𝑇
𝑑 𝑖 = 0
𝑒 𝑖+1
𝑇
𝐴 𝑇
𝑑(𝑖) = 0 Transpose again
How it can be same as orthogonality used in steep descent method?
𝑒(𝑖+1) = 𝑥(𝑖+1) − 𝑥
𝜶(𝒊) = −
𝒅 𝒊
𝑻
𝒓 𝒊
𝒅(𝒊)
𝑻
𝑨𝒅(𝒊)
Conjugate Gradient Method
𝑑(𝑖)
𝑇
𝐴𝑒(𝑖+1) = 0
𝑥(𝑖+1) = 𝑥(𝑖) + 𝛼𝑑(𝑖)
𝑒(𝑖+1) = (𝑥(𝑖) + 𝛼𝑟(𝑖)) − 𝑥
𝑑(𝑖)
𝑇
𝐴𝑒(𝑖+1) = 𝑑 𝑖
𝑇
𝐴((𝑥 𝑖 + 𝛼𝑑 𝑖 ) − 𝑥)
𝑑 𝑖
𝑇
𝐴𝑥(𝑖) + 𝛼𝑑 𝑖
𝑇
𝐴𝑑(𝑖) − 𝑑 𝑖
𝑇
𝐴𝑥 = 0
𝑑 𝑖
𝑇
𝐴𝑥 𝑖 − 𝑏 = −𝛼𝑑 𝑖
𝑇
𝐴𝑑(𝑖)
How to find 𝑑(𝑖)?
Gram-Schmidt Process
𝑑(𝑖) = 𝑢(𝑖) + Σk=0
𝑖−1
𝛽𝑖𝑘 𝑑(𝑘)
Find set of 𝐴-orthogonal vector
𝛽𝑖𝑘 = −
𝑢𝑖
𝑇
𝐴𝑑 𝑗
𝑑(𝑗)
𝑇
𝐴𝑑(𝑗)
For set of independent vectors 𝑢𝑖
due to 𝑑 𝑖
𝑇
𝐴𝑑(𝑗) = 0
𝑖 > 𝑗
Conjugate Gradient Method
Overall Algorithm
Initialization
𝑖 = 0
𝑟 = 𝑏 − 𝐴𝑥
𝑑 = 𝑟
𝛿 𝑛𝑒𝑤 = 𝑟 𝑇
𝑟
𝛿0 = 𝛿 𝑛𝑒𝑤
𝜖 = 1.0𝑒 − 6
Iteration check
While i<imax &&
𝛿 𝑛𝑒𝑤 > 𝜖2
𝛿0
Inside loop
𝑞 = 𝐴𝑑
𝛼 =
𝛿 𝑛𝑒𝑤
𝑑 𝑇 𝑞
𝑥 = 𝑥 + 𝛼𝑑
If 𝑖 is divisible by 50
𝑟 = 𝑏 − 𝐴𝑥
else
𝑟 = 𝑟 − 𝛼𝑞
endif
𝛿 𝑜𝑙𝑑 = 𝛿 𝑛𝑒𝑤
𝛿 𝑛𝑒𝑤 = 𝑟 𝑇 𝑟
𝛽 =
𝛿 𝑛𝑒𝑤
𝛿 𝑜𝑙𝑑
𝑑 = 𝑟 + 𝛽𝑑
𝑖 = 𝑖 + 1
Preconditioner Again
𝑴−𝟏
𝑨𝒙 = 𝑴−𝟏
𝒃 With Preconditioner 𝑀
𝑀 𝐺𝑆 = 𝐷 − 𝐸Gauss-Seidel
𝑀𝑆𝑆𝑂𝑅 =
1
𝜔 2 − 𝜔
𝐷 − 𝜔𝐸 𝐷−1
(𝐷 − 𝜔𝐹)SSOR
𝑀𝐽𝐴 = 𝐷Jacobi
𝑀𝐽𝐴 =
1
𝜔
(𝐷 − 𝜔𝐸)SOR
Incomplete LU Decomposition 𝐴 = 𝐿𝑈 − 𝑅 𝑅 : residual error
Incomplete Cholesky Decomposition 𝐴 = 𝐿𝐿 𝑇 − 𝑅
If A is SPD (Symmetric Positive Definite), above two decomposition are same
To make sparse system, used incomplete Factorization
Implementation
Implementation Issue
• For 3D case, Matrix 𝐴 would be huge. (for (128 × 128 × 128) grid, 𝐴 matrix has
128 × 128 × 128 × 128 × 128 × 128 = 32𝑇𝐵, (for 2D it takes only 2GB)
• However, there are almost 0 in 𝐴 matrix for poisson equation. ⇒ Sparse Matrix!
How to represent Sparse Matrix?
• Simplest thing. Store nonzero value and row, column index. (Coordinate
Format, COO)
Too many
duplication
Sparse Matrix Format
Compressed Sparse Row (CSR)
• Store only non-zero values
• Available three or four arrays
• Not easy to construct the algorithm such as ILU or IC preconditioner
Use MKL (Intel Math Kernel Library)
MKL?
• a library of optimized math routines for science, engineering, and financial
applications. Core math functions include BLAS, LAPACK, ScaLAPACK, sparse
solvers, fast Fourier transforms, and vector math. The routines in MKL are
hand-optimized specifically for Intel processors.
• For my problem, I usually use BLAS, fast Fourier transforms (for poisson
equation solver with Neumann, periodic, dirichlet BC)
BLAS?
• a specified set of low-level subroutines that perform common linear algebra
operations, widely used. Even in MATLAB!
• Usually used in vector or matrix multiplication, dot product like operations.
• Level 1 : vector – vector operation
• Level 2 : matrix – vector operation
• Level 3 : matrix – matrix operation
• Parallelized internally by Intel. Just turn on the option.
• Reference manual : https://software.intel.com/en-us/mkl_11.1_ref
How to use Library
For MKL
• For compile (when creating .c files in your makefile)
• -i8 -openmp -I$(MKLROOT)/include
• For link (when creating executable files using –o option)
• -L$(MKLROOT)/lib/intel64 -lmkl_core -lmkl_intel_thread
-lpthread –lm
• https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
Library Linking Process
• Compile
• -I option indicate where is
header file (.h file), specifying
include path
• Linking
• -L option indicate where is
library file (.lib, .dll, .a, .so),
specifying linking path
• -l option indicate library name
Reference
• Shewchuk, Jonathan Richard. "An introduction to the conjugate gradient
method without the agonizing pain." (1994).
• Deepak Chandan, “Using Sparse Matrix and Solver Routines from Intel
MKL”, Scinet User Group Meeting, (2013)
• Saad, Yousef. Iterative methods for sparse linear systems. Siam, 2003.
• Akhunov, R. R., et al. "Optimization of the ILU(0) factorization algorithm with
the use of compressed sparse row format." Zapiski Nauchnykh Seminarov POMI
405 (2012): 40-53.

More Related Content

What's hot

Penalty Function Method in Modern Optimization Techniques
Penalty Function Method in Modern Optimization TechniquesPenalty Function Method in Modern Optimization Techniques
Penalty Function Method in Modern Optimization Techniques
Suman Bhattacharyya
 
Levenberg - Marquardt (LM) algorithm_ aghazade
Levenberg - Marquardt (LM) algorithm_ aghazadeLevenberg - Marquardt (LM) algorithm_ aghazade
Levenberg - Marquardt (LM) algorithm_ aghazade
Inistute of Geophysics, Tehran university , Tehran/ iran
 
Golden Section method
Golden Section methodGolden Section method
Golden Section method
Syed Rubaid Ahmad
 
A brief introduction to finite difference method
A brief introduction to finite difference methodA brief introduction to finite difference method
A brief introduction to finite difference method
Prateek Jha
 
Gaussian Elimination Method
Gaussian Elimination MethodGaussian Elimination Method
Gaussian Elimination Method
Andi Firdaus
 
Finite difference method
Finite difference methodFinite difference method
Finite difference method
Divyansh Verma
 
Interpolation with Finite differences
Interpolation with Finite differencesInterpolation with Finite differences
Interpolation with Finite differences
Dr. Nirav Vyas
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
Gopi Saiteja
 
Numerical Methods
Numerical MethodsNumerical Methods
Numerical Methods
Teja Ande
 
Gauss Jorden and Gauss Elimination method.pptx
Gauss Jorden and Gauss Elimination method.pptxGauss Jorden and Gauss Elimination method.pptx
Gauss Jorden and Gauss Elimination method.pptx
AHSANMEHBOOB12
 
Group Theory and Its Application: Beamer Presentation (PPT)
Group Theory and Its Application:   Beamer Presentation (PPT)Group Theory and Its Application:   Beamer Presentation (PPT)
Group Theory and Its Application: Beamer Presentation (PPT)
SIRAJAHMAD36
 
Runge Kutta Method
Runge Kutta MethodRunge Kutta Method
Runge Kutta Method
ch macharaverriyya naidu
 
Code로 이해하는 RNN
Code로 이해하는 RNNCode로 이해하는 RNN
Code로 이해하는 RNN
SANG WON PARK
 
Bisection method
Bisection methodBisection method
Bisection method
Md. Mujahid Islam
 
Wasserstein GAN 수학 이해하기 I
Wasserstein GAN 수학 이해하기 IWasserstein GAN 수학 이해하기 I
Wasserstein GAN 수학 이해하기 I
Sungbin Lim
 
Jacobi and gauss-seidel
Jacobi and gauss-seidelJacobi and gauss-seidel
Jacobi and gauss-seidel
arunsmm
 
Runge kutta 2nd Order
Runge kutta 2nd OrderRunge kutta 2nd Order
Runge kutta 2nd Order
Manjushreearadhya2016
 
Convex Optimization
Convex OptimizationConvex Optimization
Convex Optimization
adil raja
 

What's hot (20)

Penalty Function Method in Modern Optimization Techniques
Penalty Function Method in Modern Optimization TechniquesPenalty Function Method in Modern Optimization Techniques
Penalty Function Method in Modern Optimization Techniques
 
Levenberg - Marquardt (LM) algorithm_ aghazade
Levenberg - Marquardt (LM) algorithm_ aghazadeLevenberg - Marquardt (LM) algorithm_ aghazade
Levenberg - Marquardt (LM) algorithm_ aghazade
 
Golden Section method
Golden Section methodGolden Section method
Golden Section method
 
A brief introduction to finite difference method
A brief introduction to finite difference methodA brief introduction to finite difference method
A brief introduction to finite difference method
 
Gaussian Elimination Method
Gaussian Elimination MethodGaussian Elimination Method
Gaussian Elimination Method
 
Finite difference method
Finite difference methodFinite difference method
Finite difference method
 
Interpolation with Finite differences
Interpolation with Finite differencesInterpolation with Finite differences
Interpolation with Finite differences
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
Numerical Methods
Numerical MethodsNumerical Methods
Numerical Methods
 
Gauss Jorden and Gauss Elimination method.pptx
Gauss Jorden and Gauss Elimination method.pptxGauss Jorden and Gauss Elimination method.pptx
Gauss Jorden and Gauss Elimination method.pptx
 
Taylor’s series
Taylor’s   seriesTaylor’s   series
Taylor’s series
 
Group Theory and Its Application: Beamer Presentation (PPT)
Group Theory and Its Application:   Beamer Presentation (PPT)Group Theory and Its Application:   Beamer Presentation (PPT)
Group Theory and Its Application: Beamer Presentation (PPT)
 
Runge Kutta Method
Runge Kutta MethodRunge Kutta Method
Runge Kutta Method
 
Code로 이해하는 RNN
Code로 이해하는 RNNCode로 이해하는 RNN
Code로 이해하는 RNN
 
Bisection method
Bisection methodBisection method
Bisection method
 
Wasserstein GAN 수학 이해하기 I
Wasserstein GAN 수학 이해하기 IWasserstein GAN 수학 이해하기 I
Wasserstein GAN 수학 이해하기 I
 
Jacobi and gauss-seidel
Jacobi and gauss-seidelJacobi and gauss-seidel
Jacobi and gauss-seidel
 
Runge kutta 2nd Order
Runge kutta 2nd OrderRunge kutta 2nd Order
Runge kutta 2nd Order
 
Dynamic pgmming
Dynamic pgmmingDynamic pgmming
Dynamic pgmming
 
Convex Optimization
Convex OptimizationConvex Optimization
Convex Optimization
 

Viewers also liked

Convergence Criteria
Convergence CriteriaConvergence Criteria
Convergence Criteria
Tarun Gehlot
 
Comparison Between Levenberg-Marquardt And Scaled Conjugate Gradient Training...
Comparison Between Levenberg-Marquardt And Scaled Conjugate Gradient Training...Comparison Between Levenberg-Marquardt And Scaled Conjugate Gradient Training...
Comparison Between Levenberg-Marquardt And Scaled Conjugate Gradient Training...
CSCJournals
 
Face expression recognition using Scaled-conjugate gradient Back-Propagation ...
Face expression recognition using Scaled-conjugate gradient Back-Propagation ...Face expression recognition using Scaled-conjugate gradient Back-Propagation ...
Face expression recognition using Scaled-conjugate gradient Back-Propagation ...
IJMER
 
F04573843
F04573843F04573843
F04573843
IOSR-JEN
 
A05920109
A05920109A05920109
A05920109
IOSR-JEN
 
Khalid sarwar working principle of ewsd exchange 2014
Khalid sarwar working principle of ewsd exchange 2014Khalid sarwar working principle of ewsd exchange 2014
Khalid sarwar working principle of ewsd exchange 2014
PTCL
 
Study Electronic And Mechanical Properties Of Carbon, Silicon, And Hypothetic...
Study Electronic And Mechanical Properties Of Carbon, Silicon, And Hypothetic...Study Electronic And Mechanical Properties Of Carbon, Silicon, And Hypothetic...
Study Electronic And Mechanical Properties Of Carbon, Silicon, And Hypothetic...
IOSR Journals
 
10 examples for if statement
10 examples for if statement10 examples for if statement
10 examples for if statementfyjordan9
 
Faster Training Algorithms in Neural Network Based Approach For Handwritten T...
Faster Training Algorithms in Neural Network Based Approach For Handwritten T...Faster Training Algorithms in Neural Network Based Approach For Handwritten T...
Faster Training Algorithms in Neural Network Based Approach For Handwritten T...
CSCJournals
 
Higher-Order Conjugate Gradient Method (HCGM) For Solving Continuous Optimal ...
Higher-Order Conjugate Gradient Method (HCGM) For Solving Continuous Optimal ...Higher-Order Conjugate Gradient Method (HCGM) For Solving Continuous Optimal ...
Higher-Order Conjugate Gradient Method (HCGM) For Solving Continuous Optimal ...
iosrjce
 
Grds international conference on pure and applied science (5)
Grds international conference on pure and applied science (5)Grds international conference on pure and applied science (5)
Grds international conference on pure and applied science (5)
Global R & D Services
 
Grds international conference on pure and applied science (6)
Grds international conference on pure and applied science (6)Grds international conference on pure and applied science (6)
Grds international conference on pure and applied science (6)
Global R & D Services
 
Vietnam troops from South korea is benefit for South Korea
Vietnam troops from South korea is benefit for South KoreaVietnam troops from South korea is benefit for South Korea
Vietnam troops from South korea is benefit for South KoreaJongsu "Liam" Kim
 
Application of local search methods for solving a quadratic assignment proble...
Application of local search methods for solving a quadratic assignment proble...Application of local search methods for solving a quadratic assignment proble...
Application of local search methods for solving a quadratic assignment proble...
ertekg
 
Stress Tensor & Rotation Tensor
Stress Tensor & Rotation TensorStress Tensor & Rotation Tensor
Stress Tensor & Rotation TensorJongsu "Liam" Kim
 
Lu decomposition
Lu decompositionLu decomposition
Lu decompositiongilandio
 

Viewers also liked (20)

Convergence Criteria
Convergence CriteriaConvergence Criteria
Convergence Criteria
 
Comparison Between Levenberg-Marquardt And Scaled Conjugate Gradient Training...
Comparison Between Levenberg-Marquardt And Scaled Conjugate Gradient Training...Comparison Between Levenberg-Marquardt And Scaled Conjugate Gradient Training...
Comparison Between Levenberg-Marquardt And Scaled Conjugate Gradient Training...
 
Face expression recognition using Scaled-conjugate gradient Back-Propagation ...
Face expression recognition using Scaled-conjugate gradient Back-Propagation ...Face expression recognition using Scaled-conjugate gradient Back-Propagation ...
Face expression recognition using Scaled-conjugate gradient Back-Propagation ...
 
F04573843
F04573843F04573843
F04573843
 
A05920109
A05920109A05920109
A05920109
 
Khalid sarwar working principle of ewsd exchange 2014
Khalid sarwar working principle of ewsd exchange 2014Khalid sarwar working principle of ewsd exchange 2014
Khalid sarwar working principle of ewsd exchange 2014
 
Study Electronic And Mechanical Properties Of Carbon, Silicon, And Hypothetic...
Study Electronic And Mechanical Properties Of Carbon, Silicon, And Hypothetic...Study Electronic And Mechanical Properties Of Carbon, Silicon, And Hypothetic...
Study Electronic And Mechanical Properties Of Carbon, Silicon, And Hypothetic...
 
10 examples for if statement
10 examples for if statement10 examples for if statement
10 examples for if statement
 
Faster Training Algorithms in Neural Network Based Approach For Handwritten T...
Faster Training Algorithms in Neural Network Based Approach For Handwritten T...Faster Training Algorithms in Neural Network Based Approach For Handwritten T...
Faster Training Algorithms in Neural Network Based Approach For Handwritten T...
 
Higher-Order Conjugate Gradient Method (HCGM) For Solving Continuous Optimal ...
Higher-Order Conjugate Gradient Method (HCGM) For Solving Continuous Optimal ...Higher-Order Conjugate Gradient Method (HCGM) For Solving Continuous Optimal ...
Higher-Order Conjugate Gradient Method (HCGM) For Solving Continuous Optimal ...
 
Grds international conference on pure and applied science (5)
Grds international conference on pure and applied science (5)Grds international conference on pure and applied science (5)
Grds international conference on pure and applied science (5)
 
Grds international conference on pure and applied science (6)
Grds international conference on pure and applied science (6)Grds international conference on pure and applied science (6)
Grds international conference on pure and applied science (6)
 
Cubase subject introduction
Cubase subject introductionCubase subject introduction
Cubase subject introduction
 
NAS EP Algorithm
NAS EP Algorithm NAS EP Algorithm
NAS EP Algorithm
 
Vietnam troops from South korea is benefit for South Korea
Vietnam troops from South korea is benefit for South KoreaVietnam troops from South korea is benefit for South Korea
Vietnam troops from South korea is benefit for South Korea
 
History Against Against
History Against AgainstHistory Against Against
History Against Against
 
Cubase1차발표
Cubase1차발표Cubase1차발표
Cubase1차발표
 
Application of local search methods for solving a quadratic assignment proble...
Application of local search methods for solving a quadratic assignment proble...Application of local search methods for solving a quadratic assignment proble...
Application of local search methods for solving a quadratic assignment proble...
 
Stress Tensor & Rotation Tensor
Stress Tensor & Rotation TensorStress Tensor & Rotation Tensor
Stress Tensor & Rotation Tensor
 
Lu decomposition
Lu decompositionLu decomposition
Lu decomposition
 

Similar to Solving Poisson Equation using Conjugate Gradient Method and its implementation

Lecture 5 backpropagation
Lecture 5 backpropagationLecture 5 backpropagation
Lecture 5 backpropagation
ParveenMalik18
 
Optimum Engineering Design - Day 2b. Classical Optimization methods
Optimum Engineering Design - Day 2b. Classical Optimization methodsOptimum Engineering Design - Day 2b. Classical Optimization methods
Optimum Engineering Design - Day 2b. Classical Optimization methods
SantiagoGarridoBulln
 
Higher order differential equation
Higher order differential equationHigher order differential equation
Higher order differential equation
Sooraj Maurya
 
Mathematics of nyquist plot [autosaved] [autosaved]
Mathematics of nyquist plot [autosaved] [autosaved]Mathematics of nyquist plot [autosaved] [autosaved]
Mathematics of nyquist plot [autosaved] [autosaved]
Asafak Husain
 
Lecture_10_SVD.pptx
Lecture_10_SVD.pptxLecture_10_SVD.pptx
Lecture_10_SVD.pptx
avulodttlrjhycmbmc
 
Lecture 6 radial basis-function_network
Lecture 6 radial basis-function_networkLecture 6 radial basis-function_network
Lecture 6 radial basis-function_network
ParveenMalik18
 
Optimum engineering design - Day 5. Clasical optimization methods
Optimum engineering design - Day 5. Clasical optimization methodsOptimum engineering design - Day 5. Clasical optimization methods
Optimum engineering design - Day 5. Clasical optimization methods
SantiagoGarridoBulln
 
Learning group em - 20171025 - copy
Learning group   em - 20171025 - copyLearning group   em - 20171025 - copy
Learning group em - 20171025 - copy
Shuai Zhang
 
BSC_COMPUTER _SCIENCE_UNIT-2_DISCRETE MATHEMATICS
BSC_COMPUTER _SCIENCE_UNIT-2_DISCRETE MATHEMATICSBSC_COMPUTER _SCIENCE_UNIT-2_DISCRETE MATHEMATICS
BSC_COMPUTER _SCIENCE_UNIT-2_DISCRETE MATHEMATICS
Rai University
 
Differential Geometry for Machine Learning
Differential Geometry for Machine LearningDifferential Geometry for Machine Learning
Differential Geometry for Machine Learning
SEMINARGROOT
 
Rational function 11
Rational function 11Rational function 11
Rational function 11
AjayQuines
 
Integral calculus
Integral calculusIntegral calculus
Integral calculus
Farzad Javidanrad
 
Stochastic optimal control &amp; rl
Stochastic optimal control &amp; rlStochastic optimal control &amp; rl
Stochastic optimal control &amp; rl
ChoiJinwon3
 
g_9 - L_1 Solving Quadratic Equations.pptx
g_9 - L_1 Solving Quadratic Equations.pptxg_9 - L_1 Solving Quadratic Equations.pptx
g_9 - L_1 Solving Quadratic Equations.pptx
MichelleMatriano
 
Rabbit challenge 2 Machine Learning
Rabbit challenge 2 Machine LearningRabbit challenge 2 Machine Learning
Rabbit challenge 2 Machine Learning
TOMMYLINK1
 
Lecture_9_LA_Review.pptx
Lecture_9_LA_Review.pptxLecture_9_LA_Review.pptx
Lecture_9_LA_Review.pptx
Sunny432360
 
Solution of equations and eigenvalue problems
Solution of equations and eigenvalue problemsSolution of equations and eigenvalue problems
Solution of equations and eigenvalue problems
Santhanam Krishnan
 
Page rank - from theory to application
Page rank - from theory to applicationPage rank - from theory to application
Page rank - from theory to application
GAYO3
 
Lecture5_Laplace_ODE.pdf
Lecture5_Laplace_ODE.pdfLecture5_Laplace_ODE.pdf
Lecture5_Laplace_ODE.pdf
MohammedKhodary4
 

Similar to Solving Poisson Equation using Conjugate Gradient Method and its implementation (20)

Lecture 5 backpropagation
Lecture 5 backpropagationLecture 5 backpropagation
Lecture 5 backpropagation
 
Optimum Engineering Design - Day 2b. Classical Optimization methods
Optimum Engineering Design - Day 2b. Classical Optimization methodsOptimum Engineering Design - Day 2b. Classical Optimization methods
Optimum Engineering Design - Day 2b. Classical Optimization methods
 
Higher order differential equation
Higher order differential equationHigher order differential equation
Higher order differential equation
 
Mathematics of nyquist plot [autosaved] [autosaved]
Mathematics of nyquist plot [autosaved] [autosaved]Mathematics of nyquist plot [autosaved] [autosaved]
Mathematics of nyquist plot [autosaved] [autosaved]
 
lec19.ppt
lec19.pptlec19.ppt
lec19.ppt
 
Lecture_10_SVD.pptx
Lecture_10_SVD.pptxLecture_10_SVD.pptx
Lecture_10_SVD.pptx
 
Lecture 6 radial basis-function_network
Lecture 6 radial basis-function_networkLecture 6 radial basis-function_network
Lecture 6 radial basis-function_network
 
Optimum engineering design - Day 5. Clasical optimization methods
Optimum engineering design - Day 5. Clasical optimization methodsOptimum engineering design - Day 5. Clasical optimization methods
Optimum engineering design - Day 5. Clasical optimization methods
 
Learning group em - 20171025 - copy
Learning group   em - 20171025 - copyLearning group   em - 20171025 - copy
Learning group em - 20171025 - copy
 
BSC_COMPUTER _SCIENCE_UNIT-2_DISCRETE MATHEMATICS
BSC_COMPUTER _SCIENCE_UNIT-2_DISCRETE MATHEMATICSBSC_COMPUTER _SCIENCE_UNIT-2_DISCRETE MATHEMATICS
BSC_COMPUTER _SCIENCE_UNIT-2_DISCRETE MATHEMATICS
 
Differential Geometry for Machine Learning
Differential Geometry for Machine LearningDifferential Geometry for Machine Learning
Differential Geometry for Machine Learning
 
Rational function 11
Rational function 11Rational function 11
Rational function 11
 
Integral calculus
Integral calculusIntegral calculus
Integral calculus
 
Stochastic optimal control &amp; rl
Stochastic optimal control &amp; rlStochastic optimal control &amp; rl
Stochastic optimal control &amp; rl
 
g_9 - L_1 Solving Quadratic Equations.pptx
g_9 - L_1 Solving Quadratic Equations.pptxg_9 - L_1 Solving Quadratic Equations.pptx
g_9 - L_1 Solving Quadratic Equations.pptx
 
Rabbit challenge 2 Machine Learning
Rabbit challenge 2 Machine LearningRabbit challenge 2 Machine Learning
Rabbit challenge 2 Machine Learning
 
Lecture_9_LA_Review.pptx
Lecture_9_LA_Review.pptxLecture_9_LA_Review.pptx
Lecture_9_LA_Review.pptx
 
Solution of equations and eigenvalue problems
Solution of equations and eigenvalue problemsSolution of equations and eigenvalue problems
Solution of equations and eigenvalue problems
 
Page rank - from theory to application
Page rank - from theory to applicationPage rank - from theory to application
Page rank - from theory to application
 
Lecture5_Laplace_ODE.pdf
Lecture5_Laplace_ODE.pdfLecture5_Laplace_ODE.pdf
Lecture5_Laplace_ODE.pdf
 

Recently uploaded

一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
ongomchris
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 

Recently uploaded (20)

一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 

Solving Poisson Equation using Conjugate Gradient Method and its implementation

  • 1. Solving Poisson Equation using Conjugate Gradient Method and its implementation Jongsu Kim
  • 3. From the Basics, Ax=b Linear Systems 𝐴𝑥 = 𝑏 Goal of this presentation What have you learned? • Direct Method • Gauss Elimination • Thomas Algorithm (TDMA) (for tridiagonal matrix only) • Iterative Method • Jacobi method • SOR method • Conjugate Gradient Method • Red Black Jacobi Method
  • 4. Iterative Method Start with decomposition 𝐴 = 𝐷 − 𝐸 − 𝐹 Jacobi Method 𝑥 𝑘+1 = 𝐷−1 𝐸 + 𝐹 𝑥 𝑘 + 𝐷−1 𝑏 Gauss-Seidel Method 𝑥 𝑘+1 = (𝐷 − 𝐸)−1 𝐹𝑥 𝑘 + 𝐷 − 𝐸 −1 𝑏 𝐴𝑥 = 𝑏 Backward Gauss-Seidel Iteration 𝐷 − 𝐹 𝑥 𝑘+1 = 𝐸𝑥 𝑘 + 𝑏 (𝑖 = 1, … , 𝑛 − 1, 𝑛) (𝑖 = 𝑛, 𝑛 − 1 … , )
  • 5. Splitting of A matrix Previous method has a common form 𝐴 = 𝐷 − 𝐸 − 𝐹 𝑥 𝑘+1 = 𝐷−1 𝐸 + 𝐹 𝑥 𝑘 + 𝐷−1 𝑏 𝑥 𝑘+1 = (𝐷 − 𝐸)−1 𝐹𝑥 𝑘 + 𝐷 − 𝐸 −1 𝑏 𝐴𝑥 = 𝑏 𝐷 − 𝐹 𝑥 𝑘+1 = 𝐸𝑥 𝑘 + 𝑏 𝑴𝒙 𝒌+𝟏 = 𝑵𝒙 𝒌 + 𝒃 = 𝑴 − 𝑨 𝒙 𝒌 + 𝒃 𝑨 = 𝑴 − 𝑵 Introducing SOR (Successive Over Relaxation) method 𝝎𝑨 = 𝑫 − 𝝎𝑬 − (𝝎𝑭 + 𝟏 − 𝝎 𝑫) 𝑫 − 𝝎𝑬 𝒙 𝒌+𝟏 = 𝝎𝑭 + 𝟏 − 𝝎 𝑫 𝒙 𝒌 + 𝝎𝒃
  • 6. SOR to SSOR Gauss Seidel method 𝑥 𝑘+1 = (𝐷 − 𝐸)−1 𝐹𝑥 𝑘 + 𝐷 − 𝐸 −1 𝑏 SOR (Successive Over Relaxation) method 𝐷 − 𝜔𝐸 𝑥 𝑘+1 = 𝜔𝐹 + 1 − 𝜔 𝐷 𝑥 𝑘 + 𝜔𝑏 (𝐷 − 𝐸)𝑥 𝑘+1= 𝐹𝑥 𝑘 + 𝑏 𝐷 − 𝐹 𝑥 𝑘+1 = 𝐸𝑥 𝑘 + 𝑏 Backward Gauss Seidel method Backward SOR method 𝐷 − 𝜔𝐹 𝑥 𝑘+1 = 𝜔𝐸 + 1 − 𝜔 𝐷 𝑥 𝑘 + 𝜔𝑏
  • 7. SSOR method SSOR (Symmetric Successive Over Relaxation) method SOR step followed by backward SOR step for symmetric matrix 𝐷 − 𝜔𝐸 𝑥 𝑘+1/2 = 𝜔𝐹 + 1 − 𝜔 𝐷 𝑥 𝑘 + 𝜔𝑏 𝐷 − 𝜔𝐹 𝑥 𝑘+1 = 𝜔𝐸 + 1 − 𝜔 𝐷 𝑥 𝑘+1/2 + 𝜔𝑏 𝑥 𝑘+1 = 𝑮 𝝎 𝑥 𝑘 + 𝒇 𝝎 𝑮 𝝎 = 𝐷 − 𝜔𝐹 −1 𝜔𝐸 + 1 − 𝜔 𝐷 × 𝐷 − 𝜔𝐸 −1 𝜔𝐹 + 1 − 𝜔 𝐷 𝒇 𝝎 = 𝜔 𝐷 − 𝜔𝐹 −1 𝐼 + 𝜔𝐸 + 1 − 𝜔 𝐷 𝐷 − 𝜔𝐸 −1 𝑏 Observing that 𝜔𝐸 + 1 − 𝜔 𝐷 𝐷 − 𝜔𝐸 −1 = − 𝐷 − 𝜔𝐸 + 2 − 𝜔 𝐷 𝐷 − 𝜔𝐸 −1 = −𝐼 + 2 − 𝜔 𝐷 𝐷 − 𝜔𝐸 −1 𝒇 𝝎 = 𝜔 2 − 𝜔 𝐷 − 𝜔𝐹 −1 𝐷 𝐷 − 𝜔𝐸 −1 𝑏 Used as preconditioner (explain later)
  • 8. Preconditioned System 𝒙 𝒌+𝟏 = 𝑮 𝝎 𝒙 𝒌 + 𝒇 𝝎 𝐺 𝐺𝑆 𝐴 = 𝐼 − (𝐷 − 𝐸)−1 𝐴𝐺𝐽𝐴 𝐴 = 𝐼 − 𝐷−1 𝐴, 𝒙 𝒌+𝟏 = 𝑴−𝟏 𝑵𝒙 𝒌 + 𝑴−𝟏 𝒃 We have two forms for iterative method Ex) 𝐺 = 𝑀−1 𝑁 = 𝑀−1 𝑀 − 𝐴 = 𝐼 − 𝑀−1 𝐴 𝑓 = 𝑀−1 𝑏 𝐼 − 𝐺 𝑥 = 𝑓 Another view… [𝐼 − (𝐼 − 𝑀−1 𝐴)]𝑥 = 𝑓 𝑀−1 𝐴𝑥 = 𝑓 𝑴−𝟏 𝑨𝒙 = 𝑴−𝟏 𝒃 Preconditioner 𝑀
  • 9. Preconditioned System 𝑴−𝟏 𝑨𝒙 = 𝑴−𝟏 𝒃 With Preconditioner 𝑀 𝑀 𝐺𝑆 = 𝐷 − 𝐸Gauss-Seidel 𝑀𝑆𝑆𝑂𝑅 = 1 𝜔 2 − 𝜔 𝐷 − 𝜔𝐸 𝐷−1 (𝐷 − 𝜔𝐹)SSOR 𝑀𝐽𝐴 = 𝐷Jacobi 𝑀𝐽𝐴 = 1 𝜔 (𝐷 − 𝜔𝐸)SOR It may not be “SPARSE” due to inverse (𝑀−1) How to compute this? 𝑤 = 𝑀−1 𝐴𝑣 𝑟 = 𝐴𝑣 and 𝑀𝑤 = 𝑟 𝐴𝑣 might be expensive. Much better? 𝑤 = 𝑀−1 𝐴𝑣 = 𝑀−1 𝑀 − 𝑁 𝑣 = 𝐼 − 𝑀−1 𝑁 𝑣 𝑟 = 𝑁𝑣 𝑤 = 𝑀−1 𝑟 𝑤 ≔ 𝑣 − 𝑤 N may be sparser than A and less expensive than 𝐴𝑣
  • 10. Minimization Problem Forget about 𝐴𝑥 = 𝑏 temporarily, but thinking about some quadratic function 𝑓 Function Matrix 𝑓(x) = 1 2 𝐴𝑥2 − 𝑏𝑥 + 𝑐 𝑓 𝑥 = 1 2 𝑥 𝑇 𝐴𝑥 − 𝑏 𝑇 𝑥 + 𝑐 𝑓′ x = 𝐴𝑥 − b 𝑓′ x = 1 2 𝐴 𝑇 𝑥 + 1 2 A𝑥 − b If Matrix 𝐴 is symmetric, 𝐴 𝑇 = 𝐴, then 𝒇′ 𝒙 = 𝑨𝒙 − 𝒃 Setting the gradient to zero, we get the linear system we wish to solve. Our original GOAL!!
  • 11. (a) Quadratic form for a positive definite matrix (b) Quadratic form for a negative definite matrix (c) Singular (and positive-indefinite) matrix; A line that runs through bottom of the valley is the set of solutions (d) For an indefinite matrix. Saddle point. For a Symmetric and Positive Definite Matrix, minimizing 𝑓 𝑥 = 1 2 𝑥 𝑇 𝐴𝑥 − 𝑏 𝑇 𝑥 + 𝑐 Reduced to our solution Minimization Problem
  • 12. Steep Descent Method Choose direction in which 𝑓 decrease most quickly, which is the direction opposite 𝑓′(𝑥 𝑖 ) 𝑟(𝑖) = 𝑏 − 𝐴𝑥(𝑖) −𝑓′ 𝑥 𝑖 = 𝑟(𝑖) = 𝑏 − 𝐴𝑥(𝑖) 𝑥(1) = 𝑥(0) + 𝛼𝑟(0) To Find 𝛼, set 𝑑 𝑑𝛼 𝑓 𝑥 1 = 0 𝑑 𝑑𝛼 𝑓 𝑥 1 = 𝑓′ 𝑥 1 𝑇 𝑑 𝑑𝛼 𝑥(1) = 𝑓′ 𝑥 1 𝑇 𝑟(0) 𝑓′ 𝑥 𝑖+1 𝑇 and 𝑟(𝑖) are orthogonal! −𝑓′ 𝑥 𝑖+1 = 𝑟(𝑖+1) 𝑓′ 𝑥 𝑖+1 𝑇 𝑟(𝑖) = 0 𝑟 𝑖+1 𝑇 𝑟(𝑖) = 0 𝜶 = 𝒓 𝒊 𝑻 𝒓 𝒊 𝒓(𝒊) 𝑻 𝑨𝒓(𝒊)
  • 13. Conjugate Gradient Method Steep Descent Method not always converge well Worst case of steep descent method • Solid lines : worst convergence line • Dashed line : steps toward convergence Why it doesn’t directly go along line for fast convergence? → related to eigen value problem Introducing Conjugate Gradient method
  • 14. Conjugate Gradient Method What is the meaning of conjugate? • Definition : A binomial formed by negating the second term of binomial • 𝑥 + 𝑦 ← conjugate → 𝑥 − 𝑦 Then, what is the meaning of conjugate gradient? • Steep descent method often finds itself taking steps in the same direction • Wouldn’t it better if we got it right the every step? • Here is a step • error 𝑒(𝑖) = 𝑥(𝑖) − 𝑥, residual 𝑟(𝑖) = 𝑏 − 𝐴𝑥(𝑖), 𝑑(𝑖) a set of orthogonal search direction • for each step, we choose a point 𝑥(𝑖+1) = 𝑥(𝑖) + 𝛼(𝑖) 𝑑(𝑖) • To find 𝛼, 𝑒(𝑖+1) should be orthogonal to 𝑑(𝑖). (𝑒 𝑖+1 = 𝑒 𝑖 + 𝛼 𝑖 𝑑 𝑖 ) 𝑑(𝑖) 𝑇 𝑒(𝑖+1) = 0 𝑑(𝑖) 𝑇 (𝑒 𝑖 +𝛼(𝑖) 𝑑(𝑖)) = 0 𝛼(𝑖) = − 𝑑 𝑖 𝑇 𝑒 𝑖 𝑑(𝑖) 𝑇 𝑑(𝑖) We don’t know anything about 𝑒(𝑖), because if we know 𝑒(𝑖), it means we know the answer.
  • 15. Conjugate Gradient Method Instead of orthogonal, introduce 𝐴-orthogonal 𝒅(𝒊) 𝑻 𝑨𝒅(𝒋) = 𝟎, if 𝑑(𝑖) and 𝑑(𝑗) are 𝐴-orthogonal, or conjugate 𝒆(𝒊+𝟏) is 𝑨-orthogonal to 𝒅(𝒊), and this condition is equivalent to finding the minimum point along the search direction 𝑑(𝑖) , as in steep descent method 𝑑 𝑑𝛼 𝑓 𝑥 𝑖+1 = 0 𝛼 minimize 𝑓 when directional derivative is equal to zero 𝑓′ 𝑥 𝑖+1 𝑇 𝑑 𝑑𝛼 𝑥 𝑖+1 = 0 −𝑟 𝑖+1 𝑇 𝑑(𝑖) = 0 Chain rule 𝑓′ 𝑥(𝑖+1) = 𝐴𝑥(𝑖+1) − 𝑏 𝑟(𝑖) = 𝑏 − 𝐴𝑥(𝑖) 𝑥(𝑖+1) = 𝑥(𝑖) + 𝛼(𝑖) 𝑑(𝑖) 𝑑(𝑖) 𝑇 𝐴𝑒(𝑖+1) = 0 𝑥(𝑖+1) 𝑇 𝐴 𝑇 𝑑(𝑖) − 𝑏 𝑇 𝑑 𝑖 = 0 𝑥(𝑖+1) 𝑇 𝐴 𝑇 𝑑(𝑖) − 𝑥 𝑇 𝐴 𝑇 𝑑 𝑖 = 0 𝑒 𝑖+1 𝑇 𝐴 𝑇 𝑑(𝑖) = 0 Transpose again How it can be same as orthogonality used in steep descent method?
  • 16. 𝑒(𝑖+1) = 𝑥(𝑖+1) − 𝑥 𝜶(𝒊) = − 𝒅 𝒊 𝑻 𝒓 𝒊 𝒅(𝒊) 𝑻 𝑨𝒅(𝒊) Conjugate Gradient Method 𝑑(𝑖) 𝑇 𝐴𝑒(𝑖+1) = 0 𝑥(𝑖+1) = 𝑥(𝑖) + 𝛼𝑑(𝑖) 𝑒(𝑖+1) = (𝑥(𝑖) + 𝛼𝑟(𝑖)) − 𝑥 𝑑(𝑖) 𝑇 𝐴𝑒(𝑖+1) = 𝑑 𝑖 𝑇 𝐴((𝑥 𝑖 + 𝛼𝑑 𝑖 ) − 𝑥) 𝑑 𝑖 𝑇 𝐴𝑥(𝑖) + 𝛼𝑑 𝑖 𝑇 𝐴𝑑(𝑖) − 𝑑 𝑖 𝑇 𝐴𝑥 = 0 𝑑 𝑖 𝑇 𝐴𝑥 𝑖 − 𝑏 = −𝛼𝑑 𝑖 𝑇 𝐴𝑑(𝑖) How to find 𝑑(𝑖)? Gram-Schmidt Process 𝑑(𝑖) = 𝑢(𝑖) + Σk=0 𝑖−1 𝛽𝑖𝑘 𝑑(𝑘) Find set of 𝐴-orthogonal vector 𝛽𝑖𝑘 = − 𝑢𝑖 𝑇 𝐴𝑑 𝑗 𝑑(𝑗) 𝑇 𝐴𝑑(𝑗) For set of independent vectors 𝑢𝑖 due to 𝑑 𝑖 𝑇 𝐴𝑑(𝑗) = 0 𝑖 > 𝑗
  • 17. Conjugate Gradient Method Overall Algorithm Initialization 𝑖 = 0 𝑟 = 𝑏 − 𝐴𝑥 𝑑 = 𝑟 𝛿 𝑛𝑒𝑤 = 𝑟 𝑇 𝑟 𝛿0 = 𝛿 𝑛𝑒𝑤 𝜖 = 1.0𝑒 − 6 Iteration check While i<imax && 𝛿 𝑛𝑒𝑤 > 𝜖2 𝛿0 Inside loop 𝑞 = 𝐴𝑑 𝛼 = 𝛿 𝑛𝑒𝑤 𝑑 𝑇 𝑞 𝑥 = 𝑥 + 𝛼𝑑 If 𝑖 is divisible by 50 𝑟 = 𝑏 − 𝐴𝑥 else 𝑟 = 𝑟 − 𝛼𝑞 endif 𝛿 𝑜𝑙𝑑 = 𝛿 𝑛𝑒𝑤 𝛿 𝑛𝑒𝑤 = 𝑟 𝑇 𝑟 𝛽 = 𝛿 𝑛𝑒𝑤 𝛿 𝑜𝑙𝑑 𝑑 = 𝑟 + 𝛽𝑑 𝑖 = 𝑖 + 1
  • 18. Preconditioner Again 𝑴−𝟏 𝑨𝒙 = 𝑴−𝟏 𝒃 With Preconditioner 𝑀 𝑀 𝐺𝑆 = 𝐷 − 𝐸Gauss-Seidel 𝑀𝑆𝑆𝑂𝑅 = 1 𝜔 2 − 𝜔 𝐷 − 𝜔𝐸 𝐷−1 (𝐷 − 𝜔𝐹)SSOR 𝑀𝐽𝐴 = 𝐷Jacobi 𝑀𝐽𝐴 = 1 𝜔 (𝐷 − 𝜔𝐸)SOR Incomplete LU Decomposition 𝐴 = 𝐿𝑈 − 𝑅 𝑅 : residual error Incomplete Cholesky Decomposition 𝐴 = 𝐿𝐿 𝑇 − 𝑅 If A is SPD (Symmetric Positive Definite), above two decomposition are same To make sparse system, used incomplete Factorization
  • 20. Implementation Issue • For 3D case, Matrix 𝐴 would be huge. (for (128 × 128 × 128) grid, 𝐴 matrix has 128 × 128 × 128 × 128 × 128 × 128 = 32𝑇𝐵, (for 2D it takes only 2GB) • However, there are almost 0 in 𝐴 matrix for poisson equation. ⇒ Sparse Matrix! How to represent Sparse Matrix? • Simplest thing. Store nonzero value and row, column index. (Coordinate Format, COO) Too many duplication
  • 21. Sparse Matrix Format Compressed Sparse Row (CSR) • Store only non-zero values • Available three or four arrays • Not easy to construct the algorithm such as ILU or IC preconditioner
  • 22. Use MKL (Intel Math Kernel Library) MKL? • a library of optimized math routines for science, engineering, and financial applications. Core math functions include BLAS, LAPACK, ScaLAPACK, sparse solvers, fast Fourier transforms, and vector math. The routines in MKL are hand-optimized specifically for Intel processors. • For my problem, I usually use BLAS, fast Fourier transforms (for poisson equation solver with Neumann, periodic, dirichlet BC) BLAS? • a specified set of low-level subroutines that perform common linear algebra operations, widely used. Even in MATLAB! • Usually used in vector or matrix multiplication, dot product like operations. • Level 1 : vector – vector operation • Level 2 : matrix – vector operation • Level 3 : matrix – matrix operation • Parallelized internally by Intel. Just turn on the option. • Reference manual : https://software.intel.com/en-us/mkl_11.1_ref
  • 23. How to use Library For MKL • For compile (when creating .c files in your makefile) • -i8 -openmp -I$(MKLROOT)/include • For link (when creating executable files using –o option) • -L$(MKLROOT)/lib/intel64 -lmkl_core -lmkl_intel_thread -lpthread –lm • https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor Library Linking Process • Compile • -I option indicate where is header file (.h file), specifying include path • Linking • -L option indicate where is library file (.lib, .dll, .a, .so), specifying linking path • -l option indicate library name
  • 24. Reference • Shewchuk, Jonathan Richard. "An introduction to the conjugate gradient method without the agonizing pain." (1994). • Deepak Chandan, “Using Sparse Matrix and Solver Routines from Intel MKL”, Scinet User Group Meeting, (2013) • Saad, Yousef. Iterative methods for sparse linear systems. Siam, 2003. • Akhunov, R. R., et al. "Optimization of the ILU(0) factorization algorithm with the use of compressed sparse row format." Zapiski Nauchnykh Seminarov POMI 405 (2012): 40-53.