batchlas::verify Namespace Reference

Functions

◆ eigenvalues() [1/2]

template<class D>
requires (std::is_same_v<D, double> || std::is_same_v<D, std::complex<double>>)
bool batchlas::verify::eigenvalues ( int n,
std::vector< D > & a,
std::vector< double > & w )

Ascending eigenvalues of the n x n Hermitian a (column-major, ld = n, both triangles valid; destroyed).

Definition at line 64 of file reference.hh.

◆ singular_values() [1/2]

template<class D>
requires (std::is_same_v<D, double> || std::is_same_v<D, std::complex<double>>)
bool batchlas::verify::singular_values ( int m,
int n,
std::vector< D > & a,
std::vector< double > & s )

Descending singular values of the m x n a (column-major, ld = m; destroyed).

Definition at line 83 of file reference.hh.

◆ getrf_pivots() [1/2]

template<class E>
bool batchlas::verify::getrf_pivots ( int m,
int n,
std::vector< E > & a,
std::vector< std::int32_t > & ipiv )

1-based pivots of the m x n a (column-major, ld = m; overwritten by its LU factor): min(m, n) of them, from ?getrf in E's own precision (float, double, complex<float>, complex<double>).

Precondition
a holds the data in its native precision (MatrixView::astype<E>(items), never a promoted copy, which sends float data to dgetrf). The view overload below does this for you.

Definition at line 107 of file reference.hh.

◆ getrf_pivots() [2/2]

template<class T>
bool batchlas::verify::getrf_pivots ( const MatrixView< T, MatrixFormat::Dense > & A,
int item,
std::vector< std::int32_t > & ipiv )

getrf_pivots of item item of a dense view, copied in the view's own precision.

Definition at line 136 of file reference.hh.

◆ geqrf_tau() [1/2]

template<class D>
bool batchlas::verify::geqrf_tau ( int m,
int n,
std::vector< D > & a,
std::vector< D > & tau )

LAPACK geqrf of the m x n a (column-major, ld = m; overwritten by R and the reflectors) and its min(m, n) tau.

Definition at line 143 of file reference.hh.

◆ tridiagonal_eigenvalues()

bool batchlas::verify::tridiagonal_eigenvalues ( std::vector< double > & d,
std::vector< double > & e )
inline

Eigenvalues of the symmetric tridiagonal (diagonal d, off-diagonal e): ascending, written to d.

Definition at line 162 of file reference.hh.

◆ eigenvalues() [2/2]

template<class T>
bool batchlas::verify::eigenvalues ( const MatrixView< T, MatrixFormat::Dense > & A,
int item,
std::vector< double > & w )

eigenvalues() of item item of the Hermitian A (both triangles valid), promoted.

Definition at line 174 of file reference.hh.

◆ singular_values() [2/2]

template<class T>
bool batchlas::verify::singular_values ( const MatrixView< T, MatrixFormat::Dense > & A,
int item,
std::vector< double > & s )

singular_values() of item item of A, promoted.

Definition at line 180 of file reference.hh.

◆ geqrf_tau() [2/2]

template<class T>
bool batchlas::verify::geqrf_tau ( const MatrixView< T, MatrixFormat::Dense > & A,
int item,
std::vector< typename MatrixView< T, MatrixFormat::Dense >::promoted_type > & tau )

geqrf_tau() of item item of A, promoted; the factor is discarded.

Definition at line 187 of file reference.hh.

◆ eps()

template<class T>
double batchlas::verify::eps ( )
constexpr

Unit roundoff of T's real type: 2^-24 for float, 2^-53 for double.

Definition at line 20 of file tolerance.hh.

◆ nanmax()

double batchlas::verify::nanmax ( double a,
double b )
inline

max(a, b), NaN if either is NaN (std::max drops a NaN second argument, so a poisoned value would pass).

Definition at line 23 of file tolerance.hh.

◆ bound() [1/2]

template<class T>
double batchlas::verify::bound ( Check kind,
int n )

c(kind) * f(n) * eps<T>(): f(n) = n (below 1 counts as 1), except blas, f(k) = k + 2 (k below 0 counts as 0).

Definition at line 117 of file tolerance.hh.

◆ bound() [2/2]

template<class T>
double batchlas::verify::bound ( Check kind,
int n,
Slack slack )

slack.factor * bound<T>(kind, n).

Exceptions
batchlas::invalid_argumentfor an empty reason or a factor <= 0.

Definition at line 123 of file tolerance.hh.

◆ within() [1/2]

template<class T>
bool batchlas::verify::within ( Check kind,
int n,
double value )

pass without recording: for predicates evaluated on results expected to be wrong.

Definition at line 129 of file tolerance.hh.

◆ within() [2/2]

template<class T>
bool batchlas::verify::within ( Check kind,
int n,
double value,
Slack slack )

Definition at line 131 of file tolerance.hh.

◆ pass() [1/2]

template<class T>
bool batchlas::verify::pass ( Check kind,
int n,
double value )

True when value is not NaN and within bound<T>(kind, n).

With BATCHLAS_VERIFY_RECORD=<path> set, appends "kind dtype n value bound 1 -" to that file (calibration input).

Definition at line 137 of file tolerance.hh.

◆ pass() [2/2]

template<class T>
bool batchlas::verify::pass ( Check kind,
int n,
double value,
Slack slack )

pass against the slacked bound; records the raw value, the kind's bound, the factor and the reason.

Definition at line 143 of file tolerance.hh.

◆ pivot_ratio_bound()

template<class T>
double batchlas::verify::pivot_ratio_bound ( )

Bound of pivot_ratio: 1 + 64 eps<T>() (32 machine epsilons), the slack of a cabs1 comparison in T.

Definition at line 150 of file tolerance.hh.

Enumerations

◆ Check

enum class batchlas::verify::Check
strong

orthogonality: Q from Householder reflectors or a direct orthogonalization (geqrf, orgqr, form_q, ortho); orthogonality_rotations: eigen- and singular vectors from an iterative solver (Jacobi, QR iteration, divide and conquer, inverse iteration).

n per kind, as each was calibrated: orthogonality, the rows of Q (Householder error grows with the reflector length); orthogonality_rotations, the number of vectors checked (columns of Q). blas: n is the inner dimension k (the tuner's componentwise trsm check: k = the order); trsm_residual is normwise and judged under solve.

Enumerator
factorization 
solve 
blas 
orthogonality 
orthogonality_rotations 
eigen_residual 
values 

Definition at line 34 of file tolerance.hh.

Variables

◆ have_reference

bool batchlas::verify::have_reference = BATCHLAS_VERIFY_HAVE_LAPACKE != 0
inlineconstexpr

True when this build has host LAPACKE references; a reference that returns false here failed.

Definition at line 37 of file reference.hh.

Namespaces

namespace  detail

Classes

struct  Slack
 A per-site factor on a kind's bound, in either direction. More...