torch.svd_lowrank¶
-
torch.
svd_lowrank
(A: torch.Tensor, q: Optional[int] = 6, niter: Optional[int] = 2, M: Optional[torch.Tensor] = None) → Tuple[torch.Tensor, torch.Tensor, torch.Tensor][source]¶ Return the singular value decomposition
(U, S, V)
of a matrix, batches of matrices, or a sparse matrix such that . In case is given, then SVD is computed for the matrix .Note
The implementation is based on the Algorithm 5.1 from Halko et al, 2009.
Note
To obtain repeatable results, reset the seed for the pseudorandom number generator
Note
The input is assumed to be a low-rank matrix.
Note
In general, use the full-rank SVD implementation
torch.svd
for dense matrices due to its 10-fold higher performance characteristics. The low-rank SVD will be useful for huge sparse matrices thattorch.svd
cannot handle.- Arguments::
A (Tensor): the input tensor of size
q (int, optional): a slightly overestimated rank of A.
- niter (int, optional): the number of subspace iterations to
conduct; niter must be a nonnegative integer, and defaults to 2
- M (Tensor, optional): the input tensor’s mean of size
.
- References::
Nathan Halko, Per-Gunnar Martinsson, and Joel Tropp, Finding structure with randomness: probabilistic algorithms for constructing approximate matrix decompositions, arXiv:0909.4061 [math.NA; math.PR], 2009 (available at arXiv).