pub fn xgesvd<TA: DataTypeLike, TS: DataTypeLike, TU: DataTypeLike, TVT: DataTypeLike>(
ctx: &Context,
params: &Params,
job_u: SvdMode,
job_vt: SvdMode,
m: usize,
n: usize,
a: MatrixMut<'_, TA>,
s: &mut DeviceMemory<TS>,
u: Option<MatrixMut<'_, TU>>,
vt: Option<MatrixMut<'_, TVT>>,
workspace: ByteWorkspaceMut<'_>,
dev_info: &mut DeviceMemory<i32>,
) -> Result<()>Expand description
Use xgesvd_buffer_size to calculate the sizes needed for pre-allocated
workspace.
Computes the singular value decomposition (SVD) of an $m \times n$ matrix
A and the corresponding left and/or right singular vectors.
The SVD is written as $A = U \Sigma V^{H}$, where Σ is an
$m \times n$ matrix which is zero except for its min(m,n) diagonal
elements, U is an $m \times m$ unitary matrix, and V is an
$n \times n$ unitary matrix.
The diagonal elements of Σ are the singular values of A; they are real and non-negative, and are returned in descending order.
The first min(m,n) columns of U and V are the left and right singular vectors of A.
Provide device and host workspace through workspace.
Use xgesvd_buffer_size to determine the required sizes for
workspace.device and workspace.host.
If the reported info value is -i, the ith parameter is invalid. If bdsqr did not converge, info specifies how many superdiagonals of an intermediate bidiagonal form did not converge to zero.
Currently, xgesvd supports only the default algorithm.
Algorithms supported by xgesvd
| Algorithm | Notes |
|---|---|
AlgorithmMode::Default | Default algorithm. |
gesvd only supports m >= n.
Returns $V^H$, not V.
List of input arguments for xgesvd_buffer_size and xgesvd:
The generic cuSOLVER routine separates matrix, singular-value, vector, and compute data
types: data_type_a is the data type of matrix A, data_type_s is the
data type of vector S, data_type_u is the data type of matrix U,
data_type_vt is the data type of matrix VT, and compute_type is the
operation’s compute type.
xgesvd only supports the following four combinations.
Valid combination of data type and compute type
| data_type_a | data_type_s | data_type_u | data_type_vt | compute_type | Meaning |
|---|---|---|---|---|---|
DataType::F32 | DataType::F32 | DataType::F32 | DataType::F32 | DataType::F32 | SGESVD |
DataType::F64 | DataType::F64 | DataType::F64 | DataType::F64 | DataType::F64 | DGESVD |
DataType::ComplexF32 | DataType::F32 | DataType::ComplexF32 | DataType::ComplexF32 | DataType::ComplexF32 | CGESVD |
DataType::ComplexF64 | DataType::F64 | DataType::ComplexF64 | DataType::ComplexF64 | DataType::ComplexF64 | ZGESVD |
§Errors
Returns an error if cuSOLVER has not been initialized, if the matrix dimensions, leading dimensions, output modes, or output buffers are invalid, or if cuSOLVER reports an internal failure.