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:
DataClassAbstract 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.
- abstractmethod to_hdf5(group)[source]
Save the UnitaryContainer to an HDF5 group.
- Return type:
- 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.
- abstractmethod classmethod from_hdf5(group)[source]
Load an instance from an HDF5 group.
- Return type:
- Parameters:
group (h5py.Group) – HDF5 group or file to read data from
- Returns:
UnitaryContainer
- 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\).
- abstractmethod combine(other)[source]
Combine this container with another to represent sequential application.
- Return type:
- Parameters:
other (UnitaryContainer) – The container to append after this one.
- Returns:
A new container representing the combined evolution.