tangelo.toolboxes.unitary_generator package

Subpackages

Submodules

tangelo.toolboxes.unitary_generator.trotter_suzuki module

class tangelo.toolboxes.unitary_generator.trotter_suzuki.TrotterSuzukiUnitary(qubit_hamiltonian: QubitOperator, time: float = 1.0, trotter_order: int = 1, n_trotter_steps: int = 1, n_steps_method: str = 'time')

Bases: Unitary

Class that implements the Trotter-Suzuki time evolution.

build_circuit(n_steps: int, control: int = None, method: str = '')

Build and return the quantum circuit implementing the unitary evolution for n_steps.

Parameters:
  • n_steps (int) – The number of unitary evolution steps

  • control (Union[int, List[int]]) – The qubit or qubits to control with.

  • method (str) – The method used to apply the controlled operation for n_steps. “time” to not change the circuit size, less accurate “repeat” to repate the circuit n_steps

Returns:

Circuit – The circuit that implements the unitary evolution for n_steps with control.

qubit_indices()

Return the indices used by the algorithm to propagate the unitary.

Returns:
  • List[int] – State qubits

  • List[int] – Ancilla qubits

tangelo.toolboxes.unitary_generator.unitary module

This module defines the unitary abstract class, providing the foundation to implement unitary evolution circuits.

class tangelo.toolboxes.unitary_generator.unitary.Unitary

Bases: ABC

Base class for all Unitary circuit definitions. Derived/children classes wirtten by users and developers must implement the following abstract methods.

abstract build_circuit(n_steps: int, control: int = typing.Union[NoneType, int, typing.List[int]])

Build and return the quantum circuit implementing the unitary evolution for n_steps.

Parameters:
  • n_steps (int) – The number of unitary evolution steps with control

  • control(Union[int – The control qubit(s)

  • List[int]] – The control qubit(s)

Returns:

Circuit – The circuit that implements the unitary evolution for n_steps with control.

abstract qubit_indices()

Return the indices used by the algorithm to propagate the unitary.

Returns:
  • List[int] – State qubits

  • List[int] – Ancilla qubits

tangelo.toolboxes.unitary_generator.unitary_circuit module

class tangelo.toolboxes.unitary_generator.unitary_circuit.CircuitUnitary(circuit: Circuit, control_method: str = 'all')

Bases: Unitary

Class that implements the necessary methods for QPE given a Circuit that represents a Unitary.

add_controls(method: str = 'all', control: int | List[int] | None = None)

Adds control gates to the circuit :param method: Default “all” add controls to all gates. “variational” add controls to only gates marked is_variational :type method: str :param control: The qubit(s) to control the unitary circuit with. :type control: Union[int, List[int]]

build_circuit(n_steps: int, control: int | List[int] = None, method: str = '')

Build and return the quantum circuit implementing the unitary evolution for n_steps.

Parameters:
  • n_steps (int) – The number of unitary evolution steps

  • control (Union[int, List[int]]) – The control qubit(s) for the unitary evolution.

  • method (str) – “all” add controls to all gates. “variational” add controls to only gates marked is_variational

Returns:

Circuit – The circuit that implements the unitary evolution for n_steps with control.

qubit_indices()

Return the indices used by the algorithm to propagate the unitary.

Returns:
  • List[int] – State qubits

  • List[int] – Ancilla qubits

Module contents