File: sparserhs_example.m

package info (click to toggle)
mumps 4.9.2.dfsg-4
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 9,888 kB
  • ctags: 9,042
  • sloc: fortran: 240,256; ansic: 11,750; xml: 517; makefile: 305
file content (28 lines) | stat: -rw-r--r-- 595 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
%Example of using MUMPS in matlab with sparse right hansd side

% initialization of a matlab MUMPS structure
id = initmumps;
id = dmumps(id);
load lhr01;
mat = Problem.A;
% JOB = 6 means analysis+facto+solve
id.JOB = 6;
% we set the rigth hand side
id.RHS = ones(size(mat,1),2);
id.RHS(:,2) = 2*id.RHS(:,2);
id.RHS = sparse(id.RHS);
%call to mumps
id = dmumps(id,mat);
if(norm(mat*id.SOL - id.RHS,'inf') > sqrt(eps))
	disp('WARNING : precision may not be OK');
else
	disp('SOLUTION OK');
end
norm(mat*id.SOL - id.RHS,'inf')
% solution OK
% destroy mumps instance
id.JOB = -2;
id = dmumps(id)