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

Add real-time Var support for ForLoopOp range #13729

Open
arthurostrauss opened this issue Jan 24, 2025 · 0 comments
Open

Add real-time Var support for ForLoopOp range #13729

arthurostrauss opened this issue Jan 24, 2025 · 0 comments
Labels
type: feature request New feature or request

Comments

@arthurostrauss
Copy link
Contributor

What should we add?

Currently,

the ForLoopOp requires passing an explicit list of integer (or a range) that specifies at compile time what will be the set of iterations. It would be nice to have the ability to create a custom range that could be specified at runtime to avoid compilation overhead when switching the number of repetitions of a same circuit.

This would involve creating an extra real-time range object (perhaps the opportunity to add arrays of real-time variables) that could serve as input for the operation.

One example of workflow would be:

`num_qubits = 3
q = QuantumRegister(num_qubits, "q")
qc = QuantumCircuit(q)
n_reps = qc.add_input("n_reps", Uint(8))

with qc.for_loop(range(n_reps)):
qc.x(0)
`
where here it is clear that the code will yield an error because range() cannot be applied over n_reps, hence motivating the introduction of a custom range object (similar to OpenQASM3) that could support such input.

@arthurostrauss arthurostrauss added the type: feature request New feature or request label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant