PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_sparseig_complex_init (f12an)
Purpose
nag_sparseig_complex_init (f12an) is a setup function in a suite of functions consisting of
nag_sparseig_complex_init (f12an),
nag_sparseig_complex_iter (f12ap),
nag_sparseig_complex_proc (f12aq),
nag_sparseig_complex_option (f12ar) and
nag_sparseig_complex_monit (f12as). It is used to find some of the eigenvalues (and optionally the corresponding eigenvectors) of a standard or generalized eigenvalue problem defined by complex nonsymmetric matrices.
The suite of functions is suitable for the solution of large sparse, standard or generalized, nonsymmetric complex eigenproblems where only a few eigenvalues from a selected range of the spectrum are required.
Syntax
Description
The suite of functions is designed to calculate some of the eigenvalues, , (and optionally the corresponding eigenvectors, ) of a standard complex eigenvalue problem , or of a generalized complex eigenvalue problem of order , where is large and the coefficient matrices and are sparse, complex and nonsymmetric. The suite can also be used to find selected eigenvalues/eigenvectors of smaller scale dense, complex and nonsymmetric problems.
nag_sparseig_complex_init (f12an) is a setup function which must be called before
nag_sparseig_complex_iter (f12ap), the reverse communication iterative solver, and before
nag_sparseig_complex_option (f12ar), the options setting function.
nag_sparseig_complex_proc (f12aq) is a post-processing function that must be called following a successful final exit from
nag_sparseig_complex_iter (f12ap), while
nag_sparseig_complex_monit (f12as) can be used to return additional monitoring information during the computation.
This setup function initializes the communication arrays, sets (to their default values) all options that can be set by you via the option setting function
nag_sparseig_complex_option (f12ar), and checks that the lengths of the communication arrays as passed by you are of sufficient length. For details of the options available and how to set them see
Description of the s in
nag_sparseig_complex_option (f12ar).
References
Lehoucq R B (2001) Implicitly restarted Arnoldi methods and subspace iteration SIAM Journal on Matrix Analysis and Applications 23 551–562
Lehoucq R B and Scott J A (1996) An evaluation of software for computing eigenvalues of sparse nonsymmetric matrices Preprint MCS-P547-1195 Argonne National Laboratory
Lehoucq R B and Sorensen D C (1996) Deflation techniques for an implicitly restarted Arnoldi iteration SIAM Journal on Matrix Analysis and Applications 17 789–821
Lehoucq R B, Sorensen D C and Yang C (1998) ARPACK Users' Guide: Solution of Large-scale Eigenvalue Problems with Implicitly Restarted Arnoldi Methods SIAM, Philidelphia
Parameters
Compulsory Input Parameters
- 1:
– int64int32nag_int scalar
-
The order of the matrix (and the order of the matrix for the generalized problem) that defines the eigenvalue problem.
Constraint:
.
- 2:
– int64int32nag_int scalar
-
The number of eigenvalues to be computed.
Constraint:
.
- 3:
– int64int32nag_int scalar
-
The number of Arnoldi basis vectors to use during the computation.
At present there is no
a priori analysis to guide the selection of
ncv relative to
nev. However, it is recommended that
. If many problems of the same type are to be solved, you should experiment with increasing
ncv while keeping
nev fixed for a given test problem. This will usually decrease the required number of matrix-vector operations but it also increases the work and storage required to maintain the orthogonal basis vectors. The optimal ‘cross-over’ with respect to CPU time is problem dependent and must be determined empirically.
Constraint:
.
Optional Input Parameters
None.
Output Parameters
- 1:
– int64int32nag_int array
-
Contains data to be communicated to the other functions in the suite.
- 2:
– complex array
-
Contains data to be communicated to the other functions in the suite.
- 3:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
On entry, .
-
-
On entry, .
-
-
On entry, or .
-
-
On entry, and .
-
-
On entry, and .
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
Not applicable.
Further Comments
None.
Example
This example solves in regular mode, where is obtained from the standard central difference discretization of the convection-diffusion operator on the unit square, with zero Dirichlet boundary conditions. The eigenvalues of largest magnitude are found.
Open in the MATLAB editor:
f12an_example
function f12an_example
fprintf('f12an example results\n\n');
load('west0479.mat')
A = west0479;
m = size(A,1);
n = int64(m);
nev = int64(8);
ncv = int64(20);
irevcm = int64(0);
resid = complex(zeros(n,1));
v = complex(zeros(n, ncv));
x = complex(zeros(n,1));
mx = complex(zeros(n,1));
sigma = complex(0);
[icomm, comm, ifail] = f12an(n, nev, ncv);
while (irevcm ~= 5)
[irevcm, resid, v, x, mx, nshift, comm, icomm, ifail] = ...
f12ap( ...
irevcm, resid, v, x, mx, comm, icomm);
if (irevcm == 1 || irevcm == -1)
x = A*x;
elseif (irevcm == 4)
[niter, nconv, ritz, rzest] = f12as( ...
icomm, comm);
fprintf('Iteration %2d, No. converged = %d', niter, nconv);
fprintf(' norm of estimates = %10.2e\n', norm(rzest(1:nev),2));
end
end
[nconv, d, z, v, comm, icomm, ifail] = ...
f12aq( ...
sigma, resid, v, comm, icomm);
fprintf('\n\nLargest %d Eigenvalues are:\n',nconv);
disp(sort(d(1:nconv),'descend'));
fig1 = figure;
plot(d(1:nconv),'b*');
title('Largest eigenvalues of sparse matrix west0479');
xlabel('real');
ylabel('imaginary')
f12an example results
Iteration 1, No. converged = 2 norm of estimates = 2.01e-02
Iteration 2, No. converged = 2 norm of estimates = 1.87e-02
Iteration 3, No. converged = 2 norm of estimates = 3.60e-03
Iteration 4, No. converged = 2 norm of estimates = 4.62e-05
Iteration 5, No. converged = 2 norm of estimates = 8.49e-08
Iteration 6, No. converged = 2 norm of estimates = 2.89e-10
Iteration 7, No. converged = 2 norm of estimates = 1.14e-12
Largest 8 Eigenvalues are:
1.0e+03 *
0.0000 + 1.7007i
0.0000 - 1.7007i
-0.1009 + 0.0666i
-0.1009 - 0.0666i
0.1081 + 0.0541i
0.1081 - 0.0541i
-0.0072 + 0.1207i
-0.0072 - 0.1207i
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015