| Crates.io | bola |
| lib.rs | bola |
| version | 0.1.2 |
| created_at | 2025-10-16 12:06:00.543665+00 |
| updated_at | 2025-10-20 14:17:38.440585+00 |
| description | A lightweight native rust linear algebra library. |
| homepage | |
| repository | https://github.com/alexlovric/bola |
| max_upload_size | |
| id | 1885861 |
| size | 144,024 |
BOLA is a native Rust linear algebra backend inspired by BLAS/LAPACK. The purpose of this project is to provide a drop in replacement for many of BLAS/LAPACK functions with minimal dependency overhead and small binary size, ideal for embedded systems.
The library currently provides the following key functions:
SIMD Accelerated as well as Rayon parallelised.
Cross-Platform Support: Bola is written in stable Rust and has been tested on the following architectures:
...
use blast::gemm::gemm;
let m = 128;
let n = 128;
let k = 128;
let lda = m;
let ldb = k;
let ldc = m;
let mut rng = rand::rng();
let a: Vec<f64> = (0..(m * k)).map(|_| rng.random()).collect();
let b: Vec<f64> = (0..(k * n)).map(|_| rng.random()).collect();
let c_init: Vec<f64> = (0..(m * n)).map(|_| rng.random()).collect();
let mut my_c = c_init.clone();
unsafe {
gemm(
'N', 'N', m, n, k, 1.0, a.as_ptr(),
lda, b.as_ptr(), ldb, 1.0, my_c.as_mut_ptr(), ldc
);
}
...
Comparisons run on a computer with Intel i5-14600K × 20 and 64GB RAM. Sizes of the matrices are 1024x1024, 2048x2048 and 4096x4096.
The general matrix-matrix multiplication function is compared against MatrixMultiply and CBLAS. MatrixMultiply with threading feature enabled. The average time in milliseconds is shown.
| Size | BOLA (ms) | MatrixMultiply (ms) | CBLAS (ms) |
|---|---|---|---|
| 1024 | 4.8205 | 8.7194 | 5.4872 |
| 2048 | 38.331 | 70.590 | 40.052 |
| 4096 | 334.57 | 570.56 | 290.42 |
The LU factorisation function is compared against Lapack. The average time in milliseconds is shown.
| Size | BOLA (ms) | Lapack (ms) |
|---|---|---|
| 1024 | 6.7720 | 5.8331 |
| 2048 | 29.677 | 32.966 |
| 4096 | 186.47 | 132.73 |
MIT License - See LICENSE for details.
If you'd like to support the project consider: