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
/*
* SPDX-License-Identifier: MIT
* Copyright (c) 2023 - 2026. The DeepCausality Authors and Contributors. All Rights Reserved.
*/
//! Memoization tables shared by the clique-picking counting recursion.
//!
//! Ported from the authoritative `cliquepicking_rs::memoization`, with one
//! deliberate deviation: the reference uses `BigUint::ZERO` as an
//! "uncomputed" sentinel inside plain `Vec<BigUint>`. Because this port is
//! generic over the count type `T` (which may legitimately take the value zero),
//! we instead use `Option<T>` — `None` means "not yet computed". This is both
//! cleaner and generic-safe.
//!
//! Three tables are kept:
//! * `count[subproblem]` — the per-subproblem AMO count (clique-tree flowers),
//! * `factorial[k]` — factorials `0! ..= n!`,
//! * `rho` — the rho recurrence keyed by its forbidden-size argument vector.
use RealField;
use FromPrimitive;
use HashMap;
/// Memoization state for one `count_amos` invocation, parameterized by the count
/// type `T`.
pub