1%Example of
using MUMPS in matlab with schur option
3% initialization of a matlab
MUMPS structure
10mat =
mat+sparse(1:n,1:n,3*themax*ones(
n,1));
12% initialization of Schur option
13id.VAR_SCHUR = [n-9:n];
15%
JOB = 6 means analysis+facto+solve
17id.RHS = ones(size(
mat,1),1);
20disp(
'*** check solution restricted to mat(1:n-10,1:n-10)');
21if(
norm(
mat(1:
n-10,1:
n-10)*
id.
SOL(1:
n-10) - ones(
n-10,1),
'inf') > sqrt(eps))
22 disp(
'WARNING : precision may not be OK');
24 disp(
'SCHUR SOLUTION CHECK1 OK');
29% we want to use Schur complement to solve
31% with
sol =
x and rhs = rhs1
34% check that
the complete solution verify
35%
y = S^(-1) * (rhs2 - A_{2,1} * A_{1,1}^(-1) * rhs1)
37%
x = A_{1,1}^(-1) * rhs1) - A_{1,2} *
y
44% usually
the resolution below is replaced by an iterative scheme
56disp(
'*** check complete solution');
57if(
norm(
r,
'inf') > sqrt(eps))
58 disp(
'WARNING : precision may not be OK');
60 disp(
'SCHUR SOLUTION CHECK2 OK');
66%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
67% NOW TRY REDUCED
RHS FUNCTIONALITY
68% (easier to use than previous
70%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73% Do forward solution step to obtain a reduced
RHS
78% Solve
the problem on
the interface
79id.REDRHS =
id.SCHUR \ id.REDRHS;
81% Do backward solution stage to expand
the solution
85disp(
'*** check solution when REDRHS is used');
86if(
norm(
r,
'inf') > sqrt(eps))
87 disp(
'WARNING : precision may not be OK');
89 disp(
'SCHUR SOLUTION CHECK3 OK');
!This file is part of MUMPS
end diagonal values have been computed in the(sparse) matrix id.SOL
end[inform, rinform, sol, inst, schur, redrhs, pivnul_list, sym_perm, uns_perm, icntl, cntl, colsca_out, rowsca_out, keep_out, dkeep_out]
we set the rigth hand side id RHS
if(norm(mat *id.SOL - id.RHS, 'inf') > sqrt(eps)) disp('WARNING els disp)('SOLUTION OK')
****************************************This help menu gives details about the use of dmumps
end norm(mat(1:n-10, 1:n-10) *id.SOL(1:n-10) - ones(n-10, 1), 'inf') % we want to use Schur complement to solve % A *sol