eigen_decomposition

Function eigen_decomposition 

Source
pub fn eigen_decomposition(matrix: &Expr) -> Result<(Expr, Expr), String>
Expand description

Performs eigenvalue decomposition of a square matrix.

This function computes the eigenvalues and corresponding eigenvectors of a square matrix. It first finds the characteristic polynomial, solves for its roots (eigenvalues), and then for each eigenvalue, finds the basis for the null space of (A - λI) to determine the eigenvectors.

§Arguments

  • matrix - The square matrix as an Expr::Matrix.

§Returns

A Result containing a tuple (eigenvalues, eigenvectors). eigenvalues is a column vector of eigenvalues. eigenvectors is a matrix where each column is an eigenvector. Returns an error string if the matrix is not square or eigenvalues cannot be found.