Have a question? Connect with the community at the TensorFlow Forum Visit Forum


Computes the eigenvalues of a Hermitian tridiagonal matrix.

alpha A real or complex tensor of shape (n), the diagonal elements of the matrix. NOTE: If alpha is complex, the imaginary part is ignored (assumed zero) to satisfy the requirement that the matrix be Hermitian.
beta A real or complex tensor of shape (n-1), containing the elements of the first super-diagonal of the matrix. If beta is complex, the first sub-diagonal of the matrix is assumed to be the conjugate of beta to satisfy the requirement that the matrix be Hermitian
eigvals_only If False, both eigenvalues and corresponding eigenvectors are computed. If True, only eigenvalues are computed. Default is True.
select Optional string with values in {‘a’, ‘v’, ‘i’} (default is 'a') that determines which eigenvalues to calculate: 'a': all eigenvalues. ‘v’: eigenvalues in the interval (min, max] given by select range. 'i’: eigenvalues with indices min <= i <= max.
select_range Size 2 tuple or list or tensor specifying the range of eigenvalues to compute together with select. If select is 'a', select_range is ignored.
tol Optional scalar. The absolute tolerance to which each eigenvalue is required. An eigenvalue (or cluster) is considered to have converged if it lies in an interval of this width. If tol is None (default), the value eps*|T|_2 is used where eps is the machine precision, and |T|_2 is the 2-norm of the matrix T.
name Optional name of the op.

eig_vals The eigenvalues of the matrix in non-decreasing order.
eig_vectors If eigvals_only is False the eigenvectors are returned in the second output argument.

ValueError If input values are invalid.
NotImplemented Computing eigenvectors for eigvals_only = False is not implemented yet.

This op implements a subset of the functionality of scipy.linalg.eigh_tridiagonal.

a) Complete scipy.linalg.compatibility:

1. Add support for computing eigenvectors.

b) Add support for outer batch dimensions.


import numpy
eigvals = tf.linalg.eigh_tridiagonal([0.0, 0.0, 0.0], [1.0, 1.0])
eigvals_expected = [-numpy.sqrt(2.0), 0.0, numpy.sqrt(2.0)]
tf.assert_near(eigvals_expected, eigvals)
# ==> True