6
LU decomposition 日日2014/9/30 日日 日日日 日日日日 日日日 日日

LU decomposition

Embed Size (px)

DESCRIPTION

LU decomposition. 日期: 2014/9/30 助教:汪柏岑 授課老師:徐國錦 教授. LU 分解. Doolittle’s method Crout’s method Choleski’s method. Doolittle’s method. library(Matrix ) B=matrix(c(1,2,0,1)) mm

Citation preview

Page 1: LU decomposition

LU decomposition日期: 2014/9/30

助教:汪柏岑授課老師:徐國錦 教授

Page 2: LU decomposition

LU 分解

• Doolittle’s method

• Crout’s method

• Choleski’s method

Page 3: LU decomposition

Doolittle’s method

Page 4: LU decomposition

library(Matrix)

B=matrix(c(1,2,0,1))

mm <- matrix(c(4,-1,-1,0,-1,4,0,-1,-1,0,4,-1,0,-1,-1,4),nrow=4)

lum <- lu(mm)

elu <- expand(lum)

y=solve(elu$L)%*%B

x=solve(elu$U)%*%y

elu$L

elu$U

Page 5: LU decomposition

Choleski’s method

Page 6: LU decomposition

Exercise

A=matrix(c(4,-1,-1,0,-1,4,0,-1,-1,0,4,-1,0,-1,-1,4),4,4) # 定義 A矩陣b=matrix(c(1,2,0,1),4,1) # 定義 b 矩陣U=chol(A) # 使用 Choleski's method 算出 U

L=t(chol(A)) # 求 U 之轉置矩陣 L

y=solve(L)%*%b # 求 y 矩陣x=solve(U)%*%y # 求 x 矩陣

L 的反矩陣

矩陣相乘

A=LU Ax=b Lux=b Ly=b Ux=y

4X4 矩陣