平方根分解(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:nt = 0;for s = 1:i-1t = t+ G(i,s)^2;endG(i,i) = sqrt(A(i,i)-t);for k = i+1:nt = 0;for s = 1:i-1t = t+G(i,s)*G(k,s);endG(k,i) = (A(k,i)-t)/G(i,i);endend% 回代for i = 1:nt = 0;for j = 1:i-1t = t+G(i,j)*y(j);endy(i)=(b(i)-t)/G(i,i);endfor i = n:-1:1t = 0;for j = i+1:nt = t+G(j,i)*x(j);endx(i) = (y(i)-t)/G(i,i);endx = x';
end