qiskit-documentation/docs/api/qiskit/0.29/qiskit.aqua.operators.evolu...

54 lines
6.9 KiB
Plaintext

---
title: evolutions (v0.29)
description: API reference for qiskit.aqua.operators.evolutions in qiskit v0.29
in_page_toc_min_heading_level: 2
python_api_type: module
python_api_name: qiskit.aqua.operators.evolutions
---
<span id="module-qiskit.aqua.operators.evolutions" />
<span id="qiskit-aqua-operators-evolutions" />
<span id="operator-evolutions-qiskit-aqua-operators-evolutions" />
# Operator Evolutions
`qiskit.aqua.operators.evolutions`
Evolutions are converters which traverse an Operator tree, replacing any [`EvolvedOp`](qiskit.aqua.operators.evolutions.EvolvedOp "qiskit.aqua.operators.evolutions.EvolvedOp") e with a Schrodinger equation-style evolution [`CircuitOp`](qiskit.aqua.operators.primitive_ops.CircuitOp "qiskit.aqua.operators.primitive_ops.CircuitOp") equalling or approximating the matrix exponential of -i \* the Operator contained inside (e.primitive). The Evolutions are essentially implementations of Hamiltonian Simulation algorithms, including various methods for Trotterization.
The [`EvolvedOp`](qiskit.aqua.operators.evolutions.EvolvedOp "qiskit.aqua.operators.evolutions.EvolvedOp") is simply a placeholder signifying that the Operator inside it should be converted to its exponential by the Evolution converter. All Operators (not [`state_fns`](qiskit.aqua.operators.state_fns#module-qiskit.aqua.operators.state_fns "qiskit.aqua.operators.state_fns")) have `.exp_i()` methods which either return the exponential of the Operator directly, or an [`EvolvedOp`](qiskit.aqua.operators.evolutions.EvolvedOp "qiskit.aqua.operators.evolutions.EvolvedOp") containing the Operator.
<Admonition title="Note" type="note">
Evolutions work with parameterized Operator coefficients, so `my_expectation.convert((t * H).exp_i())`, where t is a scalar or Terra Parameter and H is an Operator, will produce a [`CircuitOp`](qiskit.aqua.operators.primitive_ops.CircuitOp "qiskit.aqua.operators.primitive_ops.CircuitOp") equivalent to e^iHt.
</Admonition>
# Evolution Base Class
The EvolutionBase class gives an interface for algorithms to ask for Evolutions as execution settings. For example, if an algorithm contains an Operator evolution step within it, such as [`QAOA`](qiskit.aqua.algorithms.QAOA "qiskit.aqua.algorithms.QAOA"), the algorithm can give the opportunity for the user to pass an EvolutionBase of their choice to be used in that evolution step.
| | |
| ------------------------------------------------------------------------------------------------------------------ | -------------------------------- |
| [`EvolutionBase`](qiskit.aqua.operators.evolutions.EvolutionBase "qiskit.aqua.operators.evolutions.EvolutionBase") | A base for Evolution converters. |
# Evolutions
| | |
| ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`EvolutionFactory`](qiskit.aqua.operators.evolutions.EvolutionFactory "qiskit.aqua.operators.evolutions.EvolutionFactory") | A factory class for convenient automatic selection of an Evolution algorithm based on the Operator to be converted. |
| [`EvolvedOp`](qiskit.aqua.operators.evolutions.EvolvedOp "qiskit.aqua.operators.evolutions.EvolvedOp") | Class for wrapping Operator Evolutions for compilation (`convert`) by an EvolutionBase method later, essentially acting as a placeholder. |
| [`MatrixEvolution`](qiskit.aqua.operators.evolutions.MatrixEvolution "qiskit.aqua.operators.evolutions.MatrixEvolution") | Performs Evolution by classical matrix exponentiation, constructing a circuit with `UnitaryGates` or `HamiltonianGates` containing the exponentiation of the Operator. |
| [`PauliTrotterEvolution`](qiskit.aqua.operators.evolutions.PauliTrotterEvolution "qiskit.aqua.operators.evolutions.PauliTrotterEvolution") | An Evolution algorithm replacing exponentiated sums of Paulis by changing them each to the Z basis, rotating with an rZ, changing back, and trotterizing. |
# Trotterizations
| | |
| ------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`TrotterizationBase`](qiskit.aqua.operators.evolutions.TrotterizationBase "qiskit.aqua.operators.evolutions.TrotterizationBase") | A base for Trotterization methods, algorithms for approximating exponentiations of operator sums by compositions of exponentiations. |
| [`TrotterizationFactory`](qiskit.aqua.operators.evolutions.TrotterizationFactory "qiskit.aqua.operators.evolutions.TrotterizationFactory") | A factory for conveniently creating TrotterizationBase instances. |
| [`Trotter`](qiskit.aqua.operators.evolutions.Trotter "qiskit.aqua.operators.evolutions.Trotter") | Simple Trotter expansion, composing the evolution circuits of each Operator in the sum together `reps` times and dividing the evolution time of each by `reps`. |
| [`Suzuki`](qiskit.aqua.operators.evolutions.Suzuki "qiskit.aqua.operators.evolutions.Suzuki") | Suzuki Trotter expansion, composing the evolution circuits of each Operator in the sum together by a recursive “bookends” strategy, repeating the whole composed circuit `reps` times. |
| [`QDrift`](qiskit.aqua.operators.evolutions.QDrift "qiskit.aqua.operators.evolutions.QDrift") | The QDrift Trotterization method, which selects each each term in the Trotterization randomly, with a probability proportional to its weight. |