qdk_chemistry.data.unitary_representation.containers.pauli_product_formula module

QDK/Chemistry time evolution pauli product formula container module.

class qdk_chemistry.data.unitary_representation.containers.pauli_product_formula.ExponentiatedPauliTerm(pauli_term, angle)[source]

Bases: object

Dataclass for an exponentiated Pauli term.

A single exponential factor of the form \(e^{-i \theta P}\), where:
  • \(P\) is a Pauli string (e.g., \(X_0 Z_2\))

  • \(\theta\) is rotation angle

Parameters:
pauli_term: dict[int, str]

A dictionary mapping qubit indices to Pauli operators (‘X’, ‘Y’, ‘Z’).

angle: float

The rotation angle for the exponentiation.

__init__(pauli_term, angle)
Parameters:
Return type:

None

class qdk_chemistry.data.unitary_representation.containers.pauli_product_formula.PauliProductFormulaContainer(step_terms, step_reps, num_qubits, scale=1.0)[source]

Bases: UnitaryContainer

Dataclass for a Pauli product formula container.

A Pauli Product Formula decomposes a time-evolution operator \(U(t) = e^{-i H t}\), into a product of exponentials of Pauli strings. A single product-formula step is represented as \(U_{\mathrm{step}}(t) = \prod_{j \in \pi} e^{-i \theta_j P_j}\), where:

  • \(P_j\) is a Pauli string

  • \(\theta_j\) is the rotation angle for that term

  • \(\prod_{j \in \pi}\) is a permutation defining the multiplication order

The full time-evolution unitary is: \(U(t) \approx \left[ U_{\mathrm{step}}\!\left(\tfrac{t}{r}\right) \right]^{r}\), where step_reps = r is the number of repeated steps.

Parameters:
__init__(step_terms, step_reps, num_qubits, scale=1.0)[source]

Initialize a PauliProductFormulaContainer.

Parameters:
  • step_terms (list[ExponentiatedPauliTerm]) – The list of exponentiated Pauli terms in a single step.

  • step_reps (int) – The number of repetitions of the single step.

  • num_qubits (int) – The number of qubits the unitary acts on.

  • scale (float) – The evolution time used for eigenvalue-phase conversion.

Return type:

None

eigenvalue_from_phase(phase_fraction)[source]

Recover a Hamiltonian eigenvalue from a time-evolution phase.

Convert a measured phase fraction to energy using E = angle / t.

Return type:

float

Parameters:

phase_fraction (float) – Measured phase fraction \(\varphi \in [0, 1)\).

Returns:

The corresponding Hamiltonian eigenvalue.

Return type:

float

property type: str[source]

Get the type of the unitary container.

Returns:

The type of the unitary container.

property num_qubits: int[source]

Get the number of qubits the unitary acts on.

Returns:

The number of qubits.

reorder_terms(permutation)[source]

Reorder the Pauli terms according to a given permutation.

Return type:

PauliProductFormulaContainer

Parameters:

permutation (list[int]) – A list where permutation[i] gives the old index of the term that should be placed at position i in the reordered list.

Returns:

A new container with the updated ordering.

Return type:

PauliProductFormulaContainer

Note

permutation[i] is the old index for new position i. For example, permutation = [2, 0, 1] yields new_terms = [old_terms[2], old_terms[0], old_terms[1]].

combine(other_container, atol=1e-12)[source]

Combine two Trotter evolutions, merging adjacent identical Pauli terms.

The terms from self (repeated step_reps times) are followed by the terms from other_container (also repeated according to its step_reps). When two consecutive terms act with the same Pauli operator string (i.e., have identical pauli_term dictionaries), their rotation angles are summed into a single ExponentiatedPauliTerm. If the summed angle has magnitude less than atol, the resulting term is removed.

Return type:

PauliProductFormulaContainer

Parameters:
  • other_container (PauliProductFormulaContainer) – The second PauliProductFormulaContainer appended after this container.

  • atol – Absolute tolerance used when deciding whether a merged term with a small rotation angle should be dropped.

Returns:

A single PauliProductFormulaContainer representing the combined evolution with adjacent identical terms fused.

to_json()[source]

Convert the PauliProductFormulaContainer to a dictionary for JSON serialization.

Return type:

dict[str, Any]

Returns:

Dictionary representation of the PauliProductFormulaContainer

Return type:

dict

to_hdf5(group)[source]

Save the PauliProductFormulaContainer to an HDF5 group.

Return type:

None

Parameters:

group (h5py.Group) – HDF5 group or file to write data to

classmethod from_json(json_data)[source]

Create PauliProductFormulaContainer from a JSON dictionary.

Return type:

PauliProductFormulaContainer

Parameters:

json_data (dict[str, Any]) – Dictionary containing the serialized data

Returns:

PauliProductFormulaContainer

classmethod from_hdf5(group)[source]

Load an instance from an HDF5 group.

Return type:

PauliProductFormulaContainer

Parameters:

group (h5py.Group) – HDF5 group or file to read data from

Returns:

PauliProductFormulaContainer

get_summary()[source]

Get summary of PauliProductFormulaContainer.

Return type:

str

Returns:

Summary string describing the PauliProductFormulaContainer’s contents and properties

Return type:

str