You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: