Expand description
§adele-ring — exact multi-base arithmetic engine
adele-ring represents numbers across multiple prime channels using the
Residue Number System (RNS). Because the channels are mutually independent
(no carry propagation), arithmetic is embarrassingly parallel and maps onto
both CPU threads (rayon) and GPU threads (wgpu).
On top of the RNS substrate sits a number tower that keeps every value at the cheapest exact level it can:
| Level | Set | Type |
|---|---|---|
| 0 | ℤ | rns::RnsInt |
| 1 | ℚ | rational::RnsRational |
| 2 | ℚ̄ | algebraic::AlgebraicNumber |
| 3 | ℝ_c | computable::ComputableReal |
| 4 | 𝒮 | symbolic::SymbolicExpr |
The crate name uses a hyphen (adele-ring) but the Rust path uses an
underscore (adele_ring), per Rust’s identifier rules.
Re-exports§
pub use algebraic::AlgebraicNumber;pub use algebraic::Polynomial;pub use backend::executor;pub use backend::ArithmeticBackend;pub use backend::Executor;pub use batch::RnsBatch;pub use computable::Computable;pub use computable::ComputableReal;pub use dispatch::DispatchPlan;pub use dispatch::Dispatcher;pub use rational::RnsRational;pub use rns::garner_crt;pub use rns::Channels;pub use rns::RnsInt;pub use symbolic::IdentityGraph;pub use symbolic::SymbolicExpr;pub use tower::TowerLevel;pub use tower::TowerValue;
Modules§
- algebraic
- Level 2 — ℚ̄. Exact algebraic numbers as (minimal polynomial, isolating interval) pairs.
- backend
- The
ArithmeticBackendtrait and theExecutorthat selects between CPU and GPU at runtime. All batch math in the crate flows through the Executor — it never hard-codes a backend. - batch
RnsBatch— the single flat buffer format shared by both backends.- computable
- Level 3 — ℝ_c. Computable reals: numbers stored as algorithms that produce a rational approximation to any requested precision, rather than as digits.
- cpu
CpuBackend— the always-available backend, using rayon to parallelize over batch items (and, for single values, over channels above a threshold).- dispatch
- Base-aware ALU dispatcher.
- gpu
GpuBackend— wgpu compute-shader implementation ofArithmeticBackend.- primes
- Prime utilities, factorization, and channel (base) selection.
- rational
- Level 1 — ℚ. Exact rational arithmetic over the RNS substrate.
- rns
- Level 0 — ℤ. RNS integers and the core CRT reconstruction.
- symbolic
- Level 4 — 𝒮. Symbolic expression trees and an identity graph.
- tower
- The number tower router. Every value carries a
TowerLevel; operations try to stay at the lowest (cheapest) level they can, dropping down when a result simplifies (e.g. √2·√2 = 2) and rising only when forced.
Constants§
- RAYON_
CHANNEL_ THRESHOLD - Channel-count threshold above which single-value operations parallelize over channels with rayon. Below it, sequential is faster (task overhead ~50ns vs channel op ~1ns: break-even around 8–16 channels).