Eigensolvers: lower-level API

Overview

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.

Functions

◆ syevx_buffer_size() [1/4]

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

Required workspace, in bytes, for syevx(); arguments as for the call minus the workspace.

Unlike the solve, this accepts SyevxSelect::Value: sizing writes no counts.

◆ syevx_buffer_size() [2/4]

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

syevx_buffer_size() on an owning A without eigenvectors.

Definition at line 318 of file extensions.hh.

◆ syevx_buffer_size() [3/4]

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

syevx_buffer_size() with the solve's m argument, which is ACCEPTED AND IGNORED, so a value-range caller writes sizing and solve with one argument list.

Definition at line 333 of file extensions.hh.

◆ syevx_buffer_size() [4/4]

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

The m-taking syevx_buffer_size() on an owning A; m is ignored.

Definition at line 347 of file extensions.hh.

◆ syevx_resolve_range() [1/2]

SyevxResolvedRange batchlas::syevx_resolve_range ( int64_t n,
size_t neigs,
SyevxSelect select,
bool find_largest,
int64_t il,
int64_t iu,
SortOrder order )

Normalizes a range request into a SyevxResolvedRange.

Legality is NOT checked here; it clamps rather than throws so it stays usable when sizing.

Parameters
nMatrix dimension
neigsCapacity of W and V per batch item (see syevx)
selectSyevxParams::select
find_largestSyevxParams::find_largest (Extremal only)
il,iuSyevxParams::il / iu (Index only; iu < 0 means n-1)
orderSyevxParams::order (Index and Value only)
Returns
the normalised request

◆ syevx_resolve_range() [2/2]

template<typename T>
SyevxResolvedRange batchlas::syevx_resolve_range ( int64_t n,
size_t neigs,
const SyevxParams< T > & params )
inline

syevx_resolve_range() reading the range fields from params; distinguished from the 7-argument form by arity.

Definition at line 400 of file extensions.hh.

◆ syevx_select_algorithm()

SyevxAlgorithm batchlas::syevx_select_algorithm ( MatrixFormat format,
int64_t n,
size_t neigs,
SyevxAlgorithm requested,
bool subset_supported,
JobType jobz = JobType::EigenVectors,
int64_t batch_size = 1,
SyevxSelect select = SyevxSelect::Extremal )

Resolves SyevxParams::method (and the BATCHLAS_SYEVX_ALGORITHM override) to a concrete, implemented algorithm.

Never returns Auto, and is deterministic so that syevx and syevx_buffer_size always agree on the choice.

Parameters
formatMatrix format of A (sparse formats run LOBPCG unless Filtered is requested explicitly)
nMatrix dimension
neigsNumber of requested eigenpairs
requestedAlgorithm requested via SyevxParams::method
subset_supportedWhether DirectSubset is available for this T/format
jobzWhether eigenvectors are wanted; load-bearing for the choice
batch_sizeLoad-bearing: the subset solver starves at small batch
selectExcludes the algorithms that cannot answer the requested range
Returns
the algorithm syevx() will run
Exceptions
batchlas::invalid_argumentfor sparse input, or an explicit LOBPCG/Filtered method, with a non-extremal range. The same request made through BATCHLAS_SYEVX_ALGORITHM degrades to Direct with a one-time warning.
See also
SYEVX for the measured thresholds behind the choice

◆ syevx_direct() [1/2]

template<Backend B, typename T, MatrixFormat MFormat>
Event batchlas::syevx_direct ( 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,
const MatrixView< T, MatrixFormat::Dense > & V,
const SyevxParams< T > & params,
Span< int32_t > info = Span< int32_t >() )

Partial eigensolve by full decomposition followed by selection.

Runs syev on a private copy of A. Dense input only, but every scalar type and every SyevxSelect range: the universal fallback.

Parameters
WEigenvalue output, stride neigs; entries past min(m[b], neigs) untouched
VEigenvector output. Columns past min(m[b], neigs) are written as EXACTLY ZERO – unlike W – so this path and syevx_direct_subset agree.
mPer-item count in the requested range, or an empty span to not report it. m[b] > neigs is the truncation signal; the LOWEST neigs are kept.

Other parameters as for syevx().

◆ syevx_direct() [2/2]

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

syevx_direct without the m output; Extremal and Index only.

Distinguished from the form above by ARITY, so no {} trap can fire.

Definition at line 469 of file extensions.hh.

◆ syevx_direct_buffer_size()

template<Backend B, typename T, MatrixFormat MFormat>
size_t batchlas::syevx_direct_buffer_size ( Queue & ctx,
const MatrixView< T, MFormat > & A,
Span< typename base_type< T >::type > W,
size_t neigs,
JobType jobz,
const MatrixView< T, MatrixFormat::Dense > & V,
const SyevxParams< T > & params )

Required workspace, in bytes, for syevx_direct().

Takes no m: sizing writes no counts, and this path's workspace is range-independent.

◆ syevx_direct_subset() [1/2]

template<Backend B, typename T, MatrixFormat MFormat>
Event batchlas::syevx_direct_subset ( 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,
const MatrixView< T, MatrixFormat::Dense > & V,
const SyevxParams< T > & params,
Span< int32_t > info = Span< int32_t >() )

Partial eigensolve by two-stage reduction plus a subset tridiagonal solve (stebz + stein) and a narrowed back-transform.

Real scalars and dense input only; zero capacity is rejected (stein requires k >= 1).

W, V and m follow the same contract as syevx_direct, with stein doing the zeroing. The descending reversal is applied last, in the finalize kernel: stein's cluster detection walks consecutive eigenvalues and requires ascending input. Other parameters as for syevx().

Precondition
in-order Queue; A square
Exceptions
batchlas::unsupportedfor complex or sparse input
batchlas::invalid_argumentfor neigs == 0, an out-of-range index block, vl >= vu, a too-short m, or an out-of-order Queue
See also
syevx_direct_subset_supported()

◆ syevx_direct_subset() [2/2]

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

syevx_direct_subset without the m output; arity-disambiguated as above.

Definition at line 527 of file extensions.hh.

◆ syevx_direct_subset_buffer_size()

template<Backend B, typename T, MatrixFormat MFormat>
size_t batchlas::syevx_direct_subset_buffer_size ( Queue & ctx,
const MatrixView< T, MFormat > & A,
Span< typename base_type< T >::type > W,
size_t neigs,
JobType jobz,
const MatrixView< T, MatrixFormat::Dense > & V,
const SyevxParams< T > & params )

Required workspace, in bytes, for syevx_direct_subset().

Sizing writes no counts, but it is NOT range-independent: a Value range needs room for up to n eigenvalues per item, so the sizes come from syevx_resolve_range().

◆ syevx_direct_subset_supported()

template<typename T, MatrixFormat MFormat>
bool batchlas::syevx_direct_subset_supported ( )
inlineconstexpr

Whether syevx_direct_subset supports this scalar type and format.

Definition at line 558 of file extensions.hh.

◆ syevx_lobpcg()

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

Partial eigensolve by LOBPCG (locally optimal block preconditioned conjugate gradient).

Dense and CSR input; extremal ranges only.

Iterates a block of neigs (+ SyevxParams::extra_directions) vectors until the residuals meet the tolerances or SyevxParams::iterations is reached; optionally preconditioned by ILU(k) for the smallest eigenpairs. Parameters as for syevx().

◆ syevx_lobpcg_buffer_size()

template<Backend B, typename T, MatrixFormat MFormat>
size_t batchlas::syevx_lobpcg_buffer_size ( Queue & ctx,
const MatrixView< T, MFormat > & A,
Span< typename base_type< T >::type > W,
size_t neigs,
JobType jobz,
const MatrixView< T, MatrixFormat::Dense > & V,
const SyevxParams< T > & params )

Required workspace, in bytes, for syevx_lobpcg().

◆ syevx_filtered()

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

Chebyshev-filtered subspace iteration: amplifies the wanted end of the spectrum, then Rayleigh-Ritz.

Needs only matvecs; dense and CSR input, extremal ranges only.

The polynomial degree is SyevxParams::filter_degree (0 picks a default). Parameters as for syevx().

◆ syevx_filtered_buffer_size()

template<Backend B, typename T, MatrixFormat MFormat>
size_t batchlas::syevx_filtered_buffer_size ( Queue & ctx,
const MatrixView< T, MFormat > & A,
Span< typename base_type< T >::type > W,
size_t neigs,
JobType jobz,
const MatrixView< T, MatrixFormat::Dense > & V,
const SyevxParams< T > & params )

Required workspace, in bytes, for syevx_filtered().

◆ lanczos_buffer_size()

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

Required workspace, in bytes, for lanczos(); arguments as for the call itself.

◆ syev_cta()

template<Backend B, typename T>
Event batchlas::syev_cta ( Queue & ctx,
const MatrixView< T, MatrixFormat::Dense > & a_in,
Span< typename base_type< T >::type > eigenvalues,
JobType jobz,
Uplo uplo,
const Span< std::byte > & ws,
SteqrParams< T > steqr_params = SteqrParams< T >(),
size_t cta_wg_size_multiplier = 0,
Span< int32_t > info = Span< int32_t >() )

CTA-optimized symmetric eigen-solver (SYEV-like), n <= 32; real symmetric and complex Hermitian.

Overwrites A with eigenvectors when jobz == EigenVectors. Eigenvalues ascend when SteqrParams::sort is set (default). cta_wg_size_multiplier == 0 lets the tridiagonal solve pick its tuned value and runs the reduction and back-transform at 1.

This and the other syev_* tiers are what syev() routes between; call one directly only to pin a tier. As in syev(), a_in's uplo triangle is read, eigenvalues gets n real values per item, and info is the per-item convergence status or empty.

See also
SYEV (small-n kernel choice)

◆ syev_cta_buffer_size()

template<Backend B, typename T>
size_t batchlas::syev_cta_buffer_size ( Queue & ctx,
const MatrixView< T, MatrixFormat::Dense > & a,
JobType jobz,
SteqrParams< T > steqr_params = SteqrParams< T >() )

Required workspace, in bytes, for syev_cta().

◆ syev_cta_fused()

template<Backend B, typename T>
Event batchlas::syev_cta_fused ( Queue & ctx,
const MatrixView< T, MatrixFormat::Dense > & a_in,
Span< typename base_type< T >::type > eigenvalues,
JobType jobz,
Uplo uplo,
const Span< std::byte > & ws = Span< std::byte >(),
SteqrParams< T > steqr_params = SteqrParams< T >(),
size_t cta_wg_size_multiplier = 0,
Span< int32_t > info = Span< int32_t >() )

Fused (single-kernel) variant of syev_cta.

Runs end to end inside one sub-group partition, so results track syev_cta only to within the reassociation that fusing implies. Unlike syev_cta, A is left untouched when jobz == NoEigenVectors. ws is accepted for API symmetry and ignored. cta_wg_size_multiplier == 0 picks a tuned value per scalar type and width.

◆ syev_cta_fused_buffer_size()

template<Backend B, typename T>
size_t batchlas::syev_cta_fused_buffer_size ( Queue & ctx,
const MatrixView< T, MatrixFormat::Dense > & a,
JobType jobz,
SteqrParams< T > steqr_params = SteqrParams< T >() )

Required workspace, in bytes, for syev_cta_fused().

◆ syev_jacobi_cta()

template<Backend B, typename T>
Event batchlas::syev_jacobi_cta ( Queue & ctx,
const MatrixView< T, MatrixFormat::Dense > & a_in,
Span< typename base_type< T >::type > eigenvalues,
JobType jobz,
Uplo uplo,
const Span< std::byte > & ws = Span< std::byte >(),
JacobiParams< T > params = JacobiParams< T >(),
Span< int32_t > info = Span< int32_t >() )

CTA-optimized Jacobi symmetric/Hermitian eigen-solver, n <= 32; real symmetric and complex Hermitian.

Trades throughput for high relative accuracy on graded or badly scaled input. The underlying theorem (Demmel & Veselic, SIMAX 13(4), 1992) is proved for symmetric positive definite input; indefinite matrices are solved correctly but do not inherit the bound. Overwrites A with eigenvectors when jobz == EigenVectors and leaves it untouched otherwise; ws is accepted for API symmetry and ignored.

◆ syev_jacobi_cta_buffer_size()

template<Backend B, typename T>
size_t batchlas::syev_jacobi_cta_buffer_size ( Queue & ctx,
const MatrixView< T, MatrixFormat::Dense > & a,
JobType jobz,
JacobiParams< T > params = JacobiParams< T >() )

Required workspace, in bytes, for syev_jacobi_cta().

◆ syev_blocked()

template<Backend B, typename T>
Event batchlas::syev_blocked ( Queue & ctx,
const MatrixView< T, MatrixFormat::Dense > & a_in,
Span< typename base_type< T >::type > eigenvalues,
JobType jobz,
Uplo uplo,
const Span< std::byte > & ws,
StedcParams< typename base_type< T >::type > stedc_params = StedcParams< typename base_type< T >::type >(),
Span< int32_t > info = Span< int32_t >() )

Blocked symmetric/Hermitian eigen-solver (SYEV-like) for medium/large n: sytrd_blocked -> stedc -> ormqr_blocked.

Overwrites A with eigenvectors when jobz == EigenVectors. Uplo::Upper input is first mirrored into the lower triangle, in place, and then takes the Lower path.

◆ syev_blocked_buffer_size()

template<Backend B, typename T>
size_t batchlas::syev_blocked_buffer_size ( Queue & ctx,
const MatrixView< T, MatrixFormat::Dense > & a,
JobType jobz,
Uplo uplo,
StedcParams< typename base_type< T >::type > stedc_params = StedcParams< typename base_type< T >::type >() )

Required workspace, in bytes, for syev_blocked(); the same for either uplo.

◆ syev_two_stage()

template<Backend B, typename T>
Event batchlas::syev_two_stage ( Queue & ctx,
const MatrixView< T, MatrixFormat::Dense > & a_in,
Span< typename base_type< T >::type > eigenvalues,
JobType jobz,
Uplo uplo,
const Span< std::byte > & ws,
StedcParams< typename base_type< T >::type > stedc_params = StedcParams< typename base_type< T >::type >(),
Span< int32_t > info = Span< int32_t >() )

Two-stage symmetric/Hermitian eigen-solver (SYEV-like) for large n: sytrd_sy2sb -> sytrd_sb2st -> stedc, then phase/sign recovery and a reflector back-transform.

Band width from choose_two_stage_kd (override with BATCHLAS_SYEV_TWO_STAGE_KD). Uplo::Upper input is mirrored into the lower triangle first, as in syev_blocked().

See also
SYEV for where syev() routes to it

◆ syev_two_stage_buffer_size()

template<Backend B, typename T>
size_t batchlas::syev_two_stage_buffer_size ( Queue & ctx,
const MatrixView< T, MatrixFormat::Dense > & a,
JobType jobz,
Uplo uplo,
StedcParams< typename base_type< T >::type > stedc_params = StedcParams< typename base_type< T >::type >() )

Required workspace, in bytes, for syev_two_stage().

◆ ritz_values_buffer_size()

template<Backend B, typename T, MatrixFormat MFormat>
size_t batchlas::ritz_values_buffer_size ( Queue & ctx,
const MatrixView< T, MFormat > & A,
const MatrixView< T, MatrixFormat::Dense > & V,
const VectorView< typename base_type< T >::type > & ritz_vals )

Required workspace size, in bytes, for ritz_values().

◆ syev_buffer_size()

template<Backend B, typename T>
size_t batchlas::syev_buffer_size ( Queue & ctx,
const MatrixView< T, MatrixFormat::Dense > & A,
Span< typename base_type< T >::type > eigenvalues,
JobType jobtype,
Uplo uplo )

Workspace, in bytes, that syev() needs for the same arguments.

Makes the same kernel choice as the call, so the size is for the tier that will run. info does not affect it.