dpnp.linalg.eigh

dpnp.linalg.eigh(a, UPLO='L')[source]

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

Returns two objects, a 1-D array containing the eigenvalues of a, and a 2-D square array or matrix (depending on the input type) of the corresponding eigenvectors (in columns).

For full documentation refer to numpy.linalg.eigh.

Parameters:
  • a ((..., M, M) {dpnp.ndarray, usm_ndarray}) -- A complex- or real-valued array whose eigenvalues and eigenvectors are to be computed.

  • UPLO ({"L", "U"}, optional) -- Specifies the calculation uses either the lower ("L") or upper ("U") triangular part of the matrix. Regardless of this choice, only the real parts of the diagonal are considered to preserve the Hermite matrix property. It therefore follows that the imaginary part of the diagonal will always be treated as zero. Default: "L".

Returns:

  • w ((..., M) dpnp.ndarray) -- The eigenvalues in ascending order, each repeated according to its multiplicity.

  • v ((..., M, M) dpnp.ndarray) -- The column v[:, i] is the normalized eigenvector corresponding to the eigenvalue w[i].

See also

dpnp.linalg.eigvalsh

Compute the eigenvalues of a complex Hermitian or real symmetric matrix.

dpnp.linalg.eig

Compute the eigenvalues and right eigenvectors of a square array.

dpnp.linalg.eigvals

Compute the eigenvalues of a general matrix.

Examples

>>> import dpnp as dp
>>> a = dp.array([[1, -2j], [2j, 5]])
>>> a
array([[ 1.+0.j, -0.-2.j],
       [ 0.+2.j,  5.+0.j]])
>>> w, v = dp.linalg.eigh(a)
>>> w; v
array([0.17157288, 5.82842712]),
array([[-0.92387953-0.j        , -0.38268343+0.j        ], # may vary
       [ 0.        +0.38268343j,  0.        -0.92387953j]]))