Skip to main content

Crate sim_lib_discrete_algebra

Crate sim_lib_discrete_algebra 

Source
Expand description

Discrete algebra spine.

This crate hosts the Semiring trait, the standard semiring instances, and a generic dense / coordinate-list sparse matrix with power and Kleene-closure engines. Graph reachability and all-pairs shortest paths are derived from these (boolean closure, min-plus closure, counting powers) rather than re-implemented per algorithm.

Boundary: depends only on thiserror (and later num-bigint). It must never depend on sim-lib-rank or any music crate.

Re-exports§

pub use boolean::BoolRing;
pub use cookbook::SemiringMatrixDemo;
pub use cookbook::semiring_matrix_demo;
pub use counting::Counting;
pub use error::AlgebraError;
pub use gf2::Gf2;
pub use matrix::AlgebraLimits;
pub use matrix::Matrix;
pub use real::RealF64;
pub use semiring::Semiring;
pub use sparse::SparseEntry;
pub use sparse::SparseMatrix;
pub use tropical_max::MaxPlus;
pub use tropical_min::MinPlus;
pub use views::DiagonalView;
pub use views::IdentityView;
pub use views::PermutationView;

Modules§

boolean
The boolean semiring (OR, AND). Closure gives transitive reachability.
closure
Kleene closure A* = I + A + A^2 + ... over a closed semiring.
cookbook
Deterministic cookbook builders for discrete algebra recipes.
counting
The counting semiring over BigUint. Powers count walks; closure counts paths in a nilpotent (acyclic) setting.
error
Error type for the discrete algebra spine.
gf2
The two-element field GF(2): add is XOR, mul is AND. Used for linear algebra over Z/2 (rank, coding theory).
matrix
Generic dense matrix over a Semiring, with semiring matrix multiply.
power
Matrix power by square-and-multiply. A^k[i][j] over the counting semiring counts walks of length k; over min-plus it bounds k-edge shortest paths.
real
The real semiring over f64 with ordinary + and *, plus a total order for algorithms that need to compare entries. No star (left as default).
semiring
The Semiring trait: the algebraic core of the discrete-math family.
sparse
Coordinate-list sparse matrix over a Semiring.
tropical_max
The bounded max-plus (tropical) semiring.
tropical_min
The bounded min-plus (tropical) semiring.
views
Implicit matrix views that act without materializing dense storage.

Statics§

RECIPES
Cookbook recipes for this lib, embedded at build time.