平方根分解(Choleskey分解)
A
=
G
G
T
,
A
对称正定
A=GG^ \mathrm T \,\,,\,\, A对称正定
A=GGT,A对称正定
A
=
L
D
M
=
L
D
L
T
=
(
L
D
1
/
2
)
(
L
D
1
/
2
)
T
=
G
G
T
\begin{align*} A =LDM= LDL^ \mathrm T=(LD^{1/2})(LD^{1/2})^ \mathrm T=GG^ \mathrm T \end{align*}
A=LDM=LDLT=(LD1/2)(LD1/2)T=GGT
{
G
y
=
b
G
T
x
=
y
\begin{cases} Gy=b \\ \\ G^ \mathrm Tx=y \end{cases}
⎩
⎨
⎧Gy=bGTx=y
手算的话根据转置的性质直接把
G
{G}
G 矩阵写出来就行,非常好写,编程直接参考同济《现代数值计算》算法2.2.3。
matlab编程实现:
%% Choleskey分解解线性方程组
function [x,G] = cholesSolve(A,b)
n = size(A);
for i = 1:n
t = 0;
for s = 1:i-1
t = t+ G(i,s)^2;
end
G(i,i) = sqrt(A(i,i)-t);
for k = i+1:n
t = 0;
for s = 1:i-1
t = t+G(i,s)*G(k,s);
end
G(k,i) = (A(k,i)-t)/G(i,i);
end
end
% 回代
for i = 1:n
t = 0;
for j = 1:i-1
t = t+G(i,j)*y(j);
end
y(i)=(b(i)-t)/G(i,i);
end
for i = n:-1:1
t = 0;
for j = i+1:n
t = t+G(j,i)*x(j);
end
x(i) = (y(i)-t)/G(i,i);
end
x = x';
end