Module gemm

Module gemm 

Source
Expand description

Matrix multiplication utilities with pluggable BLAS backend

This module provides thin wrappers around matrix multiplication operations, with support for runtime selection of BLAS implementations.

§Design

  • Default: Pure Rust Faer backend (no external dependencies)
  • Optional: External BLAS via function pointer injection
  • Thread-safe: Global dispatcher protected by RwLock

§Example

use sparse_ir::gemm::{matmul_par, set_blas_backend};

// Use default Faer backend
let c = matmul_par(&a, &b);

// Or inject custom BLAS (from C-API)
unsafe {
    set_blas_backend(my_dgemm_ptr, my_zgemm_ptr);
}
let c = matmul_par(&a, &b);  // Now uses custom BLAS

Structs§

ExternalBlas64Backend
External BLAS backend (ILP64: 64-bit integers)
ExternalBlasBackend
Conversion rules for row-major data to column-major BLAS:
GemmBackendHandle
Thread-safe handle to a GEMM backend

Traits§

GemmBackend
GEMM backend trait for runtime dispatch

Functions§

clear_blas_backend
Clear BLAS backend (reset to default Faer)
get_backend_info
Get current BLAS backend information
matmul_par
Parallel matrix multiplication: C = A * B
matmul_par_overwrite
Parallel matrix multiplication with overwrite: C = A * B (writes to existing buffer)
matmul_par_overwrite_view
Parallel matrix multiplication with overwrite accepting DView (assumes contiguous memory)
matmul_par_to_viewmut
Parallel matrix multiplication with overwrite to mutable view: C = A * B
matmul_par_view
Parallel matrix multiplication accepting DView (assumes contiguous memory)
set_blas_backend
Set BLAS backend (LP64: 32-bit integers)
set_ilp64_backend
Set ILP64 BLAS backend (64-bit integers)

Type Aliases§

Dgemm64FnPtr
BLAS dgemm function pointer type (ILP64: 64-bit integers)
DgemmFnPtr
BLAS dgemm function pointer type (LP64: 32-bit integers)
Zgemm64FnPtr
BLAS zgemm function pointer type (ILP64: 64-bit integers)
ZgemmFnPtr
BLAS zgemm function pointer type (LP64: 32-bit integers)