quairkit.ansatz.trotter¶
- class quairkit.ansatz.trotter.TrotterLayer(hamiltonian, qubits_idx, tau, num_steps, order, name)¶
Add time-evolving circuits to a user-specified circuit.
This circuit could approximate the time-evolving operator of a system given its Hamiltonian H, i.e., \(U_{\rm cir}~ e^{-iHt}\).
- Parameters:¶
- hamiltonian : Hamiltonian¶
Hamiltonian of the system whose time evolution is to be simulated.
- qubits_idx : List[int]¶
Indices of the qubits on which the layer is applied.
- tau : float¶
Evolution time of each trotter block.
- num_steps : int¶
Number of trotter blocks that will be added in total, where
num_steps * tau
should be the total evolution time.- order : int¶
Order of the Trotter-Suzuki decomposition.
- name : str¶
Name of the Hamiltonian. Defaults to ‘H’.
- Raises:¶
ValueError – The order of the trotter-suzuki decomposition should be either 1, 2 or 2k (k an integer)
ValueError – The number of qubits_idx must be bigger than the number of qubits in the Hamiltonian
ValueError – Grouping method
grouping
is not supported, valid key words: ‘xyz’, ‘even_odd’ValueError – The method
method
is not supported, valid method keywords: ‘suzuki’, ‘custom’
- property fidelity : float¶
The fidelity of the Trotterization.
- add_n_pauli_gate(theta, pauli_word, which_qubits)¶
Add a rotation gate for a tensor product of Pauli operators, for example \(e^{-\theta/2 * X \otimes I \otimes X \otimes Y}\).