Computes a rank-k truncated singular value decomposition of
X, dispatching to the most suitable algorithm and backend
based on matrix size, requested rank, and available hardware.
Arguments
- X
An
aMatrix(typicallyadgeMatrixoradgCMatrix).- k
Positive integer; the number of singular values and vectors to compute. Defaults to
min(dim(X)).- method
One of
"auto"(default),"exact","rsvd", or"subspace"."auto"selects the algorithm based on matrix dimensions and the available backend.- n_oversamples
Non-negative integer; extra random vectors used to stabilize randomized algorithms. Ignored for
method = "exact".- n_iter
Non-negative integer; number of power iterations for the subspace method. Ignored for
method = "exact".
Value
An amSVD object containing slots
u, d, v, and metadata.
Examples
m <- matrix(rnorm(30), nrow = 6)
A <- adgeMatrix(m)
fac <- svd_factor(A, k = 3L)
fac
#> amSVD [6x5 -> rank 3 | strict | exact/exact_svd@cpu | source: 20260702132121.033621-1cdf1817:am:117]
#> d[1:min(3,k)]: 4.4865, 3.2935, 2.2253