DEFINITION MODULE TQLIM; (* EXPORT QUALIFIED TQLI; *) FROM NRVect IMPORT Vector; FROM NRMatr IMPORT Matrix; PROCEDURE TQLI(DD, E: Vector; Z: Matrix); (* QL algorithm with implicit shifts, to determine the eigenvalues and eigenvectors of a real, symmetric, tridiagonal matrix, or of a real, symmetric matrix previously reduced by TRED2 section 11.2. On input, D[n] contains the diagonal elements of the tridiagonal matrix. On output, it returns the eigenvalues. The vector E[n] inputs the subdiagonal elements of the tridiagonal matrix, with E[0] arbitrary. On output E is destroyed. When finding only the eigenvalues, several lines may be omitted, as noted in the comments. If the eigenvectors of a tridiagonal matrix are desired, the matrix Z[n, n] is input as the identity matrix. If the eigenvectors of a matrix that has been reduced by TRED2 are required, then Z is input as the matrix output by TRED2. In either case, the kth column of Z returns the normalized eigenvector corresponding to D[k]. *) END TQLIM.