Package: amatrix 0.1.0

amatrix: Backend-Agnostic Matrix Extensions

Matrix-compatible S4 classes with backend-dispatch hooks for accelerated execution and predictable CPU fallback.

Authors:Brad Buchsbaum [aut, cre]

amatrix_0.1.0.tar.gz
amatrix_0.1.0.zip(r-4.7)amatrix_0.1.0.zip(r-4.6)amatrix_0.1.0.zip(r-4.5)
amatrix_0.1.0.tgz(r-4.6-x86_64)amatrix_0.1.0.tgz(r-4.6-arm64)amatrix_0.1.0.tgz(r-4.5-x86_64)amatrix_0.1.0.tgz(r-4.5-arm64)
amatrix_0.1.0.tar.gz(r-4.7-arm64)amatrix_0.1.0.tar.gz(r-4.7-x86_64)amatrix_0.1.0.tar.gz(r-4.6-arm64)amatrix_0.1.0.tar.gz(r-4.6-x86_64)
amatrix_0.1.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
amatrix/json (API)

# Install 'amatrix' in R:
install.packages('amatrix', repos = c('https://bbuchsbaum.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/bbuchsbaum/amatrix/issues

Pkgdown/docs site:https://bbuchsbaum.github.io

Uses libs:
  • openblas– Optimized BLAS

On CRAN:

Conda:

openblas

5.87 score 2 packages 165 scripts 146 exports 2 dependencies

Last updated from:aa1a39a22d. Checks:8 ERROR, 5 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64ERROR230
linux-devel-x86_64ERROR189
source / vignettesOK197
linux-release-arm64ERROR208
linux-release-x86_64ERROR201
macos-release-arm64ERROR208
macos-release-x86_64ERROR395
macos-oldrel-arm64ERROR203
macos-oldrel-x86_64ERROR341
windows-develOK209
windows-releaseOK237
windows-oldrelOK213
wasm-releaseOK139

Exports:addmmadgCMatrixadgeMatrixam_colargmaxam_colargminam_ewise_inplaceam_qram_rowargmaxam_rowargminam_scatter_meanam_sweepam_sweep_inplaceamatrix_backend_capabilitiesamatrix_backend_featuresamatrix_backend_health_probeamatrix_backend_matrixamatrix_backend_namesamatrix_backend_planamatrix_backend_precision_modesamatrix_backend_statusamatrix_benchmark_reportamatrix_bind_residentamatrix_cache_max_sizeamatrix_calibrateamatrix_calibration_infoamatrix_compile_productamatrix_default_policyamatrix_default_precisionamatrix_dispatch_opamatrix_execution_infoamatrix_explainamatrix_fallback_logamatrix_fallback_log_resetamatrix_gcamatrix_gpu_statusamatrix_materialize_hostamatrix_memory_statsamatrix_prepare_operandsamatrix_register_backendamatrix_release_residentamatrix_residency_infoamatrix_resident_backend_foramatrix_set_cache_max_sizeamatrix_set_default_policyamatrix_set_default_precisionamatrix_use_gpuamatrix_warmarray_lmas_adgCMatrixas_adgeMatrixas.arrayas.matrixas.matrix.adgCMatrixas.matrix.adgeMatrixas.matrix.aTransposeViewas.matrix.KronMatrixas.matrix.resident_handlebatch_cholbatch_crossprodbatch_solveblock_lanczosblock_svdcholchol_diagchol_factorchol_logdetchol_solvechol_solve_batchescolmeanscolMeanscolscalecolsumscolSumscorrelationcov2corcovariancecrossprod_add_diagcrossprod_weighteddiagdist_matrixdoteigeneighewisegemmirlbairlba_nativekernel_matrixkronkron_matrixkroneckerlm_fitlm_loo_cvlu_factorlu_solvemany_lmmat_logmat_powmat_sqrtmatmulncol.resident_handlenrow.resident_handlepairwise_sqdist_argminpca_coefqrqr_downdateqr_infoqr.coefqr.fittedqr.Qqr.qtyqr.qyqr.Rqr.residqr.solvequad_formresident_handlerh_colSumsrh_rowSumsridge_fitridge_pathrowmeansrowMeansrowscalerowsumsrowSumsrsvdsegment_meansegment_sumsinkhornsolvesolve_triangularsvdsvd_factorsvd_projectsvd_reconstructsymttcrossprod_weightedtracetrace_estimwith_amatrixwls_fitwoodbury_logdetwoodbury_solvexty_weighted

Dependencies:latticeMatrix

GPU Acceleration: Zero to First Matmul
How do I install a backend? | Does it just work? | Am I actually on the GPU? | What does "fast" precision actually mean? | Why did my small matrix stay on the CPU? | What happens when the GPU fails? | The one sharp edge: resident handles alias the GPU buffer | Where next?

Last update: 2026-07-02
Started: 2026-07-02

When is amatrix fast?
The speed contract | Calibrate once per machine | Read the benchmark report | When the GPU wins | When the CPU wins (and you should let it) | Ask the dispatcher | Residency and fallback telemetry | Regenerating the baseline | Honest defaults

Last update: 2026-07-02
Started: 2026-04-14

Getting started with backend-aware matrices in amatrix
What do your inputs look like? | What is the quickest end-to-end path? | How does amatrix decide where to run? | When does shared-design caching help? | What should you inspect after a fit? | How do you ask for a fast backend? | Where next?

Last update: 2026-04-12
Started: 2026-04-12

Readme and manuals

Help Manual

Help pageTopics
Matrix multiplication for adgCMatrix%*%,adgCMatrix,adgCMatrix-method %*%,adgCMatrix,adgeMatrix-method %*%,adgCMatrix,ANY-method %*%,adgCMatrix,dgCMatrix-method %*%,adgCMatrix,dgeMatrix-method %*%,adgCMatrix,Matrix-method %*%,adgCMatrix,matrix-method
Scaled matrix multiply with optional bias: alpha*(A%*%B) + beta*Caddmm
Create a backend-aware sparse matrixadgCMatrix
Sparse column-compressed matrix with backend-dispatch metadataadgCMatrix-class
Create a backend-aware dense matrixadgeMatrix
Dense general matrix with backend-dispatch metadataadgeMatrix-class
Sparse logical matrix with backend-dispatch metadataadlgCMatrix-class
Dense logical matrix with backend-dispatch metadataadlgeMatrix-class
Row and column argmax/argminam_argreduce am_colargmax am_colargmin am_rowargmax am_rowargmin
In-place elementwise operation on a resident handleam_ewise_inplace
QR decomposition of an amatrix objectam_qr
Scatter mean by group labelsam_scatter_mean
Backend-dispatched sweepam_sweep
In-place broadcast sweep on a resident handleam_sweep_inplace
Query the capabilities of a registered backendamatrix_backend_capabilities
Query the features of a registered backendamatrix_backend_features
Run a canary health probe against a registered backendamatrix_backend_health_probe
Tabulate dispatch plans across multiple operationsamatrix_backend_matrix
List names of all registered backendsamatrix_backend_names
Compute the dispatch plan for a single operationamatrix_backend_plan
Query the precision modes supported by a registered backendamatrix_backend_precision_modes
Summarise the status of registered backendsamatrix_backend_status
Report amatrix benchmark status across ops and backendsamatrix_benchmark_report
Bind an amatrix object to resident backend storageamatrix_bind_resident
Get or set the model cache maximum sizeamatrix_cache_max_size amatrix_set_cache_max_size
Calibrate GPU dispatch thresholds for this machineamatrix_calibrate
Retrieve the current calibration stateamatrix_calibration_info
Compile a reusable matrix-product planamatrix_compile_product
Get the session-level default dispatch policyamatrix_default_policy
Get the session-level default precision modeamatrix_default_precision
Low-level backend dispatch for a single operationamatrix_dispatch_op
Collect full dispatch information for an aMatrix objectamatrix_execution_info
Explain dispatch decisions for an aMatrix operationamatrix_explain
Return the amatrix backend fallback logamatrix_fallback_log
Clear the amatrix backend fallback logamatrix_fallback_log_reset
Free stale GPU residency entries and optionally flush the model cacheamatrix_gc
GPU backend status: why am I (not) on the GPU?amatrix_gpu_status
Force materialization of an aMatrix to a host Matrix objectamatrix_materialize_host
Report GPU residency and model cache usageamatrix_memory_stats
Prepare operands for a repeated matrix productamatrix_prepare_operands
Register a backend with the amatrix dispatch systemamatrix_register_backend
Release GPU-resident data held by an amatrix objectamatrix_release_resident
Query GPU residency state of an aMatrix objectamatrix_residency_info
Choose a residency-capable accelerator backend for a hot pathamatrix_resident_backend_for
Set the session-level default dispatch policyamatrix_set_default_policy
Set the session-level default precision modeamatrix_set_default_precision
Enable GPU acceleration for this sessionamatrix_use_gpu
Warm up GPU backends to eliminate cold-start latencyamatrix_warm
Virtual base class for backend-aware matricesaMatrix-class
Cholesky factorization resultamChol-class
LU factorization result for general square matricesamLU-class
Truncated SVD factorization resultamSVD-class
Fit linear models with array-shaped responsearray_lm
Coerce an object to adgCMatrixas_adgCMatrix
Coerce an object to adgeMatrixas_adgeMatrix
Convert a resident handle back to an adgeMatrixas_adgeMatrix.resident_handle
Coerce amatrix objects to base R typesas.array,adgCMatrix-method as.array,adgeMatrix-method as.matrix,adgCMatrix-method as.matrix,adgeMatrix-method as.matrix,amChol-method as.matrix,aTransposeView-method as.matrix,KronMatrix-method as.matrix.adgCMatrix as.matrix.adgeMatrix as.matrix.aTransposeView as.numeric,adgeMatrix-method as.vector,adgeMatrix-method
Lazy transpose view of an adgeMatrixaTransposeView-class
Batch Cholesky factorizationbatch_chol
Batch crossproductbatch_crossprod
Batch triangular solvebatch_solve
Block Lanczos SVD via block Krylov iterationblock_lanczos block_svd
Extract the diagonal of a Cholesky factorchol_diag
Compute the Cholesky factorization of an adgeMatrixchol_factor
Log-determinant from a Cholesky factorchol_logdet
Solve a linear system using a Cholesky factorchol_solve
Solve many right-hand-side batches with one Cholesky factorchol_solve_batches
Cholesky factorization for adgCMatrixchol,adgCMatrix-method
Cholesky factorization for adgeMatrixchol,adgeMatrix-method
Compute a correlation matrixcorrelation
Covariance-to-correlation methods for amatrix objectscov2cor,adgCMatrix-method cov2cor,adgeMatrix-method
Backend-dispatched covariance matrixcovariance
Cross-product plus diagonal perturbationcrossprod_add_diag
Weighted cross-product X'WXcrossprod_weighted
Cross-product methods for adgCMatrixcrossprod,adgCMatrix,adgCMatrix-method crossprod,adgCMatrix,adgeMatrix-method crossprod,adgCMatrix,ANY-method crossprod,adgCMatrix,dgCMatrix-method crossprod,adgCMatrix,dgeMatrix-method crossprod,adgCMatrix,Matrix-method crossprod,adgCMatrix,matrix-method crossprod,adgCMatrix,missing-method tcrossprod,adgCMatrix,adgCMatrix-method tcrossprod,adgCMatrix,adgeMatrix-method tcrossprod,adgCMatrix,ANY-method tcrossprod,adgCMatrix,dgCMatrix-method tcrossprod,adgCMatrix,dgeMatrix-method tcrossprod,adgCMatrix,Matrix-method tcrossprod,adgCMatrix,matrix-method tcrossprod,adgCMatrix,missing-method
Cross-product methods for adgeMatrixcrossprod,adgeMatrix,ANY-method crossprod,adgeMatrix,missing-method tcrossprod,adgeMatrix,ANY-method tcrossprod,adgeMatrix,missing-method
GPU-accelerated pairwise distance matrixdist_matrix
Inner product of two vectors or matricesdot
Eigendecomposition for adgCMatrixeigen,adgCMatrix-method
Eigendecomposition for adgeMatrixeigen,adgeMatrix-method
Symmetric eigendecompositioneigh
Element-wise operationsewise
Generalised matrix multiply (BLAS DGEMM interface)gemm
GPU-accelerated truncated SVD via irlbairlba
GPU-native truncated SVD via Lanczos bidiagonalizationirlba_native
GPU-accelerated pairwise kernel matrixkernel_matrix
Eager Kronecker productkron
Construct a lazy Kronecker productkron_matrix
Kronecker product of backend-aware matriceskronecker,adgCMatrix,adgCMatrix-method kronecker,adgCMatrix,adgeMatrix-method kronecker,adgCMatrix,matrix-method kronecker,adgeMatrix,adgCMatrix-method kronecker,adgeMatrix,adgeMatrix-method kronecker,adgeMatrix,matrix-method kronecker,matrix,adgCMatrix-method kronecker,matrix,adgeMatrix-method kronecker-methods
Lazy Kronecker product of two matricesKronMatrix-class
Fit a single linear modellm_fit
Leave-one-out cross-validation for linear modelslm_loo_cv
Store a general square matrix for LU-based solvinglu_factor
Solve a linear system using an LU factorlu_solve
Fit multiple linear models against a shared design matrixmany_lm
Matrix functions via symmetric eigendecompositionmat_fun mat_log mat_pow mat_sqrt
Matrix multiplicationmatmul
Matrix multiplication for adgeMatrix%*%,adgeMatrix,adgCMatrix-method %*%,adgeMatrix,adgeMatrix-method %*%,adgeMatrix,ANY-method %*%,adgeMatrix,aTransposeView-method %*%,adgeMatrix,dgCMatrix-method %*%,adgeMatrix,dgeMatrix-method %*%,adgeMatrix,Matrix-method %*%,adgeMatrix,matrix-method %*%,aTransposeView,adgeMatrix-method %*%,aTransposeView,ANY-method %*%,aTransposeView,aTransposeView-method %*%,aTransposeView,matrix-method %*%,dgCMatrix,adgCMatrix-method %*%,dgeMatrix,adgCMatrix-method %*%,KronMatrix,matrix-method %*%,KronMatrix,numeric-method %*%,matrix,adgCMatrix-method %*%,matrix,adgeMatrix-method %*%,matrix,aTransposeView-method %*%,matrix,KronMatrix-method %*%,numeric,adgCMatrix-method %*%,numeric,adgeMatrix-method %*%,numeric,KronMatrix-method matmul-methods
Nearest-centroid assignment via fused squared-distance computationpairwise_sqdist_argmin
Project and reconstruct data using a truncated SVDpca_coef
QR downdate after removing one rowqr_downdate
Inspect an amQR factorization objectqr_info
Evaluate a quadratic form using a Cholesky factorquad_form
Create a mutable GPU-resident handleresident_handle
Column sums of a GPU-resident handlerh_colSums
Row sums of a GPU-resident handlerh_rowSums
Fit a single ridge regression modelridge_fit
Compute a ridge regression solution pathridge_path
Row and column meanscolmeans rowmeans
Row and column diagonal scalingcolscale rowscale
Row and column sumscolsums rowsums
Row and column summary methods for adgCMatrixcolMeans,adgCMatrix-method colSums,adgCMatrix-method rowMeans,adgCMatrix-method rowSums,adgCMatrix-method
Row and column summary methods for adgeMatrixcolMeans,adgeMatrix-method colSums,adgeMatrix-method rowMeans,adgeMatrix-method rowSums,adgeMatrix-method
GPU-native randomized SVD (Halko et al. 2011)rsvd
Segment mean by group labelssegment_mean
Segment sum by group labelssegment_sum
Doubly-stochastic scaling via Sinkhorn-Knopp iterationssinkhorn
Solve a triangular linear systemsolve_triangular
Solve a linear system for adgCMatrixsolve,adgCMatrix,ANY-method solve,adgCMatrix,missing-method
Solve a linear system for adgeMatrixsolve,adgeMatrix,ANY-method solve,adgeMatrix,missing-method
Compute a truncated SVD of an aMatrixsvd_factor
Project new data onto SVD left singular vectorssvd_project
Reconstruct data from SVD coordinatessvd_reconstruct
Singular value decomposition for adgeMatrixsvd svd,adgeMatrix-method svd-methods
Singular value decomposition for adgCMatrixsvd,adgCMatrix-method
Symmetrise a matrixsym
Weighted outer cross-product XWX'tcrossprod_weighted
Matrix tracetrace
Stochastic trace estimator (Hutchinson)trace_estim
Evaluate code with temporary amatrix defaultswith_amatrix
Fit a weighted least squares modelwls_fit
Log-determinant via the Woodbury matrix determinant lemmawoodbury_logdet
Solve a linear system using the Woodbury matrix identitywoodbury_solve
Weighted cross-product X'Wyxty_weighted