linalg_eig {torch}R Documentation

Computes the eigenvalue decomposition of a square matrix if it exists.

Description

Letting \mathbb{K} be \mathbb{R} or \mathbb{C}, the eigenvalue decomposition of a square matrix A \in \mathbb{K}^{n \times n} (if it exists) is defined as

Usage

linalg_eig(A)

Arguments

A

(Tensor): tensor of shape ⁠(*, n, n)⁠ where * is zero or more batch dimensions consisting of diagonalizable matrices.

Details

Equation not displayed. Install 'katex' then re-install 'torch'.

This decomposition exists if and only if A is diagonalizable_. This is the case when all its eigenvalues are different. Supports input of float, double, cfloat and cdouble dtypes. Also supports batches of matrices, and if A is a batch of matrices then the output has the same batch dimensions.

Value

A list ⁠(eigenvalues, eigenvectors)⁠ which corresponds to \Lambda and V above. eigenvalues and eigenvectors will always be complex-valued, even when A is real. The eigenvectors will be given by the columns of eigenvectors.

Warning

Note

The eigenvalues and eigenvectors of a real matrix may be complex.

See Also

Other linalg: linalg_cholesky_ex(), linalg_cholesky(), linalg_det(), linalg_eigh(), linalg_eigvalsh(), linalg_eigvals(), linalg_householder_product(), linalg_inv_ex(), linalg_inv(), linalg_lstsq(), linalg_matrix_norm(), linalg_matrix_power(), linalg_matrix_rank(), linalg_multi_dot(), linalg_norm(), linalg_pinv(), linalg_qr(), linalg_slogdet(), linalg_solve(), linalg_svdvals(), linalg_svd(), linalg_tensorinv(), linalg_tensorsolve(), linalg_vector_norm()

Examples

if (torch_is_installed()) {
a <- torch_randn(2, 2)
wv <- linalg_eig(a)
}

[Package torch version 0.12.0 Index]