amari_tropical/
lib.rs

1//! Tropical (max-plus) algebra for efficient LLM operations
2//!
3//! Tropical algebra replaces traditional (+, ×) with (max, +), which converts
4//! expensive softmax operations into simple max operations. This is particularly
5//! useful for finding most likely sequences and optimization in neural networks.
6
7#![cfg_attr(not(feature = "std"), no_std)]
8
9extern crate alloc;
10
11// Import precision types from amari-core
12#[cfg(feature = "high-precision")]
13pub use amari_core::HighPrecisionFloat;
14pub use amari_core::{ExtendedFloat, PrecisionFloat, StandardFloat};
15
16// Core tropical algebra types
17pub mod types;
18
19// Domain modules
20pub mod error;
21pub mod polytope;
22pub mod viterbi;
23
24#[cfg(feature = "phantom-types")]
25pub mod verified;
26
27#[cfg(feature = "contracts")]
28pub mod verified_contracts;
29
30// Re-export error types
31pub use error::{TropicalError, TropicalResult};
32
33// Re-export core types
34pub use types::{StandardTropical, TropicalMatrix, TropicalMultivector, TropicalNumber};
35
36#[cfg(feature = "high-precision")]
37pub use types::ExtendedTropical;
38
39// Re-export GPU functionality when available