qdk_chemistry.data.unitary_representation.containers.quantum_walk module

QDK/Chemistry quantum walk operator container module.

class qdk_chemistry.data.unitary_representation.containers.quantum_walk.LCUWalkContainer(block_encoding, power=1, scale=1.0)[source]

Bases: QuantumWalkContainer

Quantum walk operator wrapping an LCU block encoding.

Represents:

\[W^k = \left[(2|0\rangle\langle 0| - I) \cdot \text{PREPARE}^\dagger \cdot \text{SELECT} \cdot \text{PREPARE}\right]^k\]

This container stores a reference to the underlying LCUContainer and exposes all block-encoding data through it.

Parameters:
__init__(block_encoding, power=1, scale=1.0)[source]

Initialize an LCUWalkContainer.

Parameters:
  • block_encoding (BlockEncodingContainer) – The block encoding container to wrap with a reflection.

  • power (int) – Number of times to apply the walk operator (for \(W^k\) in QPE).

  • scale (float) – The 1-norm used for eigenvalue-phase conversion.

Return type:

None

property block_encoding: BlockEncodingContainer[source]

Get the underlying block encoding container.

Returns:

The LCU block encoding that this walk operator wraps.

property power: int[source]

Number of times to apply the walk operator.

Returns:

The power value.

Return type:

int

property num_qubits: int[source]

Total number of qubits (same as the block encoding).

Returns:

The combined qubit count.

Return type:

int

property type: str[source]

Get the type of the unitary container.

Returns:

The type string "lcu_walk".

Return type:

str

to_json()[source]

Save the LCUWalkContainer to a JSON-serializable dictionary.

Return type:

dict[str, Any]

Returns:

Dictionary representation including container type, power,

and nested block encoding.

Return type:

dict[str, Any]

to_hdf5(group)[source]

Save the LCUWalkContainer to an HDF5 group.

Return type:

None

Parameters:

group (h5py.Group) – HDF5 group to write container data to.

classmethod from_json(json_data)[source]

Create an LCUWalkContainer from a JSON dictionary.

Return type:

LCUWalkContainer

Parameters:

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

Returns:

The deserialized instance.

Return type:

LCUWalkContainer

classmethod from_hdf5(group)[source]

Load an LCUWalkContainer from an HDF5 group.

Return type:

LCUWalkContainer

Parameters:

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

Returns:

The deserialized instance.

Return type:

LCUWalkContainer

get_summary()[source]

Get a human-readable summary of the walk operator container.

Return type:

str

Returns:

Multi-line summary describing the walk operator and its block encoding.

Return type:

str

class qdk_chemistry.data.unitary_representation.containers.quantum_walk.QuantumWalkContainer[source]

Bases: UnitaryContainer

Abstract base class for quantum walk operator containers.

A quantum walk operator is defined as:

\[W = (2|0\rangle\langle 0| - I) \cdot B[H]\]

where \(B[H]\) is a block encoding of the Hamiltonian. The eigenvalues of \(W\) are \(e^{\pm i \arccos(E_k / \lambda)}\), enabling eigenvalue extraction via quantum phase estimation.

eigenvalue_from_phase(phase_fraction)[source]

Recover a Hamiltonian eigenvalue from a quantum-walk phase.

For a walk operator whose eigenvalues are \(e^{\pm i \arccos(E_k / \lambda)}\), QPE measures \(\varphi = \arccos(E_k / \lambda) / (2\pi)\). Inverting gives:

\[E_k = \lambda \cos(2\pi\varphi)\]
Parameters:

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

Returns:

The corresponding Hamiltonian eigenvalue.

Return type:

float

Return type:

float

abstract property power: int[source]

Number of times to apply the walk operator.