EvolvedOperatorAnsatz
class qiskit.circuit.library.EvolvedOperatorAnsatz(operators=None, reps=1, evolution=None, insert_barriers=False, name='EvolvedOps', parameter_prefix='t', initial_state=None, flatten=None)
Bases: NLocal
The evolved operator ansatz.
Parameters
- operators (BaseOperator | QuantumCircuit |list | None) – The operators to evolve. If a circuit is passed, we assume it implements an already evolved operator and thus the circuit is not evolved again. Can be a single operator (circuit) or a list of operators (and circuits).
- reps (int) – The number of times to repeat the evolved operators.
- evolution (EvolutionBase | EvolutionSynthesis | None) – A specification of which evolution synthesis to use for the
PauliEvolutionGate
. Defaults to first order 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.
- initial_state (QuantumCircuit | None) – A
QuantumCircuit
object to prepend to the circuit. - flatten (bool | None) – Set this to
True
to output a flat circuit instead of nesting it inside multiple layers of gate objects. By default currently the contents of the output circuit will be wrapped in nested objects for cleaner visualization. However, if you’re using this circuit for anything besides visualization its strongly recommended to set this flag toTrue
to avoid a large performance overhead for parameter binding.
Attributes
evolution
The evolution converter used to compute the evolution.
Returns
The evolution converter used to compute the evolution.
Return type
num_qubits
Returns the number of qubits in this circuit.
Returns
The number of qubits.
operators
The operators that are evolved in this circuit.
Returns
The operators to be evolved (and circuits) contained in this ansatz.
Return type
preferred_init_points
Getter of preferred initial points based on the given initial state.
name
Type: str
A human-readable name for the circuit.
Example
from qiskit import QuantumCircuit
qc = QuantumCircuit(2, 2, name="my_circuit")
print(qc.name)
my_circuit