gesvd and the bidiagonal pipeline stages.
Lower-level functions (algorithm-specific variants, workspace queries, validation and helpers): SVD: lower-level API.
| Event batchlas::gesvd |
( |
Queue & | ctx, |
|
|
const MatrixView< T, MatrixFormat::Dense > & | A, |
|
|
Span< typename base_type< T >::type > | singular_values, |
|
|
const MatrixView< T, MatrixFormat::Dense > & | U, |
|
|
const MatrixView< T, MatrixFormat::Dense > & | Vh, |
|
|
SvdVectors | jobu, |
|
|
SvdVectors | jobvh, |
|
|
Span< std::byte > | workspace, |
|
|
Span< int32_t > | info ) |
Singular value decomposition of a batch of matrices (LAPACK ?gesvd).
Computes \( A = U \Sigma V^H \) for every m x n batch item, with the \( k = \min(m, n) \) singular values in descending order. The kernel family is the first entry of the nearest row of the device's tuned table (tuned/gesvd.<device>.txt) that can run the call: jacobi (one-sided Jacobi, max(m, n) <= 64, or 32 for complex<double> with vectors), cta (max(m, n) <= 32; no Thin request that canonicalisation leaves thin), blocked (bidiagonalisation for real input; square Hermitian Lower input of any type runs syev_blocked()), or vendor, the solver library. Complex general input therefore runs jacobi or vendor. Pin a family with BATCHLAS_GESVD_ROUTE (e.g. jacobi, vendor). Asynchronous: returns once the work is enqueued.
- Parameters
-
| ctx | queue the work is enqueued on |
| A | batch of m x n matrices; overwritten (destroyed) |
| singular_values | k real singular values per batch item, packed, descending |
| U | left singular vectors: m x m for SvdVectors::All, m x k for Thin; unused for None |
| Vh | \( V^H \): n x n for All, k x n for Thin; unused for None |
| jobu | which columns of U to compute |
| jobvh | which rows of Vh to compute |
| workspace | at least gesvd_buffer_size() bytes for the same arguments |
| info | per-item convergence status: 0 converged, > 0 LAPACK-like (the number of off-diagonals that failed to converge, or 1 where the kernel that ran tracks only the fact of failure). An EMPTY span means "not requested" and costs nothing; gesvd_buffer_size() is the same either way. |
- Returns
- event of the last enqueued kernel
- Exceptions
-
| batchlas::workspace_error | if the workspace span is smaller than the chosen kernel needs |
| batchlas::NoRouteError | when no native kernel can run the call in a build without the solver library |
| batchlas::unsupported | if the vendor family runs a shape its binding cannot take: on CUDA (gesvdjBatched) max(m, n) > 32, a non-packed batch stride or a thin request; on ROCm always (no binding). Complex general input above jacobi's ceiling therefore has no kernel on those backends. |
| batchlas::convergence_error | on NETLIB when an item fails to converge and info is empty (with info given, the status is written instead) |
| std::invalid_argument | if BATCHLAS_GESVD_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, GESVD, gesvd design, docs/cpp-api.md (convergence status)