ivy.eigh(x, /, *, UPLO='L', out=None)[source]#

Return an eigendecomposition x = QLQᵀ of a symmetric matrix (or a stack of symmetric matrices) x, where Q is an orthogonal matrix (or a stack of matrices) and L is a vector (or a stack of vectors).


The function eig will be added in a future version of the specification, as it requires complex number support, once complex numbers are supported, each square matrix must be Hermitian.


Whether an array library explicitly checks whether an input array is a symmetric matrix (or a stack of symmetric matrices) is implementation-defined.


x (Union[Array, NativeArray]) – input array having shape (..., M, M) and whose innermost two dimensions form square matrices. Must have a floating-point data type.

Return type:

Tuple[Union[Array, NativeArray]]


  • ret – a namedtuple (eigenvalues, eigenvectors) whose

    • first element must have the field name eigenvalues (corresponding to L above) and must be an array consisting of computed eigenvalues. The array containing the eigenvalues must have shape (..., M).

    • second element have have the field name eigenvectors (corresponding to Q above) and must be an array where the columns of the inner most matrices contain the computed eigenvectors. These matrices must be orthogonal. The array containing the eigenvectors must have shape (..., M, M).

    • Each returned array must have the same floating-point data type as x.

  • .. note:: – Eigenvalue sort order is left unspecified and is thus implementation-dependent.

This function conforms to the Array API Standard. This docstring is an extension of the docstring # noqa in the standard.

Both the description and the type hints above assumes an array input for simplicity, but this function is nestable, and therefore also accepts ivy.Container instances in place of any of the arguments.

Array.eigh(self, /, *, UPLO='L', out=None)#
Return type:


Container.eigh(self, /, *, UPLO='L', key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)#

ivy.Container instance method variant of ivy.eigh. This method simply wraps the function, and so the docstring for ivy.eigh also applies to this method with minimal changes.

  • self (ivy.Container) – Ivy container having shape (…, M, M) and whose innermost two dimensions form square matrices. Should have a floating-point data type.

  • UPLO (str, optional) – Specifies whether the upper or lower triangular part of the (default: 'L') Hermitian matrix should be used for the eigenvalue decomposition. Default is ‘L’.

  • key_chains (Union[List[str], Dict[str, str]], optional) – The key-chains to apply or not apply the method to. Default is None. (default: None)

  • to_apply (bool, optional) – If True, the method will be applied to key_chains, otherwise key_chains (default: True) will be skipped. Default is True.

  • prune_unapplied (bool, optional) – Whether to prune key_chains for which the function was not applied. (default: False) Default is False.

  • map_sequences (bool, optional) – Whether to also map method to sequences (lists, tuples). (default: False) Default is False.

  • out (ivy.Container, optional) – Optional output container, for writing the result to. (default: None) It must have a shape that the inputs broadcast to.

Return type:



ivy.Container – A container containing the computed eigenvalues. The returned array must have shape (…, M) and have the same data type as self.


With ivy.Container inputs:

>>> x = ivy.Container(a=ivy.array([[[1.,2.],[2.,1.]]]),
...                   b=ivy.array([[[2.,4.],[4.,2.]]]))
>>> y = x.eigh()
>>> print(y)
    'a': ivy.array([[-1., 3.]]),
    'b': ivy.array([[-2., 6.]])