MergeSlaterDeterminantPreparation
class MergeSlaterDeterminantPreparation
Bases: GenericPass[DAGCircuit, DAGCircuit]
A transpilation pass fusing an initialization and rotation into a Slater determinant prep.
An InitializeModes immediately followed by an OrbitalRotation prepares a Slater determinant: the modes start in the reference occupation and are then rotated into the target single-particle basis. This pass detects that pattern in a FermionicDAGCircuit and rewrites it into a single PrepareSlaterDeterminant gate, which a later synthesis stage can lower with the reduced-gate-count givens_decomposition_slater() (via GivensDecompositionSlaterDeterminantSynthesis) rather than the full square orbital rotation.
The rewrite is state-preserving: it only unlocks the cheaper synthesis and leaves the prepared state unchanged (see the validate-then-rotate semantics of PrepareSlaterDeterminant).
Three patterns are recognized, all keyed off the block-spin mode convention (modes 0..norb are the alpha sector, norb..2*norb the beta sector):
- Full-register / spinless – an
InitializeModeson a mode set immediately followed by anOrbitalRotationon the same mode set fuses into onePrepareSlaterDeterminant. - Per-sector – the same shape as pattern 1 but on a single spin half; it fuses into one
PrepareSlaterDeterminantper sector. - Global init + per-spin rotations – a full-register (
2*norb)InitializeModesimmediately followed by anOrbitalRotationon either or both contiguous spin halves (in either order) splits the occupation per sector and emits twoPrepareSlaterDeterminantgates. A half that has no rotation is prepared with an identity rotation, which synthesizes to only the reference X gates – exactly what theInitializeModeswould have emitted for that half anyway – so padding it costs no extra gates while still unlocking the reduced Slater synthesis on the rotated half. This is the shape produced by placing anInitializeModes(e.g.InitializeModes.from_hartree_fock()) at the front of a circuit and appending a decomposedUCJ, whose first per-spin rotations directly follow the initialization.
The Slater determinant preparation guide walks through each of these patterns with before/after circuit drawings.
“Immediately followed” is understood over the DAG: an OrbitalRotation node fuses only when the InitializeModes is its sole predecessor across all of its modes, i.e. no other operation intervenes on those wires. Any arrangement not matching one of the three shapes above – non-adjacent gates, mismatched mode sets, or an OrbitalRotation with no preceding InitializeModes – is left untouched.
Run this pass after MergeOrbitalRotations. The fusion contracts a single OrbitalRotation immediately following the InitializeModes. Faced with an initialization followed by a run of two or more consecutive rotations, this pass only sees the first rotation immediately following the initialization – it fuses that one into a PrepareSlaterDeterminant but leaves the remaining rotations of the run as separate trailing OrbitalRotation gates, which synthesize with their full (phase-carrying) square decomposition. Running MergeOrbitalRotations first collapses the whole run into one rotation, so this pass can then contract the entire run into a single PrepareSlaterDeterminant and the cheaper Slater synthesis covers all of it. The preset Jordan-Wigner pipeline (generate_preset_jw_pass_manager()) wires the two passes in this order.
This is an early development prototype. Beware of changes to its interface without warning during the pre-release development of this package.
Methods
run
run(dag)
Runs this transpilation pass.
Walks the input DAG in topological order, rewriting each matched InitializeModes-then-OrbitalRotation pattern into PrepareSlaterDeterminant gate(s) and copying every other node through unchanged.
Parameters
dag (DAGCircuit) – the input circuit with fermion-based instructions. Only DAGOpNode with FermionicGate instances as their op are supported.
Returns
The output circuit which is still acting on a fermionic register.
Raises
NotImplementedError – when the provided input circuit has more than a single register.
Return type
Inherited Methods
execute
execute(passmanager_ir, state, callback=None)
Execute optimization task for input Qiskit IR.
Parameters
- passmanager_ir (IR) – Qiskit IR to optimize.
- state (PassManagerState) – State associated with workflow execution by the pass manager itself.
- callback (Callable[[Task, IR_OUT, PropertySet, float, int], None] | None) – A callback function which is called per execution of optimization task.
Returns
Optimized Qiskit IR and state of the workflow.
Return type
tuple[IR_OUT, PassManagerState]
name
update_status
update_status(state, run_state)
Update workflow status.
Parameters
- state (PassManagerState) – Pass manager state to update.
- run_state (RunState) – Completion status of current task.
Returns
Updated pass manager state.
Return type