你已经派生过 em3d-mt
镜像自地址
https://gitee.com/sduem/em3d-mt.git
已同步 2025-09-19 09:53:48 +08:00
26
bin/RMT3d/umfpack_MT.m
普通文件
26
bin/RMT3d/umfpack_MT.m
普通文件
@@ -0,0 +1,26 @@
|
||||
function [x,res] = umfpack_MT(A,b)
|
||||
% Solve for x in linear system A * x = b.
|
||||
|
||||
fprintf ('Solution to Ax=b via UMFPACK\n') ;
|
||||
|
||||
% Compute the numeric factorization via UMFPACK.
|
||||
t = tic;
|
||||
[L,U,P,Q,R,Info] = umfpack (A, struct ('details',0));
|
||||
time(1) = toc(t);
|
||||
fprintf (['The LU factorization time is ' num2str(time(1)) 's\n']) ;
|
||||
|
||||
% Compute the solution x using the symbolic factorization.
|
||||
t = tic;
|
||||
x = Q*(U\(L\(P*(R\b))));
|
||||
x = full(x);
|
||||
time(2) = toc(t);
|
||||
fprintf (['The symbolic factorization time is ' num2str(time(2)) 's\n']) ;
|
||||
|
||||
% Compute the residuals.
|
||||
|
||||
for i = 1:2%size(b,2)
|
||||
res(i) = norm(A*x(:,i)-b(:,i))/norm(b(:,i));
|
||||
fprintf('%s %d\n',['Normalized residual from SuiteSparse for rhs' num2str(i) ' is'], res(i));
|
||||
end
|
||||
|
||||
end
|
在新工单中引用
屏蔽一个用户