lanczos

Crates.iolanczos
lib.rslanczos
version0.2.0
sourcesrc
created_at2024-07-31 21:29:31.418833
updated_at2024-08-09 23:30:00.580429
descriptionlanczos algorithm for eigen decomposition
homepage
repositoryhttps://github.com/tomerdmnt/lanczos
max_upload_size
id1321338
size13,489
Tomer Diament (tomerdmnt)

documentation

README

Eigen decomposition of Hermitian matrices using Lanczos algorithm

Overview

Using Lanczos algorithm to estimate the extremal Eigen values and Eigen vectors of an Symmetrics Hermitian matrix.

Supports both dense and sparse matrices via nalgebra_sparse.

Works well for large sparse matrices

cargo add lanczos

Examples

use nalgebra::DMatrix;
use lanczos::{Hermitian, Order};

// ...
let eigen = matrix.eigsh(50, Order::Smallest);

// Sorted by eigenvalue in ascending order
eprintln!("{}", eigen.eigenvalues);
// Columns sorted according to eigenvalues
eprintln!("{}", eigen.eigenvectors);

// Second smallest eigen value
eprintln!("{}", eigen.eigenvalues[1]);
// Eigen vector corresponding to the second smallest eigen value
eprintln!("{}", eigen.eigenvectors.column(1));
Commit count: 0

cargo fmt