Skip to content

workbench_algorithms.subroutines.trotterization

Qubricks for Trotterization.

TrotterStrategy

Bases: Protocol

Interface for applying unitary terms in Trotterization.

apply_trotter_terms

apply_trotter_terms(
    factor: int | float | complex,
    system: Qubits,
    reverse: bool = False,
    ctrl: Qubits | int = 0,
)

Method describing how to apply the terms in Trotterization, to be implemented in concrete implementations.

PauliSumTrotterStrategy

PauliSumTrotterStrategy(
    hamiltonian: PauliSum, trotter_order: int = None
)

Implementation of a TrotterStrategy for the simplest case of looping through Hamiltonian terms.

Parameters:

Name Type Description Default
hamiltonian PauliSum

PauliSum representation of the Hamiltonian to be Trotterized. The order of the terms in the PauliSum determines the order in which the Trotterized terms will be applied, with the coefficients determining their magnitude.

required
trotter_order int

The order of the Trotterization.

None

apply_trotter_terms

apply_trotter_terms(
    factor, system, reverse: bool = False, ctrl: int = 0
)

Apply all the terms in the Hamiltonian, numerically or symbolically.

TrotterQuery

TrotterQuery(
    trotter_strategy: TrotterStrategy | None = None,
    trotter_order: int | None = None,
    hamiltonian: PauliSum | None = None,
    **kwargs,
)

Bases: Qubrick

Qubrick for implementing a Suzuki-Trotter approximation of an exponentiated Hamiltonian.

Parameters:

Name Type Description Default
trotter_strategy TrotterStrategy | None

A class that implements a TrotterStrategy for applying Trotter terms.

None
trotter_order int

The order of Trotterization.

None
hamiltonian PauliSum

The Hamiltonian expressed as a PauliSum.

None
**kwargs dict[str, Any]

Other arguments to pass to the init.

{}

trotter_strategy property

trotter_strategy

Set the trotter_strategy property so it can't be modified.

compute

compute(
    system: Qubits,
    steps: int,
    evo_time: int,
    ctrl: Qubits | int = 0,
    trotter_order: int | None = None,
)

Execute the Suzuki-Trotter circuit.

Performs first and second order Trotterization directly. For higher orders, uses recursive calls to generate the appropriate product of operators.

Parameters:

Name Type Description Default
system Qubits

Qubits the Hamiltonian is acting on.

required
steps int

The number of Trotter steps.

required
evo_time int

(int): The total evolution time.

required
ctrl (Qubits, int)

Qubit register to control evolution on. Defaults to 0.

0
trotter_order int

The order of Trotterization. If not set, uses the Qubrick attribute self.trotter_order set at instantiation.

None