Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adder error when using parameterized_bitstring_prep #147

Open
joshcombes opened this issue Jun 14, 2019 · 0 comments
Open

adder error when using parameterized_bitstring_prep #147

joshcombes opened this issue Jun 14, 2019 · 0 comments
Labels
good first issue Good for newcomers

Comments

@joshcombes
Copy link
Contributor

joshcombes commented Jun 14, 2019

see the notebook. get_n_bit_adder_results fails when using parameterized bit string prep need to fix

if use_param_program=True there is an error.

n_bits = 2
# set in_x_basis to true here
results = get_n_bit_adder_results(noisy_qc, n_bits, use_param_program=True, in_x_basis=True)

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-16-3b31c8ccf0a4> in <module>
      1 n_bits = 2
      2 # set in_x_basis to true here
----> 3 results = get_n_bit_adder_results(noisy_qc, n_bits, use_param_program=True, in_x_basis=True)
      4 distributions = get_error_hamming_distributions_from_results(results)
      5 

~/forest-benchmarking/forest/benchmarking/classical_logic/ripple_carry_adder.py in get_n_bit_adder_results(qc, n_bits, registers, qubits, in_x_basis, num_shots, use_param_program, use_active_reset)
    304         # Run it on the QPU or QVM
    305         if use_param_program:
--> 306             results = qc.run(exe, memory_map={REG_NAME: bits})
    307         else:
    308             results = qc.run(exe)

~/pyquil/pyquil/api/_error_reporting.py in wrapper(*args, **kwargs)
    236             global_error_context.log[key] = pre_entry
    237 
--> 238         val = func(*args, **kwargs)
    239 
    240         # poke the return value of that call in

~/pyquil/pyquil/api/_quantum_computer.py in run(self, executable, memory_map)
    126                     # TODO gh-658: have write_memory take a list rather than value + offset
    127                     self.qam.write_memory(region_name=region_name, offset=offset, value=value)
--> 128         return self.qam.run() \
    129             .wait() \
    130             .read_memory(region_name='ro')

~/pyquil/pyquil/api/_error_reporting.py in wrapper(*args, **kwargs)
    236             global_error_context.log[key] = pre_entry
    237 
--> 238         val = func(*args, **kwargs)
    239 
    240         # poke the return value of that call in

~/pyquil/pyquil/api/_qvm.py in run(self)
    510             quil_program = apply_noise_model(quil_program, self.noise_model)
    511 
--> 512         quil_program = self.augment_program_with_memory_values(quil_program)
    513         try:
    514             self._bitstrings = self.connection._qvm_run(quil_program=quil_program,

~/pyquil/pyquil/api/_qvm.py in augment_program_with_memory_values(self, quil_program)
    530 
    531         for k, v in self._variables_shim.items():
--> 532             p += MOVE(MemoryReference(name=k.name, offset=k.index), v)
    533 
    534         p += quil_program

~/pyquil/pyquil/gates.py in MOVE(classical_reg1, classical_reg2)
    602     :return: A ClassicalMove instance.
    603     """
--> 604     left, right = unpack_reg_val_pair(classical_reg1, classical_reg2)
    605     return ClassicalMove(left, right)
    606 

~/pyquil/pyquil/gates.py in unpack_reg_val_pair(classical_reg1, classical_reg2)
     39         right = classical_reg2
     40     else:
---> 41         right = unpack_classical_reg(classical_reg2)
     42 
     43     return left, right

~/pyquil/pyquil/quilatom.py in unpack_classical_reg(c)
    144         return MemoryReference(c, 0)
    145     else:
--> 146         raise TypeError("c should be a list of length 2, a pair, a string, or a MemoryReference")
    147 
    148 

TypeError: c should be a list of length 2, a pair, a string, or a MemoryReference

@joshcombes joshcombes added the good first issue Good for newcomers label Jul 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant