Wraps irlba::irlba() with an adgeMatrix input so that every
Lanczos matrix-vector product routes through the amatrix GPU dispatch path.
The matrix A is kept resident on device; consecutive matvecs in the
Lanczos loop avoid host round-trips.
Usage
irlba(
A,
nv = 5,
nu = nv,
...,
mode = "fast",
backend = NULL,
implementation = c("compat", "block"),
block_size = NULL,
n_steps = NULL
)Arguments
- A
A matrix,
adgeMatrix, oradgCMatrix. Plain matrices are coerced viaadgeMatrix(A, mode=mode, backend=backend).- nv
Number of right singular vectors.
- nu
Number of left singular vectors. Defaults to
nv.- ...
Additional arguments forwarded to
irlba::irlba().fastpathis always forced toFALSE— the C fastpath bypasses S4 dispatch and cannot be GPU-accelerated.- mode
Execution mode passed to
adgeMatrix()when coercing."fast"permits float32 and enables GPU routing. Ignored ifAis already anadgeMatrixoradgCMatrix.- backend
Backend name (e.g.
"mlx","arrayfire"). Ignored ifAis already an amatrix object.- implementation
Lanczos implementation to use.
"compat"preserves the currentirlba::irlba()wrapper behavior."block"routes toblock_lanczosfor a GEMM-oriented approximation.- block_size
Block size passed to
am_block_lanczos()whenimplementation = "block". Defaults to a small MLX-friendly block size derived from the requested rank.- n_steps
Number of block Krylov steps passed to
am_block_lanczos()whenimplementation = "block".
Details
The hot loop in irlba is two matrix-vector products per Lanczos step:
A %*% v and w %*% A. Both route through am_matmul()
when A is an adgeMatrix, giving GPU acceleration on the dominant
cost. Orthogonalization, svd(B), and convergence tests remain on CPU
where they belong (the subspace dimension work is always small).
Do not pass mult= — it is deprecated in irlba and forces a
non-standard dispatch path. Pass an adgeMatrix instead.