qdk_chemistry.data.unitary_representation.containers.block_encoding module
QDK/Chemistry block encoding container module.
- class qdk_chemistry.data.unitary_representation.containers.block_encoding.BlockEncodingContainer[source]
Bases:
UnitaryContainerAbstract base class for block encoding containers.
- class qdk_chemistry.data.unitary_representation.containers.block_encoding.ControlledOperation(ctrl_state, operation)[source]
Bases:
objectA single controlled unitary operation in the SELECT oracle.
- to_hdf5(group)[source]
Save the ControlledOperation to an HDF5 group.
- Parameters:
group (
Group) – HDF5 group to write attributes to.- Return type:
- class qdk_chemistry.data.unitary_representation.containers.block_encoding.LCUContainer(prepare, select, power=1)[source]
Bases:
BlockEncodingContainerContainer for a Linear Combination of Unitaries (LCU) decomposition.
Stores the pre-computed PREPARE and SELECT sub-objects that define a block-encoding circuit. This container is agnostic to the specific method used to compute these objects — that logic lives in the builder.
\[W = \text{PREPARE}^\dagger \cdot \text{SELECT} \cdot \text{PREPARE}\]- Parameters:
prepare (Wavefunction)
select (Select)
power (int)
- static data_type_name()[source]
Return the wire-format identifier for LCU containers.
- Return type:
- Returns:
"lcu_container".
- __init__(prepare, select, power=1)[source]
Initialize an LCUContainer.
- Parameters:
prepare (
Wavefunction) – The prepare wavefunction encoding coefficients for the block encoded Hamiltonian.select (
Select) – The select oracle for controlled operations.power (
int) – Number of times to apply the block encoding (for B[H]^power).
- Return type:
None
- property power: int[source]
Number of times to apply the block encoding.
- Returns:
The power value.
- Return type:
- property num_prepare_ancillas: int[source]
Number of qubits in the prepare ancillary register.
Derived from the orbital basis size of the prepare wavefunction.
- Returns:
The ancilla qubit count.
- Return type:
- property num_qubits: int[source]
Total number of qubits (system + ancilla).
- Returns:
The combined qubit count.
- Return type:
- property type: str[source]
Get the type of the unitary container.
- Returns:
The type string
"lcu".- Return type:
- to_hdf5(group)[source]
Save the LCUContainer to an HDF5 group.
- Parameters:
group (
Group) – HDF5 group to write container data to.- Return type:
- classmethod from_json(json_data)[source]
Create an LCUContainer from a JSON dictionary.
- classmethod from_hdf5(group)[source]
Load an LCUContainer from an HDF5 group.
- Parameters:
group (
Group) – HDF5 group to read container data from.- Returns:
The deserialized instance.
- Return type:
- get_summary()[source]
Get a human-readable summary of the LCU container.
- Returns:
Multi-line summary describing power, prepare, and select settings.
- Return type:
- eigenvalue_from_phase(phase_fraction)[source]
Not applicable for a raw block encoding.
A plain block encoding does not define an eigenvalue-phase relationship on its own. Use
LCUWalkContainerfor QPE with qubitization.- Raises:
NotImplementedError – Always.
- Return type:
- Parameters:
phase_fraction (float)
- class qdk_chemistry.data.unitary_representation.containers.block_encoding.Select(controlled_operations, phases, num_prepare_ancillas, num_target_qubits, prepare_qubits, target_qubits)[source]
Bases:
objectClass representing the SELECT oracle for block encoding.
- Parameters:
- to_hdf5(group)[source]
Save the Select oracle to an HDF5 group.
- Parameters:
group (
Group) – HDF5 group to write phases, attributes, and controlled operations to.- Return type:
- classmethod from_hdf5(group)[source]
Load a Select oracle from an HDF5 group.
- Parameters:
group (
Group) – HDF5 group to read phases, attributes, and controlled operations from.- Returns:
The deserialized instance.
- Return type:
- __init__(controlled_operations, phases, num_prepare_ancillas, num_target_qubits, prepare_qubits, target_qubits)