This repository is a Rust workspace providing:
sparse-ir— core Rust implementation of the sparse intermediate representation (IR) and related numerical tools.sparse-ir-capi— C-compatible API built on top ofsparse-ir(shared library + C header).fortran— Fortran bindings for the C API.
From the workspace root:
cargo build # build all crates in debug mode
cargo build --release # optimized buildThe default build uses the pure-Rust faer backend for matrix–matrix products used in fitting and evaluation routines.
Faer is reasonably fast, but usually considerably slower than an optimized BLAS implementation.
To enable system BLAS (LP64) for the Rust sparse-ir crate at compile time, use:
cargo build -p sparse-ir --features system-blasOptional BLAS backends (e.g. Accelerate, OpenBLAS/CBLAS) can be injected at runtime via function pointers when using the C API or the internal GEMM dispatcher.
Run unit and integration tests:
cargo test --all-targetsSome doc tests that depend on external BLAS backends are marked as ignore and are not executed by default.
Check that versions in Cargo.toml and sparse-ir-capi/Cargo.toml are consistent:
python3 check_version.pyThis script verifies that the workspace version matches the pkg-config version in the C API configuration.
To build the C-compatible shared library and header:
cargo build -p sparse-ir-capi --releaseThe generated library and the public header live under sparse-ir-capi/ and can be linked from C, C++, Fortran, or other languages that can call C ABIs.
For details on the Fortran interface and build instructions, see:
fortran/README.md
This workspace is dual-licensed under the terms of the MIT license and the Apache License (Version 2.0).
- You may use the code in this repository under the terms of either license, at your option:
Some components incorporate third-party code under Apache-2.0, such as the col_piv_qr module in the sparse-ir crate, which is based on nalgebra.
See sparse-ir/README.md and LICENSE-APACHE for details.