Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add eigen solver for complex Hermitian matrices #175

Merged
merged 34 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
394b6dc
test code for Arnoldi factorization
yixuan Dec 29, 2024
36dbb8d
make ArnoldiOp work for complex values
yixuan Dec 29, 2024
c12b6ab
matrix-vector product with complex values
yixuan Dec 29, 2024
29ee8da
support random complex numbers
yixuan Dec 29, 2024
77fdcc9
let Arnoldi factorization support complex matrices
yixuan Dec 29, 2024
45ed53a
testing code for complex Arnoldi factorization
yixuan Dec 29, 2024
76e94b5
Lanczos factorization for Hermitian complex matrices
yixuan Dec 30, 2024
0b7f098
make compress_V() applicable to both real and complex types
yixuan Dec 30, 2024
4621ef0
add a complex version of matrix_QtHQ()
yixuan Dec 30, 2024
ecf0fa5
not used
yixuan Dec 30, 2024
ec52762
add an Hermitian version
yixuan Dec 30, 2024
0222e97
minor tweaks
yixuan Dec 30, 2024
61f14a7
adapt to the Hermitian eigen solver base class
yixuan Dec 30, 2024
4d74347
documentation improvement
yixuan Dec 30, 2024
45179cc
let symmetric eigen solvers depend on HermEigsBase
yixuan Dec 30, 2024
c18ba70
not used for now
yixuan Dec 30, 2024
982e236
add Hermitian eigen solver
yixuan Dec 30, 2024
ff5069d
test code for Hermitian eigen solver
yixuan Dec 30, 2024
ea76fa6
make BKDLDT applicable to Hermitian matrices
yixuan Dec 31, 2024
f2531f1
avoid explicit inversion to increase numerical stability
yixuan Jan 1, 2025
e4af4b6
fix numerical issues by forcing diagonal elements to be real-valued
yixuan Jan 1, 2025
149bfde
testing code for Hermitian BKLDLT
yixuan Jan 1, 2025
cefc1c2
update copyright year
yixuan Jan 1, 2025
456d3a7
changelog for new version
yixuan Jan 1, 2025
8c61c4f
Merge branch 'master' into hermitian
yixuan Jan 1, 2025
ffb1737
update Doxygen configuration to v1.13.0
yixuan Jan 1, 2025
024fa87
add testing examples
yixuan Jan 1, 2025
1e22687
clang-format
yixuan Jan 1, 2025
8115b37
update Github Action versions
yixuan Jan 1, 2025
ed4e773
turn off clang-format for specific cases
yixuan Jan 1, 2025
e4abc07
remove unnecessary semicolon
yixuan Jan 1, 2025
70ab896
use older version of Ubuntu for code coverage
yixuan Jan 1, 2025
9ce176f
test Ubuntu 22.04
yixuan Jan 1, 2025
7e0b41b
add link to HermEigsSolver
yixuan Jan 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-20.04, ubuntu-22.04 ]
os: [ ubuntu-22.04, ubuntu-latest ]
compiler: [ gcc, clang ]
BUILD_TYPE: [ Debug, Release ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: dependencies
run: sudo apt install libeigen3-dev
- name: configure
Expand All @@ -27,3 +27,4 @@ jobs:
run: cmake --build build -- -j4
- name: test
run: cd build && ctest

3 changes: 2 additions & 1 deletion .github/workflows/checkformat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ jobs:
matrix:
compiler: [gcc]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: dependencies
run: sudo apt install libeigen3-dev clang-format
- name: cmake
run: cmake -B builddir
- name: Format
run: cmake --build builddir --target format && git diff --exit-code

7 changes: 4 additions & 3 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ on:
jobs:
build:

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
compiler: [ gcc ]
BUILD_TYPE : [ Debug ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: dependencies
run: sudo apt install libeigen3-dev lcov
- name: configure
Expand All @@ -28,4 +28,5 @@ jobs:
- name: Generate coverage data
run: lcov --directory . --capture --output-file coverage.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5

51 changes: 35 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
## [Unreleased]
## [1.1.0] - 2025-01-01

### Added

- Added the eigen solver `HermEigsSolver` for complex-valued Hermitian matrices
- Added the support for complex Hermitian matrices to various linear algebra classes, such as `Arnoldi`, `Lanczos`, and `BKLDLT`
- `SimpleRandom` can now generate random complex values
- Added testing code for Arnoldi factorization on both real matrices and complex Hermitian matrices
- Added `BKLDLT` tests for complex Hermitian matrices
- Added testing code for the `HermEigsSolver` solver
- Added test examples from previous bug reports

### Changed

- Better heuristics for basis restarting in the Lanczos factorization,
which fixes [#159](https://github.com/yixuan/spectra/issues/159)
- Fixed the support for non-literal data types
Expand All @@ -19,33 +27,22 @@
[@alecjacobson](https://github.com/alecjacobson), and
[@jdumas](https://github.com/jdumas)
- Miscellaneous GitHub Actions updates
- Various internal implementation changes to accommodate operations on complex-valued matrices
- Improved the numerical stability of `BKLDLT` linear system solver
- Change `SymEigsBase` to `HermEigsBase` as the base class for both real symmetric and complex Hermitian eigen solvers



## [1.0.1] - 2022-04-06

### Added
- Added SIMD support for `UpperHessenbergSchur`. This should accelerate
general eigen solvers such as `GenEigsSolver`
- Added test code for `UpperHessenbergSchur`

### Changed
- Fixed several bugs in the examples caused by the `const` keyword,
reported by [@alexpghayes](https://github.com/alexpghayes)
([#135](https://github.com/yixuan/spectra/issues/135),
[#137](https://github.com/yixuan/spectra/pull/137))
- Updated the included [Catch2](https://github.com/catchorg/Catch2) to v2.13.8



## [1.0.1] - 2022-04-06

### Added
- Added SIMD support for `UpperHessenbergSchur`. This should accelerate
general eigen solvers such as `GenEigsSolver`
- Added test code for `UpperHessenbergSchur`

### Changed

- Fixed several bugs in the examples caused by the `const` keyword,
reported by [@alexpghayes](https://github.com/alexpghayes)
([#135](https://github.com/yixuan/spectra/issues/135),
Expand All @@ -57,6 +54,7 @@
## [1.0.0] - 2021-07-01

### Added

- Added version macros `SPECTRA_MAJOR_VERSION`, `SPECTRA_MINOR_VERSION`,
`SPECTRA_PATCH_VERSION`, and `SPECTRA_VERSION` that are included by all eigen solvers
- Added the wrapper class `SparseGenComplexShiftSolve` for eigen solver with complex shifts
Expand All @@ -78,6 +76,7 @@
`SparseSymMatProd` to handle matrix-matrix products and coefficient-wise accessors

### Changed

- **API change**: Spectra now requires C++11
- **API change**: All enumerations have been converted to enum classes
(e.g. `LARGEST_MAGN` is now `SortRule::LargestMagn`)
Expand Down Expand Up @@ -116,6 +115,7 @@
## [0.9.0] - 2020-05-19

### Added

- Added support for CMake build, contributed by
[Guillaume Acke](https://github.com/guacke) and [Jens Wehner](https://github.com/JensWehner)
([#70](https://github.com/yixuan/spectra/pull/70), [#88](https://github.com/yixuan/spectra/pull/88))
Expand All @@ -127,6 +127,7 @@
[Jens Wehner](https://github.com/JensWehner)

### Changed

- Fixed a compiler warning caused by unused parameter, contributed by
[Julien Schueller](https://github.com/jschueller) ([#80](https://github.com/yixuan/spectra/pull/80))
- Changed the implementation of `BKLDLT` solver to improve precision in some tests
Expand All @@ -136,6 +137,7 @@
## [0.8.1] - 2019-06-05

### Changed

- Fixed a bug in `BKLDLT` in which a wrong type was used, thanks to
[@jdbancal](https://github.com/jdbancal) for the issue
[#64](https://github.com/yixuan/spectra/pull/64)
Expand All @@ -152,6 +154,7 @@
## [0.8.0] - 2019-04-03

### Added

- Added a `BKLDLT` class that implements the Bunch-Kaufman LDLT decomposition
for symmetric indefinite matrices. According to the Eigen documentation,
currently `Eigen::LDLT` cannot handle some special indefinite matrices such
Expand All @@ -161,6 +164,7 @@
- Added a unit test for `BKLDLT`

### Changed

- `DenseSymShiftSolve` now uses the newly added `BKLDLT` class to do the
decomposition. This change broadens the class of matrices that
`DenseSymShiftSolve` can handle, reduces memory use, and should also improve
Expand All @@ -181,6 +185,7 @@
## [0.7.0] - 2019-01-10

### Added

- Added a directory `contrib` to include code contributed by users. It is not
formally a part of the Spectra library, but it may contain useful solvers
and applications based on Spectra. Code in `contrib` may not be fully tested,
Expand All @@ -194,6 +199,7 @@
- Added a few other internal classes to refactor the eigen solver classes (see below)

### Changed

- **API change**: Spectra now requires Eigen >= 3.3
- **API change**: The library header files are moved into a directory
named `Spectra`. Hence the recommended include directive would look like
Expand All @@ -215,6 +221,7 @@
## [0.6.2] - 2018-05-22

### Changed

- Fixed regressions in v0.6.0 on some edge cases
- Improved the accuracy of restarting processes in `SymEigsSolver` and `GenEigsSolver`
- Updated the included [Catch2](https://github.com/catchorg/Catch2) to v2.2.2
Expand All @@ -225,6 +232,7 @@
## [0.6.1] - 2018-03-03

### Changed

- Fixed a bug of uninitialized memory
- Updated the included [Catch2](https://github.com/catchorg/Catch2) to v2.1.2

Expand All @@ -233,6 +241,7 @@
## [0.6.0] - 2018-03-03

### Added

- Added virtual destructors to the `SymEigsSolver` and `UpperHessenbergQR` classes
to fix compiler warnings, by [Julian Kent](https://github.com/jkflying)
- Added a `NUMERICAL_ISSUE` entry to the `COMPUTATION_INFO` enumeration to indicate
Expand All @@ -245,6 +254,7 @@
types

### Changed

- Documentation updates
- Updated the project URL to [https://spectralib.org](https://spectralib.org)
- Some internal improvements, such as pre-allocating vectors in loops, and changing
Expand All @@ -261,12 +271,14 @@
## [0.5.0] - 2017-02-05

### Added

- Added the generalized eigen solver `SymGEigsSolver` in the regular inverse mode
- Added the wrapper class `SparseRegularInverse` that can be used with
`SymGEigsSolver` in the regular inverse mode
- Added test code for generalized eigen solver in the regular inverse mode

### Changed

- Improved the numerical precision and stability of some internal linear
algebra classes, including `TridiagEigen`, `UpperHessenbergEigen`, and
`DoubleShiftQR`
Expand All @@ -283,13 +295,15 @@
## [0.4.0] - 2016-11-14

### Added

- Added an `Uplo` template parameter to the `DenseSymShiftSolve` class
- Added the generalized eigen solver `SymGEigsSolver` in the Cholesky mode
- Added the wrapper classes `DenseCholesky` and `SparseCholesky` that can be
used with `SymGEigsSolver` in the Cholesky mode
- Added test code for generalized eigen solver in the Cholesky mode

### Changed

- Updated included [Catch](https://github.com/philsquared/Catch) to v1.5.7
- Improved documentation
- Updated Travis CI script
Expand All @@ -311,13 +325,15 @@
## [0.3.0] - 2016-07-03

### Added

- Added the wrapper classes `SparseSymMatProd` and `SparseSymShiftSolve`
for sparse symmetric matrices
- Added the wrapper class `SparseGenRealShiftSolve` for general sparse matrices
- Added tests for sparse matrices
- Using Travis CI for automatic unit test

### Changed

- Updated included [Catch](https://github.com/philsquared/Catch) to v1.5.6
- **API change**: Each eigen solver was moved to its own header file.
For example to use `SymEigsShiftSolver` one needs to include
Expand All @@ -329,13 +345,15 @@
## [0.2.0] - 2016-02-28

### Added

- Benchmark script now outputs number of matrix operations
- Added this change log
- Added a simple built-in random number generator, so that the algorithm
was made to be deterministic
- Added the wrapper class `DenseSymMatProd` for symmetric matrices

### Changed

- Improved Arnoldi factorization
- Iteratively corrects orthogonality
- Creates new residual vector when invariant subspace is found
Expand All @@ -352,4 +370,5 @@
## [0.1.0] - 2015-12-19

### Added

- Initial release of Spectra
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
project (Spectra VERSION 1.0.1 LANGUAGES CXX)
project (Spectra VERSION 1.1.0 LANGUAGES CXX)

# Make CMake look into the ./cmake/ folder for configuration files
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![Basic CI](https://github.com/yixuan/spectra/workflows/Basic%20CI/badge.svg) [![codecov](https://codecov.io/gh/yixuan/spectra/branch/master/graph/badge.svg)](https://codecov.io/gh/yixuan/spectra)

> **NOTE**: Spectra 1.0.0 is released, with a lot of
> **NOTE**: Spectra 1.0.0 was released in 2021-07-01, with a lot of
> API-breaking changes. Please see the [migration guide](MIGRATION.md)
> for a smooth transition to the new version.

Expand Down Expand Up @@ -86,6 +86,8 @@ For generalized eigen solver with real symmetric matrices
For generalized eigen solver with real symmetric matrices, using the shift-and-invert mode
- [DavidsonSymEigsSolver](https://spectralib.org/doc/classSpectra_1_1DavidsonSymEigsSolver.html):
Jacobi-Davidson eigen solver for real symmetric matrices, with the DPR correction method
- [HermEigsSolver](https://spectralib.org/doc/classSpectra_1_1HermEigsSolver.html):
For complex Hermitian matrices

## Examples

Expand Down
Loading
Loading