qdk_chemistry.algorithms.state_preparation package

QDK/Chemistry state preparation algorithms module.

This module provides quantum state preparation algorithms for preparing quantum states from classical wavefunctions.

class qdk_chemistry.algorithms.state_preparation.SparseIsometryGF2XStatePreparation

Bases: StatePreparation

State preparation using sparse isometry with enhanced GF2+X elimination.

This class implements “GF2+X” state preparation for electronic structure problems using the gf2x_with_tracking function which performs smart preprocessing before GF2 Gaussian elimination. The preprocessing includes:

  1. Removing duplicate rows using CNOT operations

  2. Removing all-ones rows using X operations

  3. Then performing standard GF2 Gaussian elimination

  4. Apply the additional rank reduction if the reduced row-echelon matrix is diagonal

This enhanced approach can be more efficient than standard GF2 Gaussian elimination, particularly for matrices with duplicate rows or all-ones rows. The algorithm tracks both CNOT and X operations for proper circuit reconstruction.

The algorithm:

  1. Reads the wavefunction to get coefficients and bitstrings

  2. Converts bitstrings to a binary matrix

  3. Applies enhanced GF2+X elimination (duplicate removal + all-ones removal + GF2)

  4. Performs dense state preparation on the reduced space

  5. Applies recorded operations (both CNOT and X) in reverse order to expand back to full space

Key References:

  • Sparse isometry: Malvetti, Iten, and Colbeck (arXiv:2006.00016) [MIC21]

__init__()

Initialize the SparseIsometryGF2XStatePreparation.

name()

Return the name of the state preparation method.

Return type:

str

class qdk_chemistry.algorithms.state_preparation.StatePreparationFactory

Bases: AlgorithmFactory

Factory class for creating StatePreparation instances.

__init__()

Initialize the StatePreparationFactory.

algorithm_type_name()

Return the algorithm type name as state_prep.

Return type:

str

default_algorithm_name()

Return the sparse_isometry_gf2x as default algorithm name.

Return type:

str

class qdk_chemistry.algorithms.state_preparation.StatePreparationSettings

Bases: Settings

Settings for state preparation algorithms.

__init__()

Initialize the StatePreparationSettings.

Submodules