excitation_preserving
class qiskit.circuit.library.excitation_preserving(num_qubits, mode='iswap', entanglement='full', reps=3, skip_unentangled_qubits=False, skip_final_rotation_layer=False, parameter_prefix='θ', insert_barriers=False, name='ExcitationPreserving')
Bases:
The heuristic excitation-preserving wave function ansatz.
The excitation_preserving
circuit preserves the ratio of , and states. To this end, this circuit uses two-qubit interactions of the form
for the mode "fsim"
or with for the mode "iswap"
.
Note that other wave functions, such as UCC-ansatzes, are also excitation preserving. However these can become complex quickly, while this heuristically motivated circuit follows a simpler pattern.
This trial wave function consists of layers of rotations with 2-qubit entanglements. The entangling is creating using rotations and optionally a controlled-phase gate for the mode "fsim"
.
Examples
With linear entanglement, this circuit is given by:
from qiskit.circuit.library import excitation_preserving
ansatz = excitation_preserving(3, reps=1, insert_barriers=True, entanglement="linear")
ansatz.draw("mpl")
The entanglement structure can be explicitly specified with the entanglement
argument. The "fsim"
mode includes an additional parameterized CPhaseGate
in each block:
ansatz = excitation_preserving(3, reps=1, mode="fsim", entanglement=[[0, 2]])
ansatz.draw("mpl")
Parameters
- num_qubits (int) – The number of qubits.
- mode (str) – Choose the entangler mode, can be “iswap” or “fsim”.
- reps (int) – Specifies how often the structure of a rotation layer followed by an entanglement layer is repeated.
- entanglement (BlockEntanglement | Iterable[BlockEntanglement] | Callable[[int], BlockEntanglement | Iterable[BlockEntanglement]]) – The indices specifying on which qubits the input blocks act. See
n_local()
for detailed information. - skip_final_rotation_layer (bool) – Whether a final rotation layer is added to the circuit.
- skip_unentangled_qubits (bool) – If
True
, the rotation gates act only on qubits that are entangled. IfFalse
, the rotation gates act on all qubits. - parameter_prefix (str) – The name of the free parameters.
- insert_barriers (bool) – If True, barriers are inserted in between each layer. If False, no barriers are inserted.
- name (str) – The name of the circuit.
Returns
An excitation-preserving circuit.