hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_sparseig_complex_band_init (f12at)

Purpose

nag_sparseig_complex_band_init (f12at) is a setup function for nag_sparseig_complex_band_solve (f12au) which may be used for finding some eigenvalues (and optionally the corresponding eigenvectors) of a standard or generalized eigenvalue problem defined by complex, banded, non-Hermitian matrices. The banded matrix must be stored using the LAPACK column ordered storage format for complex banded non-Hermitian matrices (see Section [Band storage] in the F07 Chapter Introduction).

Syntax

[icomm, comm, ifail] = f12at(n, nev, ncv)
[icomm, comm, ifail] = nag_sparseig_complex_band_init(n, nev, ncv)

Description

The pair of functions nag_sparseig_complex_band_init (f12at) and nag_sparseig_complex_band_solve (f12au) together with the option setting function nag_sparseig_complex_option (f12ar) are designed to calculate some of the eigenvalues, λ λ , (and optionally the corresponding eigenvectors, x x ) of a standard eigenvalue problem Ax = λx Ax = λx , or of a generalized eigenvalue problem Ax = λBx Ax = λBx  of order n n , where n n  is large and the coefficient matrices A A  and B B  are banded complex and non-Hermitian.
nag_sparseig_complex_band_init (f12at) is a setup function which must be called before the option setting function nag_sparseig_complex_option (f12ar) and the solver function nag_sparseig_complex_band_solve (f12au). Internally, nag_sparseig_complex_band_solve (f12au) makes calls to nag_sparseig_complex_iter (f12ap) and nag_sparseig_complex_proc (f12aq); the function documents for nag_sparseig_complex_iter (f12ap) and nag_sparseig_complex_proc (f12aq) should be consulted for details of the algorithm used.
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 Section [Description of the Optional s] in (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:     n – int64int32nag_int scalar
The order of the matrix AA (and the order of the matrix BB for the generalized problem) that defines the eigenvalue problem.
Constraint: n > 0n>0.
2:     nev – int64int32nag_int scalar
The number of eigenvalues to be computed.
Constraint: 0 < nev < n10<nev<n-1.
3:     ncv – int64int32nag_int scalar
The number of Lanczos 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 ncv2 × nev + 1ncv2×nev+1. 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: nev + 1 < ncvnnev+1<ncvn.

Optional Input Parameters

None.

Input Parameters Omitted from the MATLAB Interface

licomm lcomm

Output Parameters

1:     icomm(max (1,licomm)max(1,licomm)) – int64int32nag_int array
Contains data to be communicated to nag_sparseig_complex_band_solve (f12au).
2:     comm(max (1,lcomm)max(1,lcomm)) – complex array
Contains data to be communicated to nag_sparseig_complex_band_solve (f12au).
3:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
Constraint: n > 0n>0.
  ifail = 2ifail=2
Constraint: nev > 0nev>0.
  ifail = 3ifail=3
Constraint: ncv > nev + 1ncv>nev+1 and ncvnncvn.
  ifail = 4ifail=4
The length of the integer array icomm is too small licomm = _licomm =_, but must be at least __.
  ifail = 5ifail=5
The length of the complex array comm is too small lcomm = _lcomm =_, but must be at least __.

Accuracy

Not applicable.

Further Comments

None.

Example

function nag_sparseig_complex_band_init_example
nx = 10;
n = nx*nx;
nev = 4;
ncv = 10;
sigma = 0.4 + 0.6i;

% Construct the matrix A in banded form and store in AB.
% KU, KL are number of superdiagonals and subdiagonals within
% the band of matrices A and M.
kl = nx;
ku = nx;

% Construct ab and mb
ab = zeros(2*kl+ku+1,n);
mb = zeros(2*kl+ku+1,n);

% Main diagonal of A.
idiag = kl + ku + 1;
ab(idiag,1:n) = 4;
mb(idiag,1:n) = ab(idiag,1);

% First subdiagonal and superdiagonal of A.
isup = kl + ku;
isub = kl + ku + 2;
rho = 100;
h = 1/(nx+1);
for i=1:nx
  lo = (i-1)*nx;
  for j=lo+1:lo+nx-1
    ab(isub,j+1) = -1 + 0.5*h*rho;
    ab(isup,j) = -1 - 0.5*h*rho;
  end
end
mb(isub,2:n)   = 1;
mb(isup,1:n-1) = 1;

% kl-th subdiagonal and ku-th super-diagonal.
isup = kl + 1;
isub = 2*kl + ku + 1;
for i = 1:nx - 1
  lo = (i-1)*nx;
  for j = lo + 1:lo + nx
    ab(isup,nx+j) = -1;
    ab(isub,j) = -1;
  end
end

resid = complex(zeros(100,1));

[icomm, comm, ifail] = nag_sparseig_complex_band_init(int64(n), int64(nev), int64(ncv));
[icomm, comm, ifail] = nag_sparseig_complex_option('SHIFTED INVERSE', icomm, comm);
[icomm, comm, ifail] = nag_sparseig_complex_option('GENERALIZED', icomm, comm);

% Find eigenvalues closest in value to SIGMA and corresponding eigenvectors
[nconv, d, z, resid, v, comm, icomm, ifail] = ...
        nag_sparseig_complex_band_solve(int64(kl), int64(ku), complex(ab), complex(mb), sigma, resid, ...
              comm, icomm);

fprintf('\nRitz values closest to sigma:\n');
disp(d);
 

Ritz values closest to sigma:
   0.3610 + 0.7223i
   0.4598 + 0.7199i
   0.2868 + 0.7241i
   0.2410 + 0.7257i


function f12at_example
nx = 10;
n = nx*nx;
nev = 4;
ncv = 10;
sigma = 0.4 + 0.6i;

% Construct the matrix A in banded form and store in AB.
% KU, KL are number of superdiagonals and subdiagonals within
% the band of matrices A and M.
kl = nx;
ku = nx;

% Construct ab and mb
ab = zeros(2*kl+ku+1,n);
mb = zeros(2*kl+ku+1,n);

% Main diagonal of A.
idiag = kl + ku + 1;
ab(idiag,1:n) = 4;
mb(idiag,1:n) = ab(idiag,1);

% First subdiagonal and superdiagonal of A.
isup = kl + ku;
isub = kl + ku + 2;
rho = 100;
h = 1/(nx+1);
for i=1:nx
  lo = (i-1)*nx;
  for j=lo+1:lo+nx-1
    ab(isub,j+1) = -1 + 0.5*h*rho;
    ab(isup,j) = -1 - 0.5*h*rho;
  end
end
mb(isub,2:n)   = 1;
mb(isup,1:n-1) = 1;

% kl-th subdiagonal and ku-th super-diagonal.
isup = kl + 1;
isub = 2*kl + ku + 1;
for i = 1:nx - 1
  lo = (i-1)*nx;
  for j = lo + 1:lo + nx
    ab(isup,nx+j) = -1;
    ab(isub,j) = -1;
  end
end

resid = complex(zeros(100,1));

[icomm, comm, ifail] = f12at(int64(n), int64(nev), int64(ncv));
[icomm, comm, ifail] = f12ar('SHIFTED INVERSE', icomm, comm);
[icomm, comm, ifail] = f12ar('GENERALIZED', icomm, comm);

% Find eigenvalues closest in value to SIGMA and corresponding eigenvectors
[nconv, d, z, resid, v, comm, icomm, ifail] = ...
        f12au(int64(kl), int64(ku), complex(ab), complex(mb), sigma, resid, ...
              comm, icomm);

fprintf('\nRitz values closest to sigma:\n');
disp(d);
 

Ritz values closest to sigma:
   0.3610 + 0.7223i
   0.4598 + 0.7199i
   0.2868 + 0.7241i
   0.2410 + 0.7257i



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013