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

Utility: apply num-shots loop directly to program Quil #1712

Closed
kalzoo opened this issue Dec 11, 2023 · 0 comments · Fixed by #1717
Closed

Utility: apply num-shots loop directly to program Quil #1712

kalzoo opened this issue Dec 11, 2023 · 0 comments · Fixed by #1717
Labels
enhancement ✨ A request for a new feature.

Comments

@kalzoo
Copy link
Contributor

kalzoo commented Dec 11, 2023

(this may be better suited for implementation in https://github.com/rigetti/pyquil and then use here)

Currently, a program may be designated to execute with a shot count via program.wrap_in_numshots_loop(shots). This value is then sent as a request parameter alongside the program in the translation request.

There are use cases, though, where the user may prefer to directly control that shot-count loop within their own program, with a pattern like:

DECLARE loop_index INTEGER

@label shot-count-loop-start

# loop contents
SUB loop_index 1
JUMP-WHEN @shot-count-loop-start loop_index

The user's program could be wrapped with this loop using a function roughly like:

class Program:
    def apply_num_shots_loop_to_quil(self, variable: MemoryReference):
        # wrap program in the Quil above
        
        self.num_shots = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ A request for a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant