evolved_operator_ansatz
class qiskit.circuit.library.evolved_operator_ansatz(operators, reps=1, evolution=None, insert_barriers=False, name='EvolvedOps', parameter_prefix='t', remove_identities=True, flatten=None)
Bases:
Construct an ansatz out of operator evolutions.
For a set of operators and repetitions (reps
), this circuit is defined as
where the exponentials are expanded using the product formula specified by evolution
.
Examples
from qiskit.circuit.library import evolved_operator_ansatz
from qiskit.quantum_info import Pauli
ops = [Pauli("ZZI"), Pauli("IZZ"), Pauli("IXI")]
ansatz = evolved_operator_ansatz(ops, reps=3, insert_barriers=True)
ansatz.draw("mpl")
Parameters
- operators (BaseOperator | Sequence[BaseOperator]) – The operators to evolve. Can be a single operator or a sequence thereof.
- reps (int) – The number of times to repeat the evolved operators.
- evolution (EvolutionSynthesis | None) – A specification of which evolution synthesis to use for the
PauliEvolutionGate
. Defaults to first order Trotterization. Note, that operators of typeOperator
are evolved using theHamiltonianGate
, as there are no Hamiltonian terms to expand in Trotterization. - insert_barriers (bool) – Whether to insert barriers in between each evolution.
- name (str) – The name of the circuit.
- parameter_prefix (str | Sequence[str]) – Set the names of the circuit parameters. If a string, the same prefix will be used for each parameters. Can also be a list to specify a prefix per operator.
- remove_identities (bool) – If
True
, ignore identity operators (note that we do not checkOperator
inputs). This will also remove parameters associated with identities. - flatten (bool | None) – If
True
, a flat circuit is returned instead of nesting it inside multiple layers of gate objects. Setting this toFalse
is significantly less performant, especially for parameter binding, but can be desirable for a cleaner visualization.
Return type
Was this page helpful?
Report a bug or request content on GitHub.