OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
diagainv_example.m
Go to the documentation of this file.
1%Example of using MUMPS in matlab to compute diagonal of inverse of A
2
3% Change to true to test example complex arithmetic
5
6% initialization of a matlab MUMPS structure
7id = initmumps;
9 id = zmumps(id);
10else
11 id = dmumps(id);
12end
13load lhr01;
14mat = Problem.A;
15
17 % To test complex version
18 mat = mat + i * speye(size(mat,1),size(mat,1));
19end
20
21% JOB = 4 means analysis+factorization
22id.JOB = 4;
24 id = zmumps(id,mat);
25else
26 id = dmumps(id,mat);
27end
28
29% Set the right hand side structure to requested entries of A-1
30id.RHS = speye(size(mat,1),size(mat,1)); % Sparse format required
31
32%call MUMPS solution phase to compute diagonal entries of A-1
33id.ICNTL(30)=1; % Ask for A-1 entries
34id.JOB=3;
35
36
38 id = zmumps(id,mat);
39else
40 id = dmumps(id,mat);
41end
42
43% diagonal values have been computed in
44% the (sparse) matrix id.SOL, which has
45% the same structure as id.RHS
46
47% Compare diagonal of inverse computed by Mumps and by matlab
48disp(' ');
49disp('Computing 2-norm of error on diagonal of inverse:');
50norm(diag( diag(diag(inv(mat)))-id.SOL ),2)
51
52% destroy mumps instance
53id.JOB = -2;
55 id = zmumps(id)
56else
57 id = dmumps(id)
58end
#define ICNTL(I)
!This file is part of MUMPS
Definition cmumps_root.h:2
end load lhr01
end diagonal values have been computed in the(sparse) matrix id.SOL
false complex_arithmetic
size(mat, 1), size(mat, 1) speye()
norm(diag(diag(diag(inv(mat))) -id.SOL), 2) % destroy mumps instance id.JOB
end[inform, rinform, sol, inst, schur, redrhs, pivnul_list, sym_perm, uns_perm, icntl, cntl, colsca_out, rowsca_out, keep_out, dkeep_out]
Definition dmumps.m:40
id SOL
Definition dmumps.m:43
initmumps id
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
Definition mumps_help.m:2
#define JOB
Definition mumpsmex.c:33
subroutine zmumps(id)