Configuration recovery (qiskit_addon_sqd.configuration_recovery
)¶
Functions for performing self-consistent configuration recovery.
- post_select_by_hamming_weight(bitstring_matrix, *, hamming_right, hamming_left)[source]¶
Post-select bitstrings based on the hamming weight of each half.
- Parameters:
- Returns:
A mask signifying which samples (rows) were selected from the input matrix.
- Return type:
- recover_configurations(bitstring_matrix, probabilities, avg_occupancies, num_elec_a, num_elec_b, rand_seed=None)[source]¶
Refine bitstrings based on average orbital occupancy and a target hamming weight.
This function refines each bit in isolation in an attempt to transform the Hilbert space represented by the input
bitstring_matrix
into a space closer to that which supports the ground state.Note
This function makes the assumption that bit
i
represents the spin-down orbital corresponding to the spin-up orbital in biti + N
whereN
is the number of spatial orbitals andi < N
.Note
The output configurations may not necessarily have correct hamming weight, as each bit is flipped in isolation from the other bits in the bitstring.
- Parameters:
bitstring_matrix (ndarray) – A 2D array of
bool
representations of bit values such that each row represents a single bitstringprobabilities (Sequence[float]) – A 1D array specifying a probability distribution over the bitstrings
avg_occupancies (ndarray) – A 1D array containing the mean occupancy of each orbital. It is assumed that
avg_occupancies[i]
corresponds to the orbital represented by columni
inbitstring_matrix
.num_elec_a (int) – The number of spin-up electrons in the system.
num_elec_b (int) – The number of spin-down electrons in the system.
rand_seed (Generator | int | None) – A seed for controlling randomness
- Returns:
A refined bitstring matrix and an updated probability array.
- Return type:
References
- [1]: J. Robledo-Moreno, et al., Chemistry Beyond Exact Solutions on a Quantum-Centric Supercomputer,
arXiv:2405.05068 [quant-ph].