pdft.circuit.compile_circuit

pdft.circuit.compile_circuit#

pdft.circuit.compile_circuit(gates, m, n, *, inverse)[source]#

Build a JIT-compiled stepped circuit closure.

Returns (code, tensors) where code(*tensors, pic_reshaped) applies the gates one at a time via jnp.tensordot(), recycling contraction labels across steps so the 52-character a-zA-Z label pool of the legacy single-einsum path is never reached. Each step consumes at most ~22 wire labels regardless of circuit size.

The returned tensors list preserves the Hadamard-first sort applied by the legacy builder, so saved trained checkpoints (which serialize tensors in this order) continue to load consistently.

Parameters:
Return type:

tuple[Callable[[…], Array], list[Array]]