PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_sparseig_real_init (f12aa)
Purpose
nag_sparseig_real_init (f12aa) is a setup function in a suite of functions consisting of
nag_sparseig_real_init (f12aa),
nag_sparseig_real_iter (f12ab),
nag_sparseig_real_proc (f12ac),
nag_sparseig_real_option (f12ad) and
nag_sparseig_real_monit (f12ae). It is used to find some of the eigenvalues (and optionally the corresponding eigenvectors) of a standard or generalized eigenvalue problem defined by real nonsymmetric matrices.
The suite of functions is suitable for the solution of large sparse, standard or generalized, nonsymmetric 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 eigenvalue problem , or of a generalized eigenvalue problem of order , where is large and the coefficient matrices and are sparse, real and nonsymmetric. The suite can also be used to find selected eigenvalues/eigenvectors of smaller scale dense, real and nonsymmetric problems.
nag_sparseig_real_init (f12aa) is a setup function which must be called before
nag_sparseig_real_iter (f12ab), the reverse communication iterative solver, and before
nag_sparseig_real_option (f12ad), the options setting function.
nag_sparseig_real_proc (f12ac) is a post-processing function that must be called following a successful final exit from
nag_sparseig_real_iter (f12ab), while
nag_sparseig_real_monit (f12ae) 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_real_option (f12ad), 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_real_option (f12ad).
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:
– double 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, where .
Open in the MATLAB editor:
f12aa_example
function f12aa_example
fprintf('f12aa example results\n\n');
nx = int64(10);
n = nx^2;
nev = int64(10);
ncv = int64(30);
h = 1/(double(nx)+1);
rho = 100;
irevcm = int64(0);
resid = zeros(n,1);
v = zeros(n, ncv);
x = zeros(n, 1);
mx = zeros(n, 1);
dd = 4/h^2;
dl = -1/h^2 - rho/(2*h);
du = -1/h^2 + rho/(2*h);
y = zeros(n,1);
[icomm, comm, ifail] = f12aa( ...
n, nev, ncv);
[icomm, comm, ifail] = f12ad( ...
'Smallest Mag', icomm, comm);
while (irevcm ~= 5)
[irevcm, resid, v, x, mx, nshift, comm, icomm, ifail] = ...
f12ab( ...
irevcm, resid, v, x, mx, comm, icomm);
if (irevcm == -1 || irevcm == 1)
y(1:nx:n) = dd*x(1:nx:n) + du*x(2:nx:n);
for j = 2:nx-1
y(j:nx:n) = dl*x(j-1:nx:n) + dd*x(j:nx:n) + du*x(j+1:nx:n);
end
y(nx:nx:n) = dl*x(nx-1:nx:n) + dd*x(nx:nx:n);
y(1:nx) = y(1:nx) - (1/h^2)*x(nx+1:2*nx);
for j = 2:nx-1
lo = (j-1)*nx;
y(lo+1:lo+nx) = y(lo+1:lo+nx) - (1/h^2)*x(lo+nx+1:lo+2*nx) ...
- (1/h^2)*x(lo-nx+1:lo);
end
lo = (nx-1)*nx;
y(lo+1:lo+nx) = y(lo+1:lo+nx) - (1/h^2)*x(lo-nx+1:lo);
x = y;
end
end
[nconv, dr, di, z, v, comm, icomm, ifail] = ...
f12ac( ...
0, 0, resid, v, comm, icomm);
fprintf('The %4d Ritz values of smallest magnitude are:\n\n',nconv);
fprintf('%9.3f %+9.3fi\n', [dr di]');
f12aa example results
The 10 Ritz values of smallest magnitude are:
251.803 +152.711i
251.803 -152.711i
280.417 +152.711i
280.417 -152.711i
325.524 +152.711i
325.524 -152.711i
383.470 +152.711i
383.470 -152.711i
449.560 +152.711i
449.560 -152.711i
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015