Singular Value Decomposition (SVD) for Bidiagonal Matrices#
Background#
BDSVD (BiDiagonal Singular Value Decomposition) computes the singular values and, optionally, the left and/or right singular vectors of batched bidiagonal matrices using the QR algorithm.
where:
\(A\) is an \(M \times M\) bidiagonal matrix,
\(\Sigma\) is an \(M \times M\) diagonal matrix containing the singular values of \(A\) in descending order (singular values are always real and non-negative),
\(U\) is an \(M \times M\) unitary matrix containing the left singular vectors of \(A\), and
\(V^H\) is an \(M \times M\) unitary matrix representing the conjugate transpose of \(V\), containing the right singular vectors of \(A\).
Device API#
The cuSolverDx bdsvd device functions are as follows (see Execution Methods):
// Compute singular values only
__device__ void execute(data_type* d, data_type* e, status_type* info);
// Compute singular values and the right/left singular vectors
__device__ void execute(data_type* d, data_type* e, data_type* U, data_type* VH, status_type* info);
// Compute singular values and the right/left singular vectors with runtime leading dimensions of U and VH
__device__ void execute(data_type* d, data_type* e, data_type* U, const unsigned int ldu,
data_type* VH, const unsigned int ldvt, status_type* info);
Parameters:
d: Diagonal elements of the bidiagonal matrixA(sizeMper batch). On exit, contains the singular values in descending order.e: Off-diagonal elements of the bidiagonal matrixA(sizeM-1per batch). On exit, this array is destroyed.U: Batched left singular vectors matrix (size \(M \times M\) per batch).VH: Batched right singular vectors matrix (\(V^H\), size \(M \times M\) per batch).info: Status code for each batch (see Return Status).
Note
The bdsvd function returns \(V^H\) rather than \(V\) itself, consistent with standard LAPACK conventions.
Important
cuSolverDx bdsvd only supports upper bidiagonal matrices. For lower bidiagonal matrices, use the property \(A^H = V \Sigma U^H\).
Important
cuSolverDx bdsvd only supports real data types for matrix A, its singular values, and singular vectors.
Job Options#
The Job operator controls whether singular vectors are computed and how they are stored. If singular vectors are requested, matrices \(U\) and \(VH\) of size \(M \times M\) are required as input, with leading dimensions \(\mathrm{ldu} \geq M\) and \(\mathrm{ldvt} \geq M\).
Left singular vectors (jobu):
job::no_vectors:Uis ignored; no left singular vectors are computed.job::all_vectorsorjob::some_vectors: The function computes the left singular vectors ofAand returns the result inU.job::multiply_vectors: The function computes the left singular vectors ofA, multiplies them withinput_Uon the right, i.e.,input_U * computed_U, and overwritesUwith the result.
Right singular vectors (jobvt):
job::no_vectors:VHis ignored; no right singular vectors are computed.job::all_vectorsorjob::some_vectors: The function computes the right singular vectors ofAand returns the result inVH.job::multiply_vectors: The function computes the right singular vectors ofA, multiplies them withinput_VHon the left, i.e.,computed_VH * input_VH, and overwritesVHwith the result.
Note
For bdsvd, job::all_vectors and job::some_vectors are equivalent because the bidiagonal matrix is always square. In contrast, for gesvd they differ based on the matrix dimensions.
Return Status#
The function returns a status code info for each batch:
info = 0: The function completed successfully.info > 0: The algorithm did not converge within30 * Miterations; specifically,infoelements ofehave not converged to zero.
Supported Configurations#
Arrangement:
UandVHcan independently use column-major or row-major layouts. Use theArrangement<Urr, VHrr>operator, whereUrrandVHrrspecify the layouts forUandVHrespectively (see Arrangement operator).Leading Dimensions: Leading dimensions for
UandVHcan be set independently using theLeadingDimension<LDU, LDVH>operator (see LeadingDimension operator).Job Options: The
Joboperator acceptsjob::no_vectors,job::all_vectors,job::some_vectors, orjob::multiply_vectorsfor left and right singular vectors (see Job operator):job::overwrite_vectorsis not supported forbdsvd; using it results in a compile-time error.If
job::no_vectorsis selected andU/VHpointers are provided, they are ignored.If
job::no_vectorsis selected, any leading dimension or arrangement specified is ignored.
Warning
Unlike LAPACK’s bdsqr, cuSolverDx bdsvd functions only guarantee that computed singular values are accurate to \(O(u||A||_2)\), where \(u\) is the unit-roundoff error for the precision.