1% Simple example of using MUMPS in matlab 2 3% initialization of a matlab MUMPS structure 4id = initmumps; 5% here JOB = -1, the call to MUMPS will initialize C 6% and fortran MUMPS structure 7id = zmumps(id); 8% load a sparse matrix 9load lhr01; 10mat = Problem.A; 11n = size(mat,1); 12mat = mat + sparse(1:n,1:n,i*ones(n,1)); 13% JOB = 6 means analysis+facto+solve 14id.JOB = 6; 15id.ICNTL(6) = 0; 16% we set the rigth hand side 17id.RHS = ones(size(mat,1),1); 18%call to mumps 19id = zmumps(id,mat); 20% we see that there is a memory problem in INFOG(1) and INFOG(2) 21id.INFOG(1) 22id.INFOG(2) 23% we activate the numerical maximun transversal 24id.ICNTL(6) = 6; 25id = zmumps(id,mat); 26if(norm(mat*id.SOL - ones(size(mat,1),1),'inf') > sqrt(eps)) 27 disp('WARNING : precision may not be OK'); 28else 29 disp('SOLUTION OK'); 30end 31norm(mat*id.SOL - ones(size(mat,1),1),'inf') 32% destroy mumps instance 33id.JOB = -2; 34id = zmumps(id) 35 36disp('Press any key'); 37pause; 38 39% initialization of a matlab MUMPS structure 40id = initmumps; 41% here JOB = -1, the call to MUMPS will initialize C 42% and fortran MUMPS structure 43id = zmumps(id); 44% load a sparse matrix 45load lhr01; 46mat = Problem.A; 47n = size(mat,1); 48% JOB = 6 means analysis+facto+solve 49id.JOB = 6; 50id.ICNTL(6) = 0; 51% we set the rigth hand side 52id.RHS = ones(size(mat,1),1); 53%call to mumps 54id = zmumps(id,mat); 55% we see that there is a memory problem in INFOG(1) and INFOG(2) 56id.INFOG(1) 57id.INFOG(2) 58% we activate the numerical maximun transversal 59id.ICNTL(6) = 6; 60id = zmumps(id,mat); 61if(norm(mat*id.SOL - ones(size(mat,1),1),'inf') > sqrt(eps)) 62 disp('WARNING : precision may not be OK'); 63else 64 disp('SOLUTION OK'); 65end 66norm(mat*id.SOL - ones(size(mat,1),1),'inf') 67% destroy mumps instance 68id.JOB = -2; 69id = zmumps(id) 70