exampleherm

PURPOSE ^

This is an example script demonstrating how PARDISO works on a

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 This is an example script demonstrating how PARDISO works on a
 medium-sized Hermitian positive definite matrix.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % This is an example script demonstrating how PARDISO works on a
0002 % medium-sized Hermitian positive definite matrix.
0003 clear
0004 
0005 dkepath = load_structures_yp('dkepath','','');
0006 
0007 % Script parameters.
0008 % -----------------
0009 verbose = false;
0010 n       = 100;
0011 lambda  = 3;
0012 
0013 % Create the Hermitian positive definite matrix A and the vector b in the
0014 % linear system Ax = b.
0015 e = ones(n,1);
0016 A = spdiags([ i*e lambda*e -i*e ],-1:1,n,n);
0017 b = randn(n,1);
0018 
0019 % Compute solution to linear system
0020 % ---------------------------------
0021 % Initialize the PARDISO internal data structures. We've told PARDISO to
0022 % handle Hermitian positive definite matrices using the sparse direct
0023 % solver.
0024 info = pardisoinit(4,0);
0025 
0026 % Analyze the matrix and compute a symbolic factorization.
0027 info = pardisoreorder(tril(A),info,verbose);
0028 fprintf('The factors have %d nonzero entries.\n',info.iparm(18));
0029 
0030 % Compute the numeric factorization.
0031 info = pardisofactor(tril(A),info,verbose);
0032 
0033 % Compute the solution v using the symbolic factorization.
0034 [x info] = pardisosolve(tril(A),b,info,verbose);
0035 fprintf('PARDISO performed %d iterative refinement steps.\n',info.iparm(7));
0036 
0037 % Compute the residuals.
0038 r = abs(A*x - b);
0039 fprintf('The maximum residual for the solution is %0.3g.\n',max(r));
0040 
0041 % Free the PARDISO data structures.
0042 pardisofree(info);
0043 clear info

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.