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

confusing error message for circuit #273

Open
peendebak opened this issue Sep 21, 2018 · 1 comment
Open

confusing error message for circuit #273

peendebak opened this issue Sep 21, 2018 · 1 comment

Comments

@peendebak
Copy link

When a circuit cannot be compiled because gates are not available an error RecursionError: maximum recursion depth exceeded is generated. It would be better to generate an error indicating why the circuit cannot be compiled, e.g. CircuitRecursionError: cannot find circuit for [xxx].

A minimal example:

import projectq
from projectq import MainEngine 
from projectq.ops import H, S, T, CZ, Z, X, Y
from projectq.setups import restrictedgateset

engine_list = restrictedgateset.get_engine_list(one_qubit_gates=(X,Y,Z, H,T,), two_qubit_gates=(CZ,))
engine_list+=[projectq.cengines.ManualMapper(lambda ii: ii)]

eng = MainEngine(backend=projectq.backends.CommandPrinter(),engine_list=engine_list )  # create a default compiler (the back-end is a simulator)

qubits=eng.allocate_qureg(2)
q0 = qubits[0]
H | q0
S | q0
eng.flush() 
@damiansteiger
Copy link
Contributor

Thanks for the suggestion to annotate the message of these errors in future versions.

The reason for your error is that this setup currently does not support your gate set as it currently requires Rz gates (as most experimental setups use this):
https://projectq.readthedocs.io/en/latest/projectq.setups.html#module-projectq.setups.restrictedgateset

Let me know if you have a special gate set in mind and what it is used for. Future version will support a discrete gate set to get estimates for error correction overheads...

By the way:

projectq.cengines.ManualMapper(lambda ii: ii)

One can probably remove this mapper by adapting the backend.

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

2 participants