資源簡介
預(yù)處理共軛梯度法求線性方程組Ax=b的解,數(shù)值計算,求解方程
代碼片段和文件信息
function?[xn]=?preconjgrad?(Abx0Meps)
if?nargin?==?4
????eps?=?1.0e-6;
end
r1?=?b-A*x0;
iM?=?inv(M);
z1?=?iM*r1;?
p??=?z1;
n??=?0;
tol=?1;
while?tol>=eps
????alpha??=?dot(r1z1)/dot(pA*p);?????
????x??=?x0?+?
評論
共有 條評論