1.1.2. chase::Algorithm
-
template<class T>
class Algorithm Implementation of ChASE solver using the abstract of interfaces of numerical components defined in class chase::ChASE.
This class contains the essential methods to solve eigenproblems using the ChASE algorithm, including Lanczos for spectrum bounds estimation, Chebyshev filters, and degree optimization for the filter.
- Template Parameters:
T – The data type used in the solver (e.g.,
float,double).
Public Static Functions
-
static void solve(ChaseBase<T> *single)
Solves eigenproblems using the ChASE solver.
This static method is used to solve eigenvalue problems using the ChASE algorithm, utilizing the provided kernel (which is a
ChaseBase<T>).- Parameters:
single – A pointer to an object that implements the
ChaseBase<T>interface. The object contains the actual computation logic for the solver.
-
static void solve_pseudo(ChaseBase<T> *single)
Pseudo-Hermitian (e.g. BSE) solver path. Same interface as solve() but uses Lanczos for H², calc_degrees_pseudo_H2, filter_H2, and pseudo-Hermitian Rayleigh-Ritz. Implementation to be filled step by step.
-
static std::size_t calc_degrees(ChaseBase<T> *kernel, std::size_t N, std::size_t unconverged, std::size_t nex, Base<T> upperb, Base<T> lowerb, Base<T> tol, Base<T> *ritzv, Base<T> *resid, Base<T> *residLast, std::size_t *degrees, std::size_t locked)
Optimizes the degree of the Chebyshev polynomial based on the convergence of Ritz pairs.
This method optimizes the degree of the Chebyshev polynomial filter, adjusting it dynamically based on the convergence behavior of the Ritz pairs.
- Parameters:
kernel – A pointer to the
ChaseBase<T>instance, which provides the necessary numerical operations.N – The total size of the problem.
unconverged – The number of unconverged eigenpairs.
nex – The number of external searching space.
upperb – The upper bound for the spectrum.
lowerb – The lower bound for the spectrum.
tol – The tolerance for the degree calculation.
ritzv – The array storing the Ritz values.
resid – The array storing the residuals of the Ritz values.
residLast – The array storing the residuals from the previous iteration.
degrees – The array storing the degrees for each Ritz pair.
locked – The number of locked eigenpairs.
- Returns:
The optimized polynomial degree.
-
static std::size_t calc_degrees_pseudo(ChaseBase<T> *kernel, std::size_t N, std::size_t unconverged, std::size_t nex, Base<T> upperb, Base<T> lowerb, Base<T> tol, Base<T> *ritzv, Base<T> *resid, Base<T> *residLast, std::size_t *degrees, std::size_t locked)
Specialized degree optimization for pseudo-hermitian matrices with cluster-aware features.
This method provides enhanced degree optimization specifically designed for pseudo-hermitian eigenvalue problems, including cluster detection and adaptive degree spacing.
- Parameters:
kernel – A pointer to the
ChaseBase<T>instance, which provides the necessary numerical operations.N – The total size of the problem.
unconverged – The number of unconverged eigenpairs.
nex – The number of external searching space.
upperb – The upper bound for the spectrum.
lowerb – The lower bound for the spectrum.
tol – The tolerance for the degree calculation.
ritzv – The array storing the Ritz values.
resid – The array storing the residuals of the Ritz values.
residLast – The array storing the residuals from the previous iteration.
degrees – The array storing the degrees for each Ritz pair.
locked – The number of locked eigenpairs.
- Returns:
The optimized polynomial degree.
-
static std::size_t calc_degrees_pseudo_H2(ChaseBase<T> *kernel, std::size_t N, std::size_t unconverged, std::size_t nex, Base<T> upperb, Base<T> lowerb, Base<T> tol, Base<T> *ritzv, Base<T> *resid, Base<T> *residLast, std::size_t *degrees, std::size_t locked)
Degree optimization for Chebyshev filtering on H² (pseudo-Hermitian H). Uses λ² for ellipse, pair-symmetric degrees, and negative/positive ordering (asc/desc by degree). We assume symmetric locking: locked_left = locked_right = locked (pass the same value for both).
- Parameters:
locked_left – Number of locked eigenpairs on the left (negative λ).
locked_right – Number of locked eigenpairs on the right (positive λ).
-
static void detect_eigenvalue_clusters(Base<T> *ritzv, Base<T> *resid, Base<T> tol, std::size_t unconverged, std::size_t nex, Base<T> upperb, Base<T> lowerb, std::vector<Base<T>> &cluster_factors)
Detects eigenvalue clusters and computes spacing factors for degree optimization.
This helper method analyzes eigenvalue clustering and computes spacing factors to improve degree optimization for clustered eigenvalues.
- Parameters:
ritzv – The array storing the Ritz values.
resid – The array storing the residuals of the Ritz values.
tol – The convergence tolerance.
unconverged – The number of unconverged eigenpairs.
nex – The number of external searching space.
upperb – The upper bound for the spectrum.
lowerb – The lower bound for the spectrum.
cluster_factors – Output array for computed spacing factors.
-
static std::size_t locking(ChaseBase<T> *kernel, std::size_t N, std::size_t unconverged, Base<T> tol, Base<T> *ritzv, Base<T> *resid, Base<T> *residLast, std::vector<Base<T>> *early_locked_residuals, std::size_t *degrees, std::size_t locked)
Sorts the Ritz values based on residuals and locks the converged ones.
This method sorts the Ritz values according to their residuals and locks the converged eigenpairs to prevent further processing.
- Parameters:
kernel – A pointer to the
ChaseBase<T>instance.N – The total size of the problem.
unconverged – The number of unconverged eigenpairs.
tol – The convergence tolerance for residuals.
ritzv – The array storing the Ritz values.
resid – The array storing the residuals of the Ritz values.
residLast – The array storing the residuals from the previous iteration.
early_locked_residuals – The array storing the early locked residuals.
degrees – The array storing the degrees of the Ritz pairs.
locked – The number of already locked eigenpairs.
- Returns:
The number of locked eigenpairs.
-
static std::size_t reinit_phantom_eigenvectors_pseudo(ChaseBase<T> *single, std::size_t unconverged, std::size_t locked, std::size_t nex, Base<T> *ritzv)
Specialized locking for pseudo-hermitian matrices.
This method is used to lock the converged eigenpairs for pseudo-hermitian matrices.
- Parameters:
single – A pointer to the
ChaseBase<T>instance.N – The total size of the problem.
unconverged – The number of unconverged eigenpairs.
nex – The number of external searching space.
tol – The convergence tolerance for residuals.
index – The array storing the indices of the unconverged eigenpairs.
Lritzv – The array storing the Ritz values.
resid – The array storing the residuals of the Ritz values.
residLast – The array storing the residuals from the previous iteration.
early_locked_residuals – The array storing the early locked residuals.
degrees – The array storing the degrees of the Ritz pairs.
locked – The number of already locked eigenpairs.
iteration – The iteration number.
- Returns:
The number of locked eigenpairs. Reinit outlier ± boundary pairs (|λ| ratio > threshold). Returns number reinitialized (n_skip_tail for locking_pseudo).
-
static std::size_t locking_pseudo(ChaseBase<T> *single, std::size_t N, std::size_t unconverged, std::size_t nex, Base<T> tol, std::size_t *index, Base<T> *Lritzv, Base<T> *resid, Base<T> *residLast, std::vector<Base<T>> *early_locked_residuals, std::size_t *degrees, std::size_t locked, std::size_t iteration, std::size_t nev = 0, std::size_t n_found_neg = 0, std::size_t n_found_pos = 0, std::size_t n_skip_tail = 0)
-
static std::size_t locking_pseudo_v2(ChaseBase<T> *single, std::size_t N, std::size_t unconverged, std::size_t nex, Base<T> tol, std::size_t *index, Base<T> *Lritzv, Base<T> *resid, Base<T> *residLast, std::vector<Base<T>> *early_locked_residuals, std::size_t *degrees, std::size_t locked, std::size_t iteration, std::size_t nev = 0, std::size_t n_found_neg = 0, std::size_t n_found_pos = 0, std::size_t n_skip_tail = 0)
-
static std::size_t locking_pseudo_v3(ChaseBase<T> *single, std::size_t N, std::size_t unconverged, std::size_t nex, Base<T> tol, std::size_t *index, Base<T> *Lritzv, Base<T> *resid, Base<T> *residLast, std::vector<Base<T>> *early_locked_residuals, std::size_t *degrees, std::size_t locked, std::size_t iteration, std::size_t nev = 0)
-
static std::size_t filter(ChaseBase<T> *kernel, std::size_t n, std::size_t unprocessed, std::size_t deg, std::size_t *degrees, Base<T> lambda_1, Base<T> lower, Base<T> upper)
Implements the Chebyshev filter.
This method applies the Chebyshev filter for eigenvalue problems, typically used in conjunction with the other methods for solving large eigenvalue problems efficiently.
- Parameters:
kernel – A pointer to the
ChaseBase<T>instance.n – The number of vectors.
unprocessed – The number of unprocessed vectors.
deg – The degree of the Chebyshev filter.
degrees – An array containing the degrees of each Ritz pair.
lambda_1 – The lower bound for the Chebyshev filter.
lower – The lower bound of the spectrum.
upper – The upper bound of the spectrum.
- Returns:
The number of processed vectors after applying the filter.
-
static std::size_t filter_H2(ChaseBase<T> *kernel, std::size_t n, std::size_t nevex, std::size_t *degrees, Base<T> lambda_1, Base<T> lower, Base<T> upper)
Chebyshev filter on H² (pseudo-Hermitian H). Matches Julia ChebyshevFilterA2!: symmetric retirement (s, r = nevex-s+1), no shift of H, two matvecs per step via HEMM_H2.
-
static std::size_t lanczos(ChaseBase<T> *kernel, int N, int numvec, int m, int nevex, Base<T> *upperb, bool mode, Base<T> *ritzv_)
Implements the Lanczos method to estimate bounds in ChASE.
This method uses the Lanczos algorithm to estimate the required spectrum bounds for ChASE.
- Parameters:
kernel – A pointer to the
ChaseBase<T>instance.N – The total size of the problem.
numvec – The number of vectors.
m – The number of Lanczos iterations.
nevex – The number of eigenpairs to be computed.
upperb – The array storing the upper bounds of the spectrum.
mode – A boolean indicating whether to run Lanczos in a specific mode.
ritzv_ – The array storing the Ritz values.
- Returns:
The number of bounds estimated by Lanczos.
-
static std::size_t lanczos_for_H2(ChaseBase<T> *kernel, int N, int numvec, int m, int nevex, Base<T> *upperb, bool mode, Base<T> *ritzv_)
Lanczos for H² bounds (same logic as lanczos, values returned as power 2).
Uses the same procedure as lanczos() but returns bounds for the spectrum of H²: upperb and the entries of ritzv_ are squared so that upperb ≈ (max |λ(H)|)², ritzv_[0..nevex-2] carry λ² (e.g. μ_1 = (min |λ|)² in the first positions), and ritzv_[nevex-1] ≈ μ_nevnex (threshold²).