def run(self, qc: QuantumComputer, bitstring_map: Dict[str, str]) -> 'BernsteinVazirani':
        """
        Runs the Bernstein-Vazirani algorithm.

        Given a connection to a QVM or QPU, find the :math:`\\mathbf{a}` and :math:`b` corresponding
        to the function represented by the oracle function that will be constructed from the
        bitstring map.

        :param qc: connection to the QPU or QVM
        :param bitstring_map: a truth table describing the boolean function, whose dot-product
            vector and bias is to be found
        """
        # initialize all attributes
        self.input_bitmap = bitstring_map
        self.n_qubits = len(list(bitstring_map.keys())[0])
        self.computational_qubits = list(range(self.n_qubits))
        self.ancilla = self.n_qubits  # is the highest index now.

        # construct BV circuit
        self.bv_circuit = self._create_bv_circuit(bitstring_map)

        # find vector by running the full bv circuit
        full_circuit = Program()
        full_ro = full_circuit.declare('ro', 'BIT', len(self.computational_qubits) + 1)
        full_circuit += self.bv_circuit
        full_circuit += [MEASURE(qubit, ro) for qubit, ro in zip(self.computational_qubits,
                                                                 full_ro)]
        full_executable = qc.compile(full_circuit)
        full_results = qc.run(full_executable)
        bv_vector = full_results[0][::-1]

        # To get the bias term we skip the Walsh-Hadamard transform
        ancilla_circuit = Program()
        ancilla_ro = ancilla_circuit.declare('ro', 'BIT', len(self.computational_qubits) + 1)
        ancilla_circuit += self.bv_circuit
        ancilla_circuit += [MEASURE(self.ancilla, ancilla_ro[self.ancilla])]
        ancilla_executable = qc.compile(ancilla_circuit)
        ancilla_results = qc.run(ancilla_executable)
        bv_bias = ancilla_results[0][0]

        self.solution = ''.join([str(b) for b in bv_vector]), str(bv_bias)
        return self
Runs the Bernstein-Vazirani algorithm.

        Given a connection to a QVM or QPU, find the :math:`\\mathbf{a}` and :math:`b` corresponding
        to the function represented by the oracle function that will be constructed from the
        bitstring map.

        :param qc: connection to the QPU or QVM
        :param bitstring_map: a truth table describing the boolean function, whose dot-product
            vector and bias is to be found