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

QGL2 programs cannot use parameters of qubits #37

Open
ahelsing opened this issue Jun 13, 2019 · 3 comments
Open

QGL2 programs cannot use parameters of qubits #37

ahelsing opened this issue Jun 13, 2019 · 3 comments

Comments

@ahelsing
Copy link
Contributor

QGL2 treats a qubit as just a label. Any parameter of the qubit cannot be used in a QGL2 program. Specifically, BasicSequences/BlankingSweeps shows a QGL program that you cannot write in QGL2.

Is this something we should support? If so, how? If not, do all such programs need to be written in QGL1 and given stubs for use in QGL2 programs?

@ahelsing
Copy link
Contributor Author

Add to QGL2 codebase some helper QGL1 functions (say in qgl2/qgl1_util.py):

As simple as

def getPulseParam(q: qreg, param):
    return q.pulse_params['param']

Or fancier & more use specific:

def getPulseOfSpecificLength(pulse, q: qreg, desiredLength) -> pulse:
    return pulse(q, length=desiredLength-q.pulse_params["length"])

@ahelsing
Copy link
Contributor Author

See Decoupling.CPMG. Using that getPulseParam idea may not work in general, because the QGL2 compiler tries to use it to ensure types work for the math (eg doing foo - getPulseParams(q, 'length') causes QGL2 to say it can't do float - None. The 2nd solution seems to work; see CPMG.

@ahelsing
Copy link
Contributor Author

Per discussion today, using parameters of a qubit may be rare, such that it's OK if you have to do this in QGL1. So may not need to fix this; the workaround used above may be plenty.

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