qdk_chemistry.plugins.qiskit.conversion module

Conversion utilities for QDK Chemistry to Qiskit interoperability.

This module provides functions to convert QDK Chemistry objects into Qiskit-compatible representations, particularly for quantum circuit simulation and state preparation.

qdk_chemistry.plugins.qiskit.conversion.create_statevector_from_wavefunction(wavefunction, normalize=True)[source]

Create a Qiskit-compatible statevector from a QDK Chemistry wavefunction.

This function converts a QDK Chemistry wavefunction into a dense statevector representation suitable for use with Qiskit quantum circuit simulators.

The encoding uses a little-endian qubit ordering convention where each spatial orbital is mapped to two qubits (one for alpha spin, one for beta spin): - Lower qubits (0 to num_orbitals-1): alpha spin orbitals - Upper qubits (num_orbitals to 2*num_orbitals-1): beta spin orbitals

Each determinant in the wavefunction is mapped to its corresponding basis state index, and the wavefunction coefficient is placed at that index in the statevector.

Return type:

ndarray

Parameters:
  • wavefunction (Wavefunction) – The wavefunction to convert to statevector representation. Must have a defined active space with the same number of alpha and beta orbitals.

  • normalize (bool) – Whether to normalize the resulting statevector to unit norm. Default is True.

Returns:

Dense complex statevector of size 2^(2*num_active_orbitals).

The dtype is always complex128, even if the wavefunction has real coefficients.

Return type:

numpy.ndarray

Examples

>>> from qiskit.quantum_info import Statevector
>>> # Assuming we have a wavefunction already
>>> sv_array = create_statevector_from_wavefunction(wavefunction)
>>> qiskit_sv = Statevector(sv_array)
>>> print(f"Statevector dimension: {len(sv_array)}")