MergeSlaterDeterminantPreparation¶
- class MergeSlaterDeterminantPreparation¶
Bases:
GenericPass[DAGCircuit,DAGCircuit]A transpilation pass fusing an initialization and rotation into a Slater determinant prep.
An
InitializeModesimmediately followed by anOrbitalRotationprepares 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 aFermionicDAGCircuitand rewrites it into a singlePrepareSlaterDeterminantgate, which a later synthesis stage can lower with the reduced-gate-countgivens_decomposition_slater()(viaGivensDecompositionSlaterDeterminantSynthesis) 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..norbare the alpha sector,norb..2*norbthe 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.
See also
The Slater determinant preparation guide walks through each of these patterns with before/after circuit drawings.
“Immediately followed” is understood over the DAG: an
OrbitalRotationnode fuses only when theInitializeModesis 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 anOrbitalRotationwith no precedingInitializeModes– is left untouched.Important
Run this pass after
MergeOrbitalRotations. The fusion contracts a singleOrbitalRotationimmediately following theInitializeModes. 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 aPrepareSlaterDeterminantbut leaves the remaining rotations of the run as separate trailingOrbitalRotationgates, which synthesize with their full (phase-carrying) square decomposition. RunningMergeOrbitalRotationsfirst collapses the whole run into one rotation, so this pass can then contract the entire run into a singlePrepareSlaterDeterminantand 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.Caution
This is an early development prototype. Beware of changes to its interface without warning during the pre-release development of this package.
See also
PrepareSlaterDeterminant,InitializeModes,OrbitalRotation,MergeOrbitalRotations, andGivensDecompositionSlaterDeterminantSynthesis.Methods
- run(dag)¶
Runs this transpilation pass.
Walks the input DAG in topological order, rewriting each matched
InitializeModes-then-OrbitalRotationpattern intoPrepareSlaterDeterminantgate(s) and copying every other node through unchanged.- Parameters:
dag (DAGCircuit) – the input circuit with fermion-based instructions. Only
DAGOpNodewithFermionicGateinstances as theiropare 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(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]
- 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: