eigenvalues_byname: Calculate eigenvalues of a matrix

View source: R/Unary.R

eigenvalues_bynameR Documentation

Calculate eigenvalues of a matrix

Description

Calculate the eigenvalues of a matrix or a list of matrices.

Usage

eigenvalues_byname(a)

Arguments

a

A matrix or list of matrices.

Details

This function pairs with eigenvectors_byname(); the first value of the result is the eigenvalue for the eigenvector reported in the first column of the result from eigenvectors_byname(). The second value of the result is the eigenvalue for the eigenvector reported in the second column of the result from eigenvectors_byname(). Etc.

Internally, this function uses base::eigen(only.values = TRUE).

complete_rows_cols() is called prior to calculating the eigenvalues.

Value

A vector of eigenvalues.

Examples

m <- matrix(c( 4,  6, 10, 
               3, 10, 13, 
              -2, -6, -8), byrow = TRUE, nrow = 3, ncol = 3, 
            dimnames = list(c("p1", "p2", "p3"), c("p1", "p2", "p3")))
m
eigenvalues_byname(m)
eigenvalues_byname(list(m, 2*m))
DF <- tibble::tibble(m_col = list(m, 2*m)) %>% 
  dplyr::mutate(
    eigen_col = eigenvalues_byname(m_col)
  )
DF$eigen_col[[1]]
DF$eigen_col[[2]]

matsbyname documentation built on Oct. 19, 2023, 5:11 p.m.