qdk_chemistry.data.unitary_representation.containers.base module

QDK/Chemistry unitary container base module.

class qdk_chemistry.data.unitary_representation.containers.base.UnitaryContainer[source]

Bases: DataClass

Abstract class for a unitary container.

abstract property type: str[source]

Get the type of the unitary container.

Returns:

The type of the unitary container.

abstract property num_qubits: int[source]

Get the number of qubits the unitary acts on.

Returns:

The number of qubits.

abstractmethod to_json()[source]

Convert the UnitaryContainer to a dictionary for JSON serialization.

Return type:

dict[str, Any]

Returns:

Dictionary representation of the UnitaryContainer

Return type:

dict

abstractmethod to_hdf5(group)[source]

Save the UnitaryContainer to an HDF5 group.

Return type:

None

Parameters:

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

abstractmethod classmethod from_json(json_data)[source]

Create UnitaryContainer from a JSON dictionary.

Return type:

UnitaryContainer

Parameters:

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

Returns:

UnitaryContainer

abstractmethod classmethod from_hdf5(group)[source]

Load an instance from an HDF5 group.

Return type:

UnitaryContainer

Parameters:

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

Returns:

UnitaryContainer

abstractmethod get_summary()[source]

Get summary of unitary container.

Return type:

str

Returns:

Summary string describing the UnitaryContainer’s contents and properties

Return type:

str

abstractmethod eigenvalue_from_phase(phase_fraction)[source]

Recover a Hamiltonian eigenvalue from the measured phase fraction.

Each unitary encoding maps Hamiltonian eigenvalues to phases on the unit circle. This method inverts that mapping so that a measured phase fraction \(\varphi \in [0, 1)\) is converted back to the corresponding eigenvalue \(E\).

Return type:

float

Parameters:

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

Returns:

The corresponding Hamiltonian eigenvalue.

Return type:

float

abstractmethod combine(other)[source]

Combine this container with another to represent sequential application.

Return type:

UnitaryContainer

Parameters:

other (UnitaryContainer) – The container to append after this one.

Returns:

A new container representing the combined evolution.