Computes principal components of a feature-by-cell matrix. The heavy step —
the gene-by-gene covariance (a large matrix multiply) — runs on the Vulkan
GPU via the ag_* backend; the eigendecomposition of the (small,
features x features) covariance runs on the CPU, since ggml has no
eigensolver. Cells are projected onto the leading eigenvectors.
.ggmlr_pca_gpu(
mat,
n_components = 50L,
center = TRUE,
backend = c("vulkan", "cpu"),
chunk_size = NULL
)A ggml_result: embedding is cells x
n_components; metadata holds stdev (component standard
deviations), loadings (features x components) and backend.
Dense numeric matrix, features in rows, cells in columns.
Number of principal components to return.
Logical; subtract the per-feature mean before PCA (default
TRUE). Single-cell PCA is virtually always centered.
"vulkan" to use the GPU for the covariance multiply,
"cpu" to keep it on the CPU. The caller (dispatch layer) resolves
"auto" to one of these.