Computes the eigenvalues and eigenvectors of a real square matrix.

tch_eig(x, eigenvectors = FALSE)

Arguments

x

tensor object

eigenvectors

True to compute both eigenvalues and eigenvectors; otherwise, only eigenvalues will be computed.

Examples

x <- tensor(matrix(runif(25), 5, 5)) tch_eig(x)
#> [[1]] #> tensor #> 1.9042 0.0000 #> -0.0420 0.6419 #> -0.0420 -0.6419 #> -0.1454 0.1315 #> -0.1454 -0.1315 #> [ Variable[CPUFloatType]{5,2} ] #> #> [[2]] #> tensor #> [ Variable[CPUFloatType]{0} ] #>