1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! # 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.
/// 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).
pub const RAYON_CHANNEL_THRESHOLD: usize = 16;
// ── Phase 1: parallelism foundation ──────────────────────────────────────────
// ── Phase 2: the number tower ────────────────────────────────────────────────
// (enabled incrementally as each module lands)
pub use ;
pub use ;
pub use RnsBatch;
pub use ;
pub use ;
pub use RnsRational;
pub use ;
pub use ;
pub use ;