| Crates.io | oxiblas |
| lib.rs | oxiblas |
| version | 0.1.2 |
| created_at | 2025-12-27 22:44:36.799557+00 |
| updated_at | 2025-12-29 21:06:15.157834+00 |
| description | OxiBLAS - Pure Rust BLAS/LAPACK implementation for the scirs2 ecosystem |
| homepage | |
| repository | https://github.com/cool-japan/oxiblas |
| max_upload_size | |
| id | 2007963 |
| size | 231,960 |
Unified API for OxiBLAS - Pure Rust BLAS/LAPACK implementation
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.
[dependencies]
oxiblas = "0.1"
# With all features
oxiblas = { version = "0.1", features = ["full"] }
use oxiblas::prelude::*;
// Create matrices
let a = Mat::from_rows(&[
&[1.0, 2.0, 3.0],
&[4.0, 5.0, 6.0],
]);
let b = Mat::from_rows(&[
&[7.0, 8.0],
&[9.0, 10.0],
&[11.0, 12.0],
]);
// Matrix multiplication
let mut c = Mat::zeros(2, 2);
gemm(1.0, a.as_ref(), b.as_ref(), 0.0, c.as_mut());
// c = [[58, 64], [139, 154]]
use oxiblas::prelude::*;
let a = Mat::from_rows(&[
&[2.0, 1.0, 1.0],
&[4.0, 3.0, 3.0],
&[8.0, 7.0, 9.0],
]);
// LU decomposition
let lu = Lu::compute(a.as_ref())?;
let det = lu.determinant();
let inv = lu.inverse()?;
// QR decomposition
let qr = Qr::compute(a.as_ref())?;
let q = qr.q();
let r = qr.r();
// SVD
let svd = Svd::compute(a.as_ref())?;
let singular_values = svd.singular_values();
// Solve Ax = b
let b = vec![4.0, 10.0, 24.0];
let x = lu.solve(&b)?;
use oxiblas::prelude::*;
// Create sparse matrix
let mut coo = CooMatrix::<f64>::new(1000, 1000);
coo.push(0, 0, 4.0);
coo.push(0, 1, -1.0);
// ... add more elements
let csr = CsrMatrix::from_coo(&coo);
// Solve sparse system with GMRES
let b = vec![/*...*/];
let result = gmres(&csr, &b, 1e-10, 100, 30, None)?;
use oxiblas::prelude::*;
// Einstein summation
let c = einsum("ij,jk->ik", &a, &[m, n], Some((&b, &[n, k])))?;
// Batched matrix multiplication
let a_batch = Tensor3::from_data(data_a, batch, m, k);
let b_batch = Tensor3::from_data(data_b, batch, k, n);
let c_batch = batched_matmul(&a_batch, &b_batch)?;
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 |
oxiblas-ffi |
C FFI bindings (optional) |
The oxiblas::prelude module provides convenient imports:
use oxiblas::prelude::*;
// 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 | 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 |
# Minimal (dense matrices only)
oxiblas = "0.1"
# With parallelization
oxiblas = { version = "0.1", features = ["parallel"] }
# With extended precision
oxiblas = { version = "0.1", features = ["f16", "f128"] }
# With ndarray support
oxiblas = { version = "0.1", features = ["ndarray"] }
# All features
oxiblas = { version = "0.1", features = ["full"] }
The repository includes comprehensive examples:
# Basic BLAS operations
cargo run --example basic_blas
# LAPACK decompositions
cargo run --example lapack_decompositions
# Extended precision
cargo run --example extended_precision --features f128
# Tensor operations
cargo run --example tensor_operations
# Sparse matrices
cargo run --example sparse_matrices --features parallel
OxiBLAS provides competitive performance with industry-standard libraries:
| 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% |
| 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.
For more detailed documentation on specific components:
OxiBLAS is part of the SciRS2 scientific computing ecosystem:
Licensed under either of:
at your option.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
If you use OxiBLAS in your research, please cite:
@software{oxiblas2025,
author = {OxiBLAS Contributors},
title = {OxiBLAS: Pure Rust BLAS/LAPACK Implementation},
year = {2025},
url = {https://github.com/cool-japan/oxiblas}
}