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

Layout.get_registers() does not return registers #1791

Closed
itoko opened this issue Feb 12, 2019 · 0 comments
Closed

Layout.get_registers() does not return registers #1791

itoko opened this issue Feb 12, 2019 · 0 comments

Comments

@itoko
Copy link
Contributor

itoko commented Feb 12, 2019

Information

  • Qiskit Terra version: 0.8.0
  • Python version: 3.6
  • Operating system: Mac

What is the current behavior?

Layout.get_registers() returns (virtual) qubits:

return list(self.get_virtual_bits().keys())

What is the expected behavior?

Layout.get_registers() returns (virtual quantum) registers:

return set([reg for reg, idx in self.get_virtual_bits().keys()])

Suggested solutions

Change the implementation of Layout.get_registers() to:

return set([reg for reg, idx in self.get_virtual_bits().keys()])

Change the line in BasicSwap.run()

                        for qreg in current_layout.get_registers():
                            if qreg[0] not in swap_layer.qregs.values():
                                swap_layer.add_qreg(qreg[0])

to

                        for qreg in current_layout.get_registers():
                            if qreg not in swap_layer.qregs.values():
                                swap_layer.add_qreg(qreg)
lia-approves pushed a commit to edasgupta/qiskit-terra that referenced this issue Jul 30, 2019
* Layout.get_registers() should return registers (Qiskit#1791)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant