GivensDecompositionSlaterDeterminantSynthesis¶
- class GivensDecompositionSlaterDeterminantSynthesis(*, minimize_2q_gate_count=False)¶
Bases:
objectA
F2QSynthesisPluginfor transpilingPrepareSlaterDeterminant.This plugin exploits the known reference occupation to synthesize the gate with the rectangular
givens_decomposition_slater(): only the \(m\) occupied orbitals of the rotation need be realized, so at most \(m (n - m)\)XXPlusYYGaterotations are emitted (versus the \(n (n - 1) / 2\) brick-wall plus \(n\) phase gates thatGivensDecompositionOrbitalRotationSynthesiswould use for the fullOrbitalRotation). The reduced decomposition carries no diagonal phases – a global phase and any rotation within the occupied space leave the prepared Slater determinant unchanged – so the state is prepared correct up to a global phase.Note
givens_decomposition_slater()is defined against a fixed leading-\(m\) reference (the first \(m\) modes occupied). The emittedXGates therefore seed the leading modes of the decomposed block, not the qubits pointed to byoccupation– the Givens sweep then transports the occupation onto the physical target orbitals. The positions ofoccupation’s occupied modes enter only through which columns ofrotation_unitaryare selected (rotation_unitary[:, occupied]); their count \(m\) determines the reference. The final prepared state is correct for any occupation, contiguous or not.Note
Optionally (when
minimize_2q_gate_countis set; it is off by default – see the caution below) occupied orbitals that are basis vectors on a mode disjoint from every other occupied orbital are peeled off before the decomposition: theirXGateis placed directly on the target mode and they are excluded from the Givens sweep. This avoids the chain of bareSWAPs (XXPlusYYGatewithc = 0) that the leading-reference sweep would otherwise emit to transport such an orbital out to its mode. Only the genuinely-mixing remainder is then decomposed; when the whole occupied space is a signed permutation every orbital peels and noXXPlusYYGateis emitted at all.A peeled mode may sit between the physical endpoints of a sweep rotation, making that
XXPlusYYGateact on physically non-adjacent qubits. Because a peeled mode is an occupied unit-orbital, the Jordan-Wigner Z-string it would contribute is folded back into the sign of theXXPlusYYGatephase when an odd number of peeled modes lies strictly between the endpoints, so the prepared state stays correct regardless of how the peeled modes interleave the mixing space.Note
The occupied space (the genuinely-mixing remainder that survives peeling, when
minimize_2q_gate_countis set; the full occupied space otherwise) is further partitioned into disjoint-support blocks, each synthesized on its own contiguous mode window. When it splits into several mixing clusters separated by empty (or peeled) modes, this drops the bareSWAPs (XXPlusYYGatewithc = 0) the single leading-reference sweep would otherwise emit to transport occupation across the gaps between clusters. A single mixing cluster spanning all kept modes is one block and reproduces the plain leading-reference sweep exactly. This block splitting runs regardless ofminimize_2q_gate_count.Caution
The unit-orbital peeling above trades circuit metrics: it minimizes the emitted two-qubit gate count (replacing a swept orbital by a direct
XGate), but only under free (all-to-all) connectivity. On a constrained coupling map it can increase the two-qubit gate depth after routing – peeling occupied modes that the leading-reference sweep would have used as nearest-neighbor stepping-stones can strand the residual mixing orbital across a wide, physically non-adjacent window (a single long-rangeXXPlusYYGatethat routing must then bridge with manySWAPs). The full leading-reference sweep instead keeps every emitted rotation nearest-neighbor along the mode order – more two-qubit gates, but no routing overhead. The two are a genuine, non-dominated trade-off (neither ever beats the other on both metrics), so which is preferable depends on the target: minimizing two-qubit depth generally matters more than raw gate count, both on hardware and in simulation, so peeling is off by default. Enable it viaminimize_2q_gate_countwhen raw gate count is the bottleneck (e.g. richly-connected hardware). Both settings prepare the same state (up to a global phase).Warning
This transpilation pass plugin makes the following assumptions:
an occupation-basis encoding (like Jordan-Wigner)
a trivial fermion-to-qubit layout (i.e. no change in their register lengths)
a 1-to-1 mapping of fermionic mode indices to qubit indices
Initializing this plugin can be done with the arguments listed below.
- Parameters:
minimize_2q_gate_count (bool) – which of two equivalent syntheses to emit, selected by the circuit metric to optimize. When
False(the default), the full leading-reference Givens sweep is used: every emitted two-qubit rotation is nearest-neighbor along the mode order, minimizing the post-routing two-qubit depth on a constrained coupling map at the cost of more two-qubit gates. WhenTrue, disjoint unit-orbitals (occupied orbitals that are basis vectors on a mode disjoint from all other occupied orbitals) are peeled out of the decomposition and realized with a directXGate, minimizing the two-qubit gate count but potentially emitting long-range rotations that inflate the routed depth (see the caution in the class docstring). Both settings prepare the same state (up to a global phase); the default favors depth because it generally matters more than gate count, both on hardware and in simulation.
Attributes
- minimize_2q_gate_count¶
Whether to peel disjoint unit-orbitals to minimize the two-qubit gate count (see
__init__). WhenFalse(default), the nearest-neighbor leading-reference sweep is used instead, minimizing the routed two-qubit depth.
Methods
- run(in_node, out_dag, *, f2q_layout)¶
Runs this transpilation plugin.
- Parameters:
in_node (DAGOpNode) – the input fermion-based circuit instruction. When this plugin gets called, the
in_node.opattribute must be of typePrepareSlaterDeterminant.out_dag (DAGCircuit) – the output qubit-based circuit.
f2q_layout (dict[QuantumRegister, QuantumRegister]) – the global transpilation
F2QLayoutsetting.
- Return type:
None
See also
The documentation of
F2QSynthesisPluginfor more detailed explanations of the arguments.- Raises:
NotImplementedError – when
in_nodeacts on fermionic modes that are spread across multipleFermionicRegisterinstances.- Parameters:
in_node (DAGOpNode)
out_dag (DAGCircuit)
f2q_layout (dict[QuantumRegister, QuantumRegister])
- Return type:
None