eigh

paddle.linalg. eigh ( x, UPLO='L', name=None ) [source]

Compute the eigenvalues and eigenvectors of a complex Hermitian (conjugate symmetric) or a real symmetric matrix.

Parameters
  • x (Tensor) – A tensor with shape \([*, N, N]\) , The data type of the input Tensor x should be one of float32, float64, complex64, complex128.

  • UPLO (str, optional) – (string, default ‘L’), ‘L’ represents the lower triangular matrix, “‘U’ represents the upper triangular matrix.”.

  • name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name.

Returns

A Tensor with shape [ *, N] and data type of float32 and float64.

System Message: WARNING/2 (/usr/local/lib/python3.8/site-packages/paddle/tensor/linalg.py:docstring of paddle.tensor.linalg.eigh, line 16); backlink

Inline emphasis start-string without end-string.

The eigenvalues of eigh op.

System Message: WARNING/2 (/usr/local/lib/python3.8/site-packages/paddle/tensor/linalg.py:docstring of paddle.tensor.linalg.eigh, line 18)

Definition list ends without a blank line; unexpected unindent.

  • out_vector(Tensor): A Tensor with shape [ *, N, N] and data type of float32,float64,

    System Message: WARNING/2 (/usr/local/lib/python3.8/site-packages/paddle/tensor/linalg.py:docstring of paddle.tensor.linalg.eigh, line 18); backlink

    Inline emphasis start-string without end-string.

    complex64 and complex128. The eigenvectors of eigh op.

Return type

  • out_value(Tensor)

Examples

import paddle

x = paddle.to_tensor([[1, -2j], [2j, 5]])
out_value, out_vector = paddle.linalg.eigh(x, UPLO='L')
print(out_value)
#[0.17157288, 5.82842712]
print(out_vector)
#[(-0.9238795325112867+0j), (-0.3826834323650898+0j)],
#[ 0.3826834323650898j    , -0.9238795325112867j    ]]