-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add binary literal example to compute_amplitudes_sweep and compute_amplitudes methods of SimulatesAmplitudes class. #2603
Comments
I think the way to do this in python is to use the binary prefix: |
…plitudes methods of SimulatesAmplitudes class (quantumlib#2603)
…plitudes methods of SimulatesAmplitudes class (quantumlib#2603)
Not at all. To measure bitstring 0010, you need to provide 2 as input which you may choose to write as 0b0010 or 0b10 or 0x2 or 2 or even 0o2 (no longer fashionable). |
The signature of compute_amplitudes_sweep and compute_amplitudes requires bitstrings to be a list of int's. Because of the semantics in python3 of not allowing leading zeros for int's (https://stackoverflow.com/questions/36386346/syntaxerror-invalid-token) this can be confusing.
For eg: if I want to measure a bitstring 0010, I need to provide 10 as input to the bitstring which is confusing to the user.
I propose to change the type of bitstrings to Sequence[str].
The text was updated successfully, but these errors were encountered: