get_n_bit_adder_results

forest.benchmarking.classical_logic.get_n_bit_adder_results(qc: pyquil.api._quantum_computer.QuantumComputer, n_bits: int, registers: Tuple[Sequence[int], Sequence[int], int, int] = None, qubits: Sequence[int] = None, in_x_basis: bool = False, num_shots: int = 100, use_param_program: bool = False, use_active_reset: bool = True, show_progress_bar: bool = False) → Sequence[Sequence[Sequence[int]]]

Convenient wrapper for collecting the results of addition for every possible pair of n_bits long summands.

Parameters:
  • qc – the quantum resource on which to run each addition
  • n_bits – the number of bits of one of the summands (each summand is the same length)
  • registers – optional explicit qubit layout of each of the registers passed to adder()
  • qubits – available subset of qubits of the qc on which to run the circuits.
  • in_x_basis – if true, prepare the bitstring-representation of the numbers in the x basis and subsequently performs all addition logic in the x basis.
  • num_shots – the number of times to sample the output of each addition
  • use_param_program – whether or not to use a parameterized program for state preparation. Doing so should speed up overall execution on a QPU.
  • use_active_reset – whether or not to use active reset. Doing so will speed up execution on a QPU.
  • show_progress_bar – displays a progress bar via tqdm if true.
Returns:

A list of n_shots many outputs for each possible summation of two n_bit long summands, listed in increasing numerical order where the label is the 2n bit number represented by num = a_bits | b_bits for the addition of a + b.