oxiblas
Unified API for OxiBLAS - Pure Rust BLAS/LAPACK implementation
Overview
oxiblas is the meta-crate that re-exports all OxiBLAS functionality through a unified, convenient API. This is the recommended way to use OxiBLAS for most users.
Features
- Complete BLAS - Level 1, 2, 3 operations
- Extensive LAPACK - LU, QR, SVD, Cholesky, EVD, and more
- Sparse matrices - 9 formats with iterative solvers
- Tensor operations - Einstein summation, batched operations
- Extended precision - f16, f128 support
- High performance - 80-172% of OpenBLAS depending on operation
- Pure Rust - No C dependencies, easy cross-compilation
Quick Start
[]
= "0.2"
# With all features
= { = "0.2", = ["full"] }
Usage
Matrix Operations
use *;
// Create matrices
let a = from_rows;
let b = from_rows;
// Matrix multiplication
let mut c = zeros;
gemm;
// c = [[58, 64], [139, 154]]
Linear Algebra
use *;
let a = from_rows;
// LU decomposition
let lu = compute?;
let det = lu.determinant;
let inv = lu.inverse?;
// QR decomposition
let qr = compute?;
let q = qr.q;
let r = qr.r;
// SVD
let svd = compute?;
let singular_values = svd.singular_values;
// Solve Ax = b
let b = vec!;
let x = lu.solve?;
Sparse Matrices
use *;
// Create sparse matrix
let mut coo = new;
coo.push;
coo.push;
// ... add more elements
let csr = from_coo;
// Solve sparse system with GMRES
let b = vec!;
let result = gmres?;
Tensor Operations
use *;
// Einstein summation
let c = einsum?;
// Batched matrix multiplication
let a_batch = from_data;
let b_batch = from_data;
let c_batch = batched_matmul?;
Module Structure
The oxiblas crate re-exports from these sub-crates:
| Module | Re-exported from | Description |
|---|---|---|
oxiblas::core |
oxiblas-core |
Core traits, SIMD, scalar types |
oxiblas::matrix |
oxiblas-matrix |
Matrix types and views |
oxiblas::blas |
oxiblas-blas |
BLAS operations |
oxiblas::lapack |
oxiblas-lapack |
LAPACK decompositions |
oxiblas::sparse |
oxiblas-sparse |
Sparse matrices and solvers |
oxiblas::ndarray |
oxiblas-ndarray |
ndarray integration (optional) |
oxiblas-ffi |
RETIRED (v0.2.1) - C FFI bindings |
Prelude
The oxiblas::prelude module provides convenient imports:
use *;
// Now you have access to:
// - Mat, MatRef, MatMut (matrix types)
// - gemm, gemv, dot, axpy, etc. (BLAS operations)
// - Lu, Qr, Svd, Cholesky, etc. (LAPACK decompositions)
// - CsrMatrix, CooMatrix, etc. (sparse matrices)
// - gmres, cg, bicgstab, etc. (sparse solvers)
Feature Flags
| Feature | Description | Default |
|---|---|---|
default |
Core functionality (f32, f64, complex) | ✓ |
parallel |
Rayon-based parallelization | |
f16 |
Half-precision (16-bit) floating point | |
f128 |
Quad-precision (~31 digits) | |
sparse |
Sparse matrix operations | ✓ |
ndarray |
ndarray integration | |
ffi |
C FFI bindings | |
full |
All features enabled | |
nightly |
Nightly-only optimizations |
Examples
# Minimal (dense matrices only)
= "0.2"
# With parallelization
= { = "0.2", = ["parallel"] }
# With extended precision
= { = "0.2", = ["f16", "f128"] }
# With ndarray support
= { = "0.2", = ["ndarray"] }
# All features
= { = "0.2", = ["full"] }
Examples
The repository includes comprehensive examples:
# Basic BLAS operations
# LAPACK decompositions
# Extended precision
# Tensor operations
# Sparse matrices
Performance
OxiBLAS provides competitive performance with industry-standard libraries:
macOS M3 (Apple Silicon)
| Operation | OxiBLAS | OpenBLAS | Ratio |
|---|---|---|---|
| DGEMM 1024×1024 | 40.25 ms | 40.54 ms | 101% |
| SGEMM 1024×1024 | 19.18 ms | 32.94 ms | 172% |
| DOT 1M elements | 167 µs | 279 µs | 165% |
Linux x86_64 (Intel Xeon)
| Operation | OxiBLAS | OpenBLAS | Ratio |
|---|---|---|---|
| DGEMM 1024×1024 | 80.68 ms | 82.51 ms | 102% |
| SGEMM 64×64 | 16.60 µs | 18.64 µs | 112% |
| DGEMM 256×256 | 1.220 ms | 1.159 ms | 95% |
Summary: OxiBLAS achieves 80-172% of OpenBLAS performance across different platforms and operations.
Documentation
- Main README - Project overview and features
- API Documentation - Complete API reference
- Examples - Usage examples
- Benchmarks README - Performance benchmarking guide
Sub-Crate Documentation
For more detailed documentation on specific components:
- oxiblas-core - Core traits and SIMD
- oxiblas-matrix - Matrix types
- oxiblas-blas - BLAS operations
- oxiblas-lapack - LAPACK decompositions
- oxiblas-sparse - Sparse matrices
- oxiblas-ndarray - ndarray integration
- oxiblas-benchmarks - Benchmarking suite
Ecosystem
OxiBLAS is part of the SciRS2 scientific computing ecosystem:
- SciRS2 - Scientific computing library
- NumRS2 - Numerical computing
- SkleaRS - Machine learning
- ToRSh - Tensor operations
- TrustformeRS - Transformers
- QuantRS2 - Quantum computing framework
- OxiRS - Semantic Web platform
Requirements
- Rust: 1.85+ (Edition 2024)
- No external C dependencies
- Supported platforms: x86_64, AArch64 (Linux, macOS, Windows)
License
Licensed under the Apache License, Version 2.0. See LICENSE for details.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Citation
If you use OxiBLAS in your research, please cite: