Skip to main content

Crate adele_ring

Crate adele_ring 

Source
Expand description

§adele-ring — exact multi-base arithmetic engine

adele-ring carries every number at two kinds of place at once. The finite places (an adaptive residue-number system over a prime Basis) do all the real arithmetic: carry-free, local, embarrassingly parallel across CPU lanes and GPU threads, and free of big-integer work. The infinite place (a rigorous real interval, Ball) answers every question the prime channels constitutionally cannot — sign, comparison, magnitude, and decimal output — by refining on demand. Exactness is recovered by reconstructing from the finite places, with the basis grown to exactly the height the computation provably needs (bounds), so a result can never silently exceed its range. Big integers appear only at that reconstruction boundary, for an instant, on numbers as large as the answer’s own information content — the product formula reminding us that what we save among the primes we pay, once, at infinity.

This pairing is the Adelic carrier, the data-structure form of 𝔸_ℚ = ℝ × ∏′_p ℚ_p. On top of the RNS substrate sits a number tower that keeps every value at the cheapest exact level it can.

On top of the RNS substrate sits a number tower that keeps every value at the cheapest exact level it can:

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 adelic::Adelic;
pub use adelic::AdelicInt;
pub use adelic::AdelicRat;
pub use adelic::Finite;
pub use adelic::RnsFrac;
pub use algebraic::AlgebraicNumber;
pub use algebraic::Polynomial;
pub use backend::executor;
pub use backend::ArithmeticBackend;
pub use backend::Executor;
pub use ball::Ball;
pub use basis::Basis;
pub use batch::RnsBatch;
pub use bounds::determinant_bits;
pub use bounds::mignotte_bits;
pub use bounds::resultant_bits;
pub use computable::Computable;
pub use computable::ComputableReal;
pub use dispatch::DispatchPlan;
pub use dispatch::Dispatcher;
pub use error::BasisError;
pub use error::ChannelMismatch;
pub use error::GpuError;
pub use error::RangeError;
pub use rational::RnsRational;
pub use reconstruct::rational_reconstruct;
pub use rns::crt_balanced;
pub use rns::garner_crt;
pub use rns::RnsInt;
pub use symbolic::IdentityGraph;
pub use symbolic::SymbolicExpr;
pub use tower::TowerLevel;
pub use tower::TowerValue;

Modules§

adelic
The adelic carrier — a value living at both kinds of place at once.
algebraic
Level 2 — ℚ̄. Exact algebraic numbers as (minimal polynomial, isolating interval) pairs.
backend
The ArithmeticBackend trait and the Executor that selects between CPU and GPU at runtime. All batch math in the crate flows through the Executor — it never hard-codes a backend.
ball
The Archimedean (infinite) place, made into a type.
basis
Adaptive multimodular basis.
batch
RnsBatch — the single flat buffer format shared by both backends.
bounds
A-priori height bounds (in bits) used to provision an adaptive crate::basis::Basis.
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 analyzer and multimodular basis provisioner.
error
Crate-wide error types.
gpu
GpuBackend — wgpu compute-shader implementation of ArithmeticBackend.
primes
Prime utilities, factorization, and channel (base) selection.
rational
Level 1 — ℚ. Exact rational arithmetic over the RNS substrate.
reconstruct
Rational reconstruction — turns the original engine’s worst failure mode (silent aliasing mod M) into a clean, checkable event.
rns
Level 0 — ℤ. RNS integers over the adaptive Basis, and Garner CRT.
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).