qiskit_addon_sqd.counts.generate_counts_bipartite_hamming

generate_counts_bipartite_hamming(num_samples, num_bits, *, hamming_right, hamming_left, rand_seed=None)[source]

Generate a bitstring counts dictionary with specified bipartite hamming weight.

Parameters:
  • num_samples (int) – The number of samples to draw

  • num_bits (int) – The number of bits in the bitstrings

  • hamming_right (int) – The hamming weight on the right half of each bitstring

  • hamming_left (int) – The hamming weight on the left half of each bitstring

  • rand_seed (int | None) – A seed for controlling randomness

Returns:

A dictionary mapping bitstrings to the number of times they were sampled. Each half of each bitstring in the output dictionary will have a hamming weight as specified by the inputs.

Raises:
  • ValueErrornum_bits and num_samples must be positive integers.

  • ValueError – Hamming weights must be specified as non-negative integers.

  • ValueErrornum_bits must be even.

Return type:

dict[str, int]