Symmetric and Hermitian eigensolvers

Overview

syev and its tiers, selected-range syevx, and the iterative eigensolvers.

Lower-level functions (algorithm-specific variants, workspace queries, validation and helpers): Eigensolvers: lower-level API.

Functions

◆ syevx() [1/4]

template<Backend B, typename T, MatrixFormat MFormat>
Event batchlas::syevx ( Queue & ctx,
const MatrixView< T, MFormat > & A,
Span< typename base_type< T >::type > W,
size_t neigs,
Span< std::byte > workspace,
JobType jobz = JobType::NoEigenVectors,
const MatrixView< T, MatrixFormat::Dense > & V = MatrixView< T, MatrixFormat::Dense >(),
const SyevxParams< T > & params = SyevxParams< T >(),
Span< int32_t > info = Span< int32_t >() )

Selected eigenpairs of a batch of symmetric/Hermitian matrices, dense or CSR.

Computes \( A v = \lambda v \) for the part of the spectrum that params.select names: the neigs largest or smallest eigenpairs (Extremal, with SyevxParams::find_largest) or an index block (Index). A value interval (Value) has a data-dependent count and needs the overload that reports m.

The algorithm comes from syevx_select_algorithm(): Direct (full syev() on a private copy, then selection), DirectSubset (two-stage reduction plus stebz()/stein()), LOBPCG or Filtered (Chebyshev subspace iteration). A is never modified; the direct paths read its lower triangle. Asynchronous: returns once the work is enqueued.

Template Parameters
MFormatMatrixFormat::Dense or MatrixFormat::CSR (CSR always runs LOBPCG or Filtered)
Parameters
ctxqueue the work is enqueued on
Abatch of n x n symmetric/Hermitian matrices, dense or CSR
Weigenvalue output (real type), neigs entries per batch item
neigsCAPACITY of W and of V's columns per item, not the number produced
workspaceat least syevx_buffer_size() bytes
jobzwhether eigenvectors are written to V
Vn x neigs eigenvector output per item; used only for EigenVectors
paramsselection range and algorithm parameters
infoper-item convergence status (0 = converged, > 0 LAPACK-like), or an empty span to not request it; see docs/cpp-api.md
Returns
event of the last enqueued kernel
Exceptions
batchlas::invalid_argumentfor SyevxSelect::Value (use the m-taking overload); an Index block outside [0, n) or with neigs != iu - il + 1; a non-extremal range with CSR input or an explicit LOBPCG/Filtered method; an ILU(k) or Jacobi preconditioner with find_largest, or conflicting preconditioner fields.
See also
SYEVX, syevx range selection: design record

◆ syevx() [2/4]

template<Backend B, typename T, MatrixFormat MFormat>
Event batchlas::syevx ( Queue & ctx,
const Matrix< T, MFormat > & A,
Span< typename base_type< T >::type > W,
size_t neigs,
Span< std::byte > workspace,
JobType jobz = JobType::NoEigenVectors,
const SyevxParams< T > & params = SyevxParams<T>(),
Span< int32_t > info = Span<int32_t>() )
inline

syevx() on an owning A without eigenvectors: no V argument.

Definition at line 248 of file extensions.hh.

◆ syevx() [3/4]

template<Backend B, typename T, MatrixFormat MFormat>
Event batchlas::syevx ( Queue & ctx,
const MatrixView< T, MFormat > & A,
Span< typename base_type< T >::type > W,
Span< int32_t > m,
size_t neigs,
Span< std::byte > workspace,
JobType jobz = JobType::NoEigenVectors,
const MatrixView< T, MatrixFormat::Dense > & V = MatrixView< T, MatrixFormat::Dense >(),
const SyevxParams< T > & params = SyevxParams< T >(),
Span< int32_t > info = Span< int32_t >() )

syevx() with a per-batch-item count of eigenpairs actually found.

Required for SyevxSelect::Value.

Item b gets min(m[b], neigs) eigenpairs (the lowest ones, when truncating), the rest of its W is left untouched, the remaining columns of its V are written as EXACTLY ZERO so the back-transform can run over a uniform column count, and m[b] reports the TRUE count, so m[b] > neigs is the caller's overflow signal. Other parameters as for the m-less form.

Parameters
mPer-item count, at least A.batch_size() entries. Device-writable.
Trap
Unambiguous against the m-less forms only because Span's scalar constructor is explicit; a bare {} in positions 4-6 matches both and is ambiguous.

◆ syevx() [4/4]

template<Backend B, typename T, MatrixFormat MFormat>
Event batchlas::syevx ( Queue & ctx,
const Matrix< T, MFormat > & A,
Span< typename base_type< T >::type > W,
Span< int32_t > m,
size_t neigs,
Span< std::byte > workspace,
JobType jobz = JobType::NoEigenVectors,
const SyevxParams< T > & params = SyevxParams<T>(),
Span< int32_t > info = Span<int32_t>() )
inline

The m-reporting syevx() on an owning A without eigenvectors.

Definition at line 289 of file extensions.hh.

◆ lanczos() [1/2]

template<Backend B, typename T, MatrixFormat MFormat>
Event batchlas::lanczos ( Queue & ctx,
const MatrixView< T, MFormat > & A,
Span< typename base_type< T >::type > W,
Span< std::byte > workspace,
JobType jobz = JobType::NoEigenVectors,
const MatrixView< T, MatrixFormat::Dense > & V = MatrixView< T, MatrixFormat::Dense >(),
const LanczosParams< T > & params = LanczosParams< T >() )

All eigenvalues, and optionally eigenvectors, of a batch of symmetric/Hermitian matrices by a full-length Lanczos tridiagonalisation.

Builds an n-step Krylov basis with reorthogonalisation, then solves the resulting tridiagonal problem. Intended for sparse (CSR) input; dense works too.

Parameters
ctxqueue the work is enqueued on
Abatch of n x n symmetric/Hermitian matrices (CSR or dense); read only
Weigenvalue output (real type), n entries per batch item
workspaceat least lanczos_buffer_size() bytes
jobzwhether eigenvectors are written to V
Vn x n eigenvector output per item; used only for EigenVectors
paramsorthogonalisation and sorting options
Returns
event of the last enqueued kernel

◆ lanczos() [2/2]

template<Backend B, typename T, MatrixFormat MFormat>
Event batchlas::lanczos ( Queue & ctx,
const Matrix< T, MFormat > & A,
Span< typename base_type< T >::type > W,
Span< std::byte > workspace,
JobType jobz = JobType::NoEigenVectors,
const LanczosParams< T > & params = LanczosParams<T>() )
inline

lanczos() on an owning A without eigenvectors: no V argument.

Definition at line 649 of file extensions.hh.

◆ ritz_values() [1/2]

template<Backend B, typename T, MatrixFormat MFormat>
Event batchlas::ritz_values ( Queue & ctx,
const MatrixView< T, MFormat > & A,
const MatrixView< T, MatrixFormat::Dense > & V,
const VectorView< typename base_type< T >::type > & ritz_vals,
Span< std::byte > workspace )

Computes the Ritz values (Rayleigh quotients) of a set of trial vectors.

\( \theta_j = \dfrac{v_j^H A v_j}{v_j^H v_j} \) for each column \( v_j \) of V, per batch item.

Parameters
ctxExecution context/device queue
AMatrix (can be sparse or dense)
VTrial vectors (dense matrix, columns are trial eigenvectors)
ritz_valsOutput vector for Ritz values, V.cols() real entries per item
workspacePre-allocated workspace buffer, at least ritz_values_buffer_size() bytes
Returns
Event Event to track operation completion
See also
Ritz values (Rayleigh quotients)

◆ ritz_values() [2/2]

template<Backend B, typename T, MatrixFormat MFormat>
auto batchlas::ritz_values ( Queue & ctx,
const MatrixView< T, MFormat > & A,
const MatrixView< T, MatrixFormat::Dense > & V )
inline

ritz_values() returning a new Vector of V.cols() Ritz values per item.

Allocates its own workspace and waits on ctx before returning, so the result is ready to read.

See also
Ritz values (Rayleigh quotients)

Definition at line 1926 of file extensions.hh.

◆ syev() [1/2]

template<Backend B, typename T>
Event batchlas::syev ( Queue & ctx,
const MatrixView< T, MatrixFormat::Dense > & descrA,
Span< typename base_type< T >::type > eigenvalues,
JobType jobtype,
Uplo uplo,
Span< std::byte > workspace,
Span< int32_t > info )

Eigenvalues, and optionally eigenvectors, of a batch of symmetric/Hermitian matrices (LAPACK ?syev / ?heev).

Computes \( A = Q \Lambda Q^H \) for every batch item from its uplo triangle. The kernel family is the first entry of the nearest row of the device's tuned table (tuned/syev.<device>.txt) that can run the call: on a GPU queue a native tier (the n <= 32 sub-group solvers cta, cta_fused and jacobi, which need sub-group size 32; blocked or two_stage at any n), otherwise vendor, the solver library. Pin a family with BATCHLAS_SYEV_ROUTE (e.g. two_stage, vendor). Asynchronous: returns once the work is enqueued.

Template Parameters
Bbackend (NETLIB always runs the vendor LAPACKE path)
Tfloat, double, std::complex<float> or std::complex<double>
Parameters
ctxqueue the work is enqueued on
descrAbatch of n x n matrices; with JobType::EigenVectors overwritten by the orthonormal eigenvectors (column j pairs with eigenvalue j), otherwise its contents are destroyed
eigenvaluesn real eigenvalues per batch item, packed, ascending
jobtypeEigenVectors or NoEigenVectors
uplowhich triangle of descrA holds the matrix
workspaceat least syev_buffer_size() bytes for the same arguments
infoper-item convergence status: 0 converged, > 0 LAPACK-like (the number of off-diagonals that failed to converge, or 1 where the tier only tracks failure). An EMPTY span means "not requested" and costs nothing; syev_buffer_size() is the same either way.
Returns
event of the last enqueued kernel
Exceptions
batchlas::invalid_argumentif descrA is not square
batchlas::workspace_errorif the workspace span is smaller than the chosen kernel needs
batchlas::NoRouteErrorwhen no native kernel can run (e.g. a CPU queue) in a build without the solver library
std::invalid_argumentif BATCHLAS_SYEV_ROUTE names a family that is not compiled or cannot run this call (the words native and vendor instead fall back to the tuned choice with a warning)
See also
Kernel selection tables (which family ranks first where), SYEV, docs/cpp-api.md (convergence status)

◆ syev() [2/2]

template<Backend B, typename T>
Event batchlas::syev ( Queue & ctx,
const MatrixView< T, MatrixFormat::Dense > & descrA,
Span< typename base_type< T >::type > eigenvalues,
JobType jobtype,
Uplo uplo,
Span< std::byte > workspace )
inline

syev() without the convergence status (info empty).

Definition at line 98 of file syev.hh.

Topics

 Eigensolvers: lower-level API
 Algorithm-specific entry points (CTA, blocked, two-stage, Jacobi, direct, LOBPCG, filtered), algorithm and range selection, and workspace queries behind syev, syevx, lanczos and ritz_values.

Classes

struct  batchlas::SyevxParams< T >
 Options for syevx(): algorithm family, convergence controls, preconditioning and which part of the spectrum to compute. More...
struct  batchlas::SyevxInstrumentation< T >
 Optional per-iteration convergence histories recorded by the iterative syevx paths. More...
struct  batchlas::LanczosParams< T >
 Parameters for lanczos(). More...
struct  batchlas::SyevxResolvedRange
 Resolved, algorithm-independent description of the caller's request. More...
struct  batchlas::JacobiParams< T >
 Parameters for syev_jacobi_cta() (cyclic two-sided Jacobi). More...