Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
lformaggia committed Jan 8, 2024
2 parents d219986 + 3af5641 commit ca63277
Show file tree
Hide file tree
Showing 55 changed files with 439 additions and 96 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/Basic.yml → .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-18.04, ubuntu-20.04]
compiler: [gcc, clang]
BUILD_TYPE : [Debug, Release]
os: [ ubuntu-20.04, ubuntu-22.04 ]
compiler: [ gcc, clang ]
BUILD_TYPE: [ Debug, Release ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: dependencies
run: sudo apt install libeigen3-dev
- name: configure
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/checkformat.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: check format
name: Check format
on:
push:
branches: [ master ]
Expand All @@ -13,9 +13,9 @@ jobs:
matrix:
compiler: [gcc]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: dependencies
run: sudo apt install libeigen3-dev clang-format-9
run: sudo apt install libeigen3-dev clang-format
- name: cmake
run: cmake -B builddir
- name: Format
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
compiler: [gcc]
BUILD_TYPE : [Debug]
compiler: [ gcc ]
BUILD_TYPE : [ Debug ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: dependencies
run: sudo apt install libeigen3-dev
run: sudo apt install libeigen3-dev lcov
- name: configure
env:
CC: ${{ matrix.compiler }}
Expand All @@ -25,5 +25,7 @@ jobs:
run: cmake --build build -- -j4
- name: test
run: cd build && ctest
- name: Generate coverage data
run: lcov --directory . --capture --output-file coverage.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ build/*
issues/*
legacy/*
include/Eigen/*

include/unsupported/Eigen/*
62 changes: 62 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
## [Unreleased]

### Changed
- Fixed the support for non-literal data types
([#150](https://github.com/yixuan/spectra/issues/150))
- Various CMake configuration improvements
([#127](https://github.com/yixuan/spectra/pull/127),
[#140](https://github.com/yixuan/spectra/pull/140),
[#152](https://github.com/yixuan/spectra/pull/152)),
thanks to [@LTLA](https://github.com/LTLA),
[@JensWehner](https://github.com/jschueller),
[@shivupa](https://github.com/shivupa),
[@jschueller](https://github.com/jschueller),
[@alecjacobson](https://github.com/alecjacobson), and
[@jdumas](https://github.com/jdumas)
- Miscellaneous GitHub Actions updates



## [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`
Expand All @@ -12,7 +48,9 @@
- Updated the included [Catch2](https://github.com/catchorg/Catch2) to v2.13.8



## [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
Expand Down Expand Up @@ -69,7 +107,9 @@
- Updated the included [Catch2](https://github.com/catchorg/Catch2) to v2.13.6



## [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)
Expand All @@ -87,7 +127,9 @@
- Changed the implementation of `BKLDLT` solver to improve precision in some tests



## [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
Expand All @@ -101,7 +143,9 @@
[#19](https://github.com/yixuan/spectra/issues/19)



## [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,
Expand All @@ -128,7 +172,9 @@
- Updated the included [Catch2](https://github.com/catchorg/Catch2) to v2.7.0



## [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
Expand Down Expand Up @@ -160,21 +206,27 @@
- Updated the included [Catch2](https://github.com/catchorg/Catch2) to v2.4.2



## [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
- Code and documentation cleanup



## [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



## [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)
Expand All @@ -200,7 +252,9 @@
- Updated Travis CI script



## [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
Expand All @@ -220,7 +274,9 @@
- Documentation improvement



## [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
Expand All @@ -246,7 +302,9 @@
detected by [@jdbancal](https://github.com/jdbancal)



## [0.3.0] - 2016-07-03

### Added
- Added the wrapper classes `SparseSymMatProd` and `SparseSymShiftSolve`
for sparse symmetric matrices
Expand All @@ -262,7 +320,9 @@
- Header files for internal use were relocated



## [0.2.0] - 2016-02-28

### Added
- Benchmark script now outputs number of matrix operations
- Added this change log
Expand All @@ -283,6 +343,8 @@
`DenseGenMatProd` to `DenseSymMatProd`



## [0.1.0] - 2015-12-19

### Added
- Initial release of Spectra
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ include(FeatureSummary) # More verbose Output for libraries using set_package_pr

# Look for supporting libraries
# -----------------------------
find_package(Eigen3 NO_MODULE REQUIRED)
set_package_properties(Eigen3 PROPERTIES TYPE REQUIRED PURPOSE "C++ vector data structures")
message(STATUS "Found Eigen3 Version: ${Eigen3_VERSION} Path: ${Eigen3_DIR}")
if (NOT TARGET Eigen3::Eigen)
find_package(Eigen3 NO_MODULE REQUIRED)
set_package_properties(Eigen3 PROPERTIES TYPE REQUIRED PURPOSE "C++ vector data structures")
message(STATUS "Found Eigen3 Version: ${Eigen3_VERSION} Path: ${Eigen3_DIR}")
endif()

# Setup library
# -------------
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# <a href="https://spectralib.org"><img src="https://spectralib.org/img/logo.png" width="200px" /></a>

[![Build Status](https://travis-ci.org/yixuan/spectra.svg?branch=master)](https://travis-ci.org/yixuan/spectra) ![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)
![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
> API-breaking changes. Please see the [migration guide](MIGRATION.md)
Expand Down
6 changes: 3 additions & 3 deletions include/Spectra/GenEigsBase.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2018-2022 Yixuan Qiu <yixuan.qiu@cos.name>
// Copyright (C) 2018-2023 Yixuan Qiu <yixuan.qiu@cos.name>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
Expand Down Expand Up @@ -143,7 +143,7 @@ class GenEigsBase
using std::pow;

// The machine precision, ~= 1e-16 for the "double" type
constexpr Scalar eps = TypeTraits<Scalar>::epsilon();
const Scalar eps = TypeTraits<Scalar>::epsilon();
// std::pow() is not constexpr, so we do not declare eps23 to be constexpr
// But most compilers should be able to compute eps23 at compile time
const Scalar eps23 = pow(eps, Scalar(2) / 3);
Expand All @@ -164,7 +164,7 @@ class GenEigsBase

// A very small value, but 1.0 / near_0 does not overflow
// ~= 1e-307 for the "double" type
constexpr Scalar near_0 = TypeTraits<Scalar>::min() * Scalar(10);
const Scalar near_0 = TypeTraits<Scalar>::min() * Scalar(10);

Index nev_new = m_nev;
for (Index i = m_nev; i < m_ncv; i++)
Expand Down
4 changes: 2 additions & 2 deletions include/Spectra/GenEigsComplexShiftSolver.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2016-2022 Yixuan Qiu <yixuan.qiu@cos.name>
// Copyright (C) 2016-2023 Yixuan Qiu <yixuan.qiu@cos.name>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
Expand Down Expand Up @@ -83,7 +83,7 @@ class GenEigsComplexShiftSolver : public GenEigsBase<OpType, IdentityBOp>

// Calculate inv(A - r * I) * vj
Vector v_real(m_n), v_imag(m_n), OPv_real(m_n), OPv_imag(m_n);
constexpr Scalar eps = TypeTraits<Scalar>::epsilon();
const Scalar eps = TypeTraits<Scalar>::epsilon();
for (Index i = 0; i < m_nev; i++)
{
v_real.noalias() = m_fac.matrix_V() * m_ritz_vec.col(i).real();
Expand Down
2 changes: 1 addition & 1 deletion include/Spectra/GenEigsRealShiftSolver.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2016-2022 Yixuan Qiu <yixuan.qiu@cos.name>
// Copyright (C) 2016-2023 Yixuan Qiu <yixuan.qiu@cos.name>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
Expand Down
2 changes: 1 addition & 1 deletion include/Spectra/GenEigsSolver.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2016-2022 Yixuan Qiu <yixuan.qiu@cos.name>
// Copyright (C) 2016-2023 Yixuan Qiu <yixuan.qiu@cos.name>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
Expand Down
16 changes: 10 additions & 6 deletions include/Spectra/LinAlg/Arnoldi.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2018-2022 Yixuan Qiu <yixuan.qiu@cos.name>
// Copyright (C) 2018-2023 Yixuan Qiu <yixuan.qiu@cos.name>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
Expand Down Expand Up @@ -42,9 +42,9 @@ class Arnoldi
protected:
// A very small value, but 1.0 / m_near_0 does not overflow
// ~= 1e-307 for the "double" type
static constexpr Scalar m_near_0 = TypeTraits<Scalar>::min() * Scalar(10);
const Scalar m_near_0 = TypeTraits<Scalar>::min() * Scalar(10);
// The machine precision, ~= 1e-16 for the "double" type
static constexpr Scalar m_eps = TypeTraits<Scalar>::epsilon();
const Scalar m_eps = TypeTraits<Scalar>::epsilon();

ArnoldiOpType m_op; // Operators for the Arnoldi factorization
const Index m_n; // dimension of A
Expand Down Expand Up @@ -130,6 +130,8 @@ class Arnoldi
// Initialize with an operator and an initial vector
void init(MapConstVec& v0, Index& op_counter)
{
using std::abs;

m_fac_V.resize(m_n, m_m);
m_fac_H.resize(m_m, m_m);
m_fac_f.resize(m_n);
Expand Down Expand Up @@ -158,9 +160,11 @@ class Arnoldi
m_fac_H(0, 0) = m_op.inner_product(v, w);
m_fac_f.noalias() = w - v * m_fac_H(0, 0);

// In some cases f is zero in exact arithmetics, but due to rounding errors
// it may contain tiny fluctuations. When this happens, we force f to be zero
if (m_fac_f.cwiseAbs().maxCoeff() < m_eps)
// In some cases, H[1,1] is already an eigenvalue of A,
// so f would be zero in exact arithmetics. But due to rounding errors,
// it may contain tiny fluctuations. When this happens, we force f to be zero,
// so that it can be restarted in the subsequent Arnoldi factorization
if (m_fac_f.cwiseAbs().maxCoeff() < m_eps * abs(m_fac_H(0, 0)))
{
m_fac_f.setZero();
m_beta = Scalar(0);
Expand Down
2 changes: 1 addition & 1 deletion include/Spectra/LinAlg/BKLDLT.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2019-2022 Yixuan Qiu <yixuan.qiu@cos.name>
// Copyright (C) 2019-2023 Yixuan Qiu <yixuan.qiu@cos.name>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
Expand Down
Loading

0 comments on commit ca63277

Please sign in to comment.