Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/kleene

crates/kleene-sparse/src/lib.rs

//! Sparse linear algebra over semirings, on Arrow buffers.
//!
//! | Part | Here |
//! |---|---|
//! | Values | any Arrow native type ([`Value`]); a structural matrix stores no values, each entry is the semiring's one |
//! | Semirings | [`Semiring`]: [`BoolOrAnd`], [`MinPlus`], [`PlusTimes`], [`BitsetUnion`] |
//! | Matrices | [`Csr`] (rows) and [`Csc`] (columns), built from Arrow `u64` offsets and `u32` indices with no copy, or from edge lists |
//! | Vectors and masks | [`Vector`] (sparse or dense), [`Mask`] (a bitset, complemented or not), [`MatrixMask`] |
//! | Operations | `mxv`, `vxm`, `mxm`, element-wise add and multiply, `reduce`, `select`, `transpose`, masked assignment, behind [`SparseBackend`] |
//! | SIMD | [`Simd`]: word kernels (popcount, or / and / and-not, folds) and row kernels ([`Simd::hash_rows`] with [`RowHash`], [`Simd::compact_bools`], [`Simd::bits_to_places`], [`Simd::select_range`]) on AVX2, AVX-512, NEON or scalar, chosen at run time, the same answer at every level |
//! | Backends | [`SparseBackend`] in Burn's backend style: a type with associated matrix, vector and mask primitives and its operations as associated functions; [`CpuBackend`] runs on every core with `std::thread::scope` |
//!
//! The crate depends on Arrow only (it is an upstream candidate for CubeCL, whose backend
//! comes later): no graph format, no query engine.

mod backend;
mod bitset;
mod cpu;
mod error;
mod matrix;
mod pool;
mod semiring;
mod simd;
mod vector;

pub use backend::SparseBackend;
pub use bitset::Bitset;
pub use cpu::{CpuBackend, CpuDevice, CpuWorkspace, MxmPlan, TransposePlan};
pub use error::SparseError;
pub use matrix::{Csc, Csr, MatrixMask, Pattern};
pub use pool::{Executor, atomic_u32s, atomic_words};
pub use semiring::{BitsetUnion, BoolOrAnd, MinPlus, Number, PlusTimes, Semiring, Value};
pub use simd::{KeyCol, RowHash, Simd, SimdLevel, prefetch_read};
pub use vector::{DenseView, Mask, Vector};

/// The result of a fallible operation of this crate.
pub type Result<T> = std::result::Result<T, SparseError>;

/// The README's example, run as a doctest.
#[cfg(doctest)]
#[doc = include_str!("../README.md")]
struct ReadmeDoctests;