MergeOrbitalRotations
class MergeOrbitalRotations
Bases: GenericPass[DAGCircuit, DAGCircuit]
A transpilation pass merging runs of consecutive orbital rotations into a single one.
Two OrbitalRotation gates applied back-to-back on the same modes compose into a single orbital rotation whose rotation_unitary is the matrix product of the two. This pass detects maximal runs of such consecutive rotations in a FermionicDAGCircuit and rewrites each into one OrbitalRotation, 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 OrbitalRotation nodes acting on the same mode set with nothing else intervening on those wires. Following the OrbitalRotation convention , applying a rotation and then a rotation maps , so the run’s rotations are multiplied in circuit order (later rotation on the left) to form the merged rotation_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 UCJ layers whose trailing and leading orbital rotations meet on the same modes.
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.
Collects every maximal run of consecutive OrbitalRotation gates on the same modes and replaces each run of length two or more with a single OrbitalRotation whose rotation_unitary is 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 DAGOpNode with FermionicGate instances as their op are supported.
Returns
The output circuit which is still acting on a fermionic 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