Computes selected eigenvalues and eigenvectors of a real symmetric or complex Hermitian matrix.


{ ve, va } = lapeighvi(x, il, iu, abstol)
  • 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.
  • ve ((iu-il+1)x1 vector) – eigenvalues.
  • va (Nx(iu-il+1) matrix) – eigenvectors.


// Assign x
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 and the corresponding eigenvectors
{ ve, va } = lapeighvi(x, il, iu, 0);
print "ve = " ve;
print "va = " va;
ve =

va =
-0.5774   0.3197
-0.5774   0.4908
 0.5774   0.8105


lapeighvi() computes \(iu-il+1\) eigenvalues and eigenvectors given a range of indices, i.e., the ith to jth eigenvalues, ranking them from smallest to largest. To find eigenvalues and eigenvectors within a specified range see lapeighvb(). lapeighvi() 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 lapeighvb(), lapeighb()