MergeOrbitalRotations¶
- class MergeOrbitalRotations¶
Bases:
GenericPass[DAGCircuit,DAGCircuit]A transpilation pass merging runs of consecutive orbital rotations into a single one.
Two
OrbitalRotationgates applied back-to-back on the same modes compose into a single orbital rotation whoserotation_unitaryis the matrix product of the two. This pass detects maximal runs of such consecutive rotations in aFermionicDAGCircuitand rewrites each into oneOrbitalRotation, so the synthesis stage lowers a single (still square) decomposition instead of one per gate in the run.A “run” is a maximal chain of
OrbitalRotationnodes acting on the same mode set with nothing else intervening on those wires. Following theOrbitalRotationconvention \(a^\dagger_i \mapsto \sum_j U_{ji} a^\dagger_j\), applying a rotation \(U_1\) and then a rotation \(U_2\) maps \(a^\dagger_i \mapsto \sum_j (U_2 U_1)_{ji} a^\dagger_j\), so the run’s rotations are multiplied in circuit order (later rotation on the left) to form the mergedrotation_unitary. Because the merged gate implements exactly that composed basis change, the rewrite leaves the simulated state vector unchanged.Only rotations on the identical mode set are merged: two rotations on different (even overlapping) mode sets, or rotations separated by any other operation on a shared wire, break the run and are left untouched. This is the shape produced, e.g., by two adjacent per-spin rotations on the same spin half, or by consecutive
UCJlayers whose trailing and leading orbital rotations meet on the same modes.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
Methods
- run(dag)¶
Runs this transpilation pass.
Collects every maximal run of consecutive
OrbitalRotationgates on the same modes and replaces each run of length two or more with a singleOrbitalRotationwhoserotation_unitaryis the run’s rotations multiplied in circuit order. Runs of a single rotation (and all other nodes) are left untouched. The input DAG is modified in place.- 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.
- 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: