Skip to content

adapter

quiverlab.engine.adapter

Bridge between quiverlab's domain-generic Algebra and the hanlab engine.

The engine computes over prime fields F_p with numpy int64 structure constants. to_engine converts a quiverlab Algebra over GF(p) (PrimeField); every other domain is refused loudly (spec: the fast engine is a GF(p) accelerator, the pure bar path serves all fields).

engine_cohomology_dims

engine_cohomology_dims(A, top, max_cells=4000000)

HH^0..HH^top dimensions over GF(p) via the engine, as a plain list[int].

Guards the exponential bar-basis size against max_cells with the same semantics as the pure bar oracle (coboundary d^n: C^n -> C^{n+1}).

Source code in src/quiverlab/engine/adapter.py
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
def engine_cohomology_dims(A, top, max_cells=4_000_000):
    """HH^0..HH^top dimensions over GF(p) via the engine, as a plain list[int].

    Guards the exponential bar-basis size against max_cells with the same
    semantics as the pure bar oracle (coboundary d^n: C^n -> C^{n+1})."""
    from quiverlab.engine.scan3 import hochschild_cohomology_dims
    m = A.dim
    # Field check first: an explicit engine='fast' on a non-prime field must
    # raise FieldError (from to_engine) before the size _guard can raise
    # DepthLimitError -- the field is the hard refusal, the depth is advisory.
    E = to_engine(A.unit_adapted())
    _guard(m, [(f"d^{n}", m * (m - 1) ** (n + 1), m * (m - 1) ** n)
               for n in range(top + 1)], "coboundary", max_cells)
    p = A.domain.p
    out = hochschild_cohomology_dims(E, top, primes=(p,))
    return [int(d) for d in out[p]]

engine_homology_dims

engine_homology_dims(A, top, max_cells=4000000)

HH_0..HH_top dimensions over GF(p) via the engine, as a plain list[int].

Guards the exponential bar-basis size against max_cells with the same semantics as the pure bar oracle (boundary b_n: C_n -> C_{n-1}).

Source code in src/quiverlab/engine/adapter.py
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
def engine_homology_dims(A, top, max_cells=4_000_000):
    """HH_0..HH_top dimensions over GF(p) via the engine, as a plain list[int].

    Guards the exponential bar-basis size against max_cells with the same
    semantics as the pure bar oracle (boundary b_n: C_n -> C_{n-1})."""
    from quiverlab.engine.hh_engine import hochschild_homology_dims
    m = A.dim
    # Field check first (see engine_cohomology_dims): FieldError precedes the
    # advisory DepthLimitError so engine='fast' on a non-prime field is refused
    # for the right reason regardless of top.
    E = to_engine(A.unit_adapted())
    _guard(m, [(f"b_{n}", m * (m - 1) ** (n - 1), m * (m - 1) ** n)
               for n in range(1, top + 2)], "boundary", max_cells)
    p = A.domain.p
    out = hochschild_homology_dims(E, top, primes=(p,))
    return [int(d) for d in out[p]]