qdk_chemistry.algorithms.circuit_mapper package

QDK/Chemistry circuit mapper module.

class qdk_chemistry.algorithms.circuit_mapper.CircuitMapperFactory

Bases: AlgorithmFactory

Factory class for creating CircuitMapper instances.

algorithm_type_name()

Return circuit_mapper as the algorithm type name.

Return type:

str

default_algorithm_name()

Return pauli_sequence as the default algorithm name.

Return type:

str

class qdk_chemistry.algorithms.circuit_mapper.PSPMapper

Bases: CircuitMapper

Circuit mapper using the PREPARE-SELECT-PREPARE pattern.

Composes a block encoding from:

  1. PREPARE — amplitude-loading into the ancilla register, resolved via the prepare setting. Defaults to DensePureStatePreparation.

  2. SELECT — Pauli SELECT oracle applied on the system register, constructed directly from the block-encoding container’s SELECT data.

The two callables are stitched together by the Q# PrepSelPrep operation:

\[B[H] = \mathrm{PREPARE}^\dagger \cdot \mathrm{SELECT} \cdot \mathrm{PREPARE}\]

When the input is an LCUWalkContainer, the block encoding is additionally wrapped with the reflection operator to form a quantum walk:

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

Initialize the PSPMapper.

name()

Return the algorithm name.

Returns:

"prepare_select_prepare".

Return type:

str

type_name()

Return the algorithm type name.

Returns:

"circuit_mapper".

Return type:

str

resolve_lcu(container)

Unwrap a container into its LCU data and whether it is a quantum walk.

Parameters:

container (UnitaryContainer) – The container held by the unitary representation.

Return type:

tuple[LCUContainer, bool]

Returns:

The LCU data and whether the container is a quantum walk.

Raises:

ValueError – If the container is neither an LCU nor an LCU walk.

build_prepare_select_ops(container)

Return the PREPARE and SELECT Q# oracles and the system register size.

Parameters:

container (UnitaryContainer) – The container held by the unitary representation.

Return type:

tuple[Any, Any, int]

Returns:

The PREPARE Q# callable, the SELECT Q# callable, and the system register size.

class qdk_chemistry.algorithms.circuit_mapper.PSPMapperSettings

Bases: Settings

Settings for the PSPMapper.

prepare

Algorithm reference for the PREPARE oracle state preparation. Defaults to DensePureStatePreparation.

__init__()

Initialize the settings for PSPMapper.

class qdk_chemistry.algorithms.circuit_mapper.PauliSequenceMapper

Bases: CircuitMapper

Circuit mapper using Pauli product formula term sequences.

Given a unitary expressed as a Pauli product formula \(U \approx \left[ \prod_j e^{-i\theta_j P_j} \right]^{r}\), this mapper constructs a circuit for \(U\) using the following pattern:

  1. Each Pauli operator \(P_j\) is basis-rotated into the \(Z\) basis.

  2. Qubits involved in \(P_j\) are entangled into a sequence using CNOT gates.

  3. A \(R_z\) rotation implements

    \(e^{-i\,\theta_j\,P_j} \;\rightarrow\; R_z(2 \theta_j)\).

  4. The basis rotations and entangling operations are uncomputed.

Notes

  • Requires a PauliProductFormulaContainer for the unitary representation.

__init__()

Initialize the PauliSequenceMapper.

name()

Return the algorithm name.

Return type:

str

type_name()

Return circuit_mapper as the algorithm type name.

Return type:

str

class qdk_chemistry.algorithms.circuit_mapper.PauliSequenceMapperSettings

Bases: Settings

Settings for PauliSequenceMapper.

__init__()

Initialize PauliSequenceMapperSettings with default values.

Submodules