py_alqorithms.apply_symmetrization_spins

py_alqorithms.apply_symmetrization_spins(algorithm, hamiltonian, trotterization_order, number_trottersteps, time)

Symmetrize a spin Hamiltonian.

The input hamiltonian is multiplied from left and right by PauliX on each of the system qubits (here, all of them). The circuit is then generated with this symmetrised hamiltonian, and before we append it to the input circuit we flip the system qubits (which are the symmetrised ones) using PauliX gates.

Parameters:
  • algorithm (string) -- Choice of algorithm

  • hamiltonian (PauliHamiltonian) -- The input mixed hamiltonian

  • trotterization_order (int) -- Trotterization order, either 1 or 2

  • number_trottersteps (int) -- The number of times to apply the Hamiltonian, which has been trotterised by the user

  • time (float) -- The time interval over which Hamiltonian is applied

Returns:

symmetrized circuit obtained from the input hamiltonian

Return type:

Circuit

Raises:
  • ValueError -- Error occured in the conversion of SpinAlgorithm or trotterization order

  • RuntimeError -- Error occured in symmetrization of hamiltonian