Learn R Programming

ggmlR (version 0.8.1)

.ggmlr_normalize_gpu: GPU-accelerated LogNormalize (op = "normalize")

Description

Library-size normalisation followed by log1p, matching Seurat's NormalizeData(method = "LogNormalize"): log1p(x / colSums(x) * scale_factor). The per-cell scaling and the log1p run elementwise on the GPU (broadcast a per-cell factor across genes); the column sums are a cheap reduction.

Usage

.ggmlr_normalize_gpu(
  mat,
  scale_factor = 10000,
  backend = c("vulkan", "cpu"),
  chunk_size = NULL
)

Value

A ggml_result whose embedding is the normalised features x cells matrix; metadata$kind = "transform",

metadata$layer = "data".

Arguments

mat

Dense numeric matrix, features x cells (raw/counts).

scale_factor

Library size to scale each cell to (default 1e4).

backend

"vulkan" or "cpu" (dispatch resolves "auto").