Eigensolver is a C++ library that provides an implementation of the Locally Optimal Block Preconditioned Conjugate Gradient (LOBPCG) algorithm for solving large-scale sparse eigenvalue problems. The library is built on top of the Eigen framework, which is a high-level C++ library for linear algebra.
Eigensolver is designed to find a few eigenvalues and eigenvectors of a large sparse matrix, which is a common task in scientific computing and engineering. The LOBPCG method is a powerful numerical algorithm for this purpose, and we implement a version to seek smallest eigenpairs.
- Solves eigenvalue problems for large sparse matrices. Supports both standard and general symmetric eigenvalue problems.
- Utilizes the power of the Eigen library for linear algebra operations.
- Provides a standalone implementation and an easy-to-use API for integrating into existing C++ projects, based on Eigen data structures and input matrices organized as mtx files.
- Use xmake as build tools.
- Eigen: A high-level C++ library for linear algebra.
- fast_matrix_market: A library for reading and writing Matrix Market files. Provides interface for eigen support.
Eigensolver requires a C++ compiler with support for C++11 or higher and the Eigen library.
The Eigen library is included in the source code, and fast_matrix_market is organized as a submodule.
To install and set up Eigensolver, follow these steps:
- Clone the Eigensolver repository:
git clone --recurse-submodules https://github.com/Cstandardlib/eigensolver.git
- Build your projects with xmake.
$ xmake build main
$ xmake run main
The LOBPCG algorithm is an iterative method used to find selected eigenvalues and eigenvectors of a large sparse matrix. It is particularly effective when only a small number of eigenvalues and eigenvectors are required. The algorithm can be summarized in the following steps:
- Start with an initial guess for the eigenvectors.
- Perform a block conjugate gradient iteration to find a more accurate approximation.
- Apply a preconditioner if provided.
- Compute the Rayleigh quotient to estimate the eigenvalues.
- Repeat the process until convergence.
Eigensolver comes with several examples that demonstrate how to use the library to solve different types of eigenvalue problems. You can find these examples in the examples/ directory of the repository.
Contributions to Eigensolver are welcome! If you find a bug, have an idea for a new feature, or want to improve the documentation, please open an issue or submit a pull request.