View source on GitHub |
A method for performing a Trotter step.
Inherits From: TrotterStep
openfermion.circuits.trotter.algorithms.low_rank.LowRankTrotterStep(
hamiltonian: 'ops.InteractionOperator',
truncation_threshold: Optional[float] = 1e-08,
final_rank: Optional[int] = None,
spin_basis=True
) -> None
This class assumes that Hamiltonian evolution using a Trotter-Suzuki product formula is performed in the following steps:
1. Perform some preparatory operations (for instance, a basis change).
2. Perform a number of Trotter steps. Each Trotter step may induce a
permutation on the ordering in which qubits represent fermionic
modes.
3. Perform some finishing operations.
Attributes | |
---|---|
hamiltonian
|
The Hamiltonian being simulated. |
Methods
finish
finish(
qubits: Sequence[cirq.Qid],
n_steps: int,
control_qubit: Optional[cirq.Qid] = None,
omit_final_swaps: bool = False
) -> cirq.OP_TREE
Operations to perform after all Trotter steps are done.
Args | |
---|---|
qubits
|
The qubits on which to perform operations. |
hamiltonian
|
The Hamiltonian to simulate. |
n_steps
|
The total number of Trotter steps that have been performed. |
control_qubit
|
The control qubit, if the algorithm is controlled. |
omit_final_swaps
|
Whether or not to omit swap gates at the end of the circuit. |
prepare
prepare(
qubits: Sequence[cirq.Qid], control_qubit: Optional[cirq.Qid] = None
) -> cirq.OP_TREE
Operations to perform before doing the Trotter steps.
Args | |
---|---|
qubits
|
The qubits on which to perform operations. They should be sorted so that the j-th qubit in the Sequence holds the occupation of the j-th fermionic mode. |
hamiltonian
|
The Hamiltonian to simulate. |
control_qubit
|
The control qubit, if the algorithm is controlled. |
step_qubit_permutation
step_qubit_permutation(
qubits: Sequence[cirq.Qid], control_qubit: Optional[cirq.Qid] = None
) -> Tuple[Sequence[cirq.Qid], Optional[cirq.Qid]]
The qubit permutation induced by a single Trotter step.
Returns | |
---|---|
A tuple whose first element is the new list of system qubits and second element is the new control qubit |
trotter_step
@abc.abstractmethod
trotter_step( qubits: Sequence[cirq.Qid], time: float, control_qubit: Optional[cirq.Qid] = None ) -> cirq.OP_TREE
Yield operations to perform a Trotter step.
Args | |
---|---|
qubits
|
The qubits on which to apply the Trotter step. |
hamiltonian
|
The Hamiltonian to simulate. |
time
|
The evolution time. |
control_qubit
|
The control qubit, if the algorithm is controlled. |