Skip to main content

xgesvdr

Function xgesvdr 

Source
pub fn xgesvdr<TA: DataTypeLike, TS: DataTypeLike, TU: DataTypeLike, TV: DataTypeLike>(
    ctx: &Context,
    params: &Params,
    job_u: TruncatedSvdMode,
    job_v: TruncatedSvdMode,
    m: usize,
    n: usize,
    k: usize,
    p: usize,
    niters: usize,
    a: MatrixMut<'_, TA>,
    s: &mut DeviceMemory<TS>,
    u: Option<MatrixMut<'_, TU>>,
    v: Option<MatrixMut<'_, TV>>,
    workspace: ByteWorkspaceMut<'_>,
    dev_info: &mut DeviceMemory<i32>,
) -> Result<()>
Expand description

Use xgesvdr_buffer_size to calculate the sizes needed for pre-allocated workspace.

Computes the approximate rank-k singular value decomposition (k-SVD) of an $m \times n$ matrix A and the corresponding left and/or right singular vectors. The k-SVD is written as

where Σ is a $k \times k$ matrix which is zero except for its diagonal elements, U is an $m \times k$ orthonormal matrix, and V is an $k \times n$ orthonormal matrix. The diagonal elements of Σ are the approximated singular values of A; they are real and non-negative, and are returned in descending order. The columns of U and V are the top-k left and right singular vectors of A.

xgesvdr implements randomized methods described in [15] to compute k-SVD that is accurate with high probability if the conditions described in [15] hold. xgesvdr is intended to compute a small portion of the spectrum of A quickly and accurately, especially when k is much smaller than min(m,n) and the matrix dimensions are large.

The accuracy of the method depends on the spectrum of A, the number of power iterations niters, the oversampling parameter p and the ratio between p and the dimensions of the matrix A. Larger values of oversampling p or more iterations niters may produce more accurate approximations, but also increase the run time of xgesvdr.

Our recommendation is to use two iterations and set the oversampling to at least 2k. Once the solver provides enough accuracy, adjust the values of k and niters for better performance.

Provide device and host workspace through workspace. Use xgesvdr_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.

Currently, xgesvdr supports only the default algorithm.

Algorithms supported by xgesvdr

AlgorithmNotes
AlgorithmMode::DefaultDefault algorithm.

gesvdr also supports n >= m.

Returns V, not $V^{H}$.

List of input arguments for xgesvdr_buffer_size and xgesvdr:

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_v is the data type of matrix V, and compute_type is the operation’s compute type. xgesvdr only supports the following four combinations.

Valid combination of data type and compute type

§Errors

Returns an error if cuSOLVER has not been initialized, if the matrix dimensions or leading dimensions are invalid, or if cuSOLVER reports an internal failure.