lapeighi#

Purpose#

Computes eigenvalues only of a real symmetric or complex Hermitian matrix selected by index.

Format#

ve = lapeighi(x, il, iu, abstol)#
Parameters:
  • x (NxN matrix) – real symmetric or complex Hermitian.

  • il (scalar) – index of the smallest desired eigenvalue ranking them from smallest to largest.

  • iu (scalar) – index of the largest desired eigenvalue, iu must be greater than il.

  • abstol (scalar) – the absolute error tolerance for the eigenvalues. An approximate eigenvalue is accepted as converged when it is determined to lie in an interval \([a, b]\) of width less than or equal to \(abstol + EPS*max(|a|, |b|)\), where EPS is machine precision. If abstol is less than or equal to zero, then \(EPS*||T||\) will be used in its place, where T is the tridiagonal matrix obtained by reducing the input matrix to tridiagonal form.

Returns:

ve ((iu-il+1)x1 vector) – eigenvalues.

Examples#

// Define x matrix
x = { 5 2 1,
      2 6 2,
      1 2 9 };

// Index of smallest desired eigenvalue
il = 2;

// Index of largest desired eigenvalue
iu = 3;

// Compute eigenvalues with indices between
// il and iu
ve = lapeighi(x, il, iu, 0);

// Print eigenvalues
print ve;

The code above calculates the second and third eigenvalues and returns:

6.0000
10.6056

To calculate the first, second and third eigenvalues, reusing the same x from above:

// Index of smallest desired eigenvalue
il = 1;

// Index of largest desired eigenvalue
iu = 3;

// Compute eigenvalues with indices between
// il and iu
ve = lapeighi(x, il, iu, 0);

// Print eigenvalues
print ve;

The output from this code is:

 3.3944
 6.0000
10.6056

Remarks#

lapeighi() computes \(iu-il+1\) eigenvalues only given a range of indices, i.e., the ith to jth eigenvalues, ranking them from smallest to largest. To find eigenvalues within a specified range see lapeighxb(). For eigenvectors see lapeighvi(), or lapeighvb(). lapeighi() is based on the LAPACK drivers DSYEVX and ZHEEVX. Further documentation of these functions may be found in the LAPACK User’s Guide.

See also

Functions lapeighb(), lapeighvi(), lapeighvb()