-
Notifications
You must be signed in to change notification settings - Fork 56
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 note to cost func #55
base: main
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 3348830215
💛 - Coveralls |
qiskit_research/utils/cost_funcs.py
Outdated
@@ -35,6 +35,11 @@ def cost_func_scaled_cr( | |||
|
|||
Returns: | |||
float: error | |||
|
|||
Note: | |||
For a transpiled circuit which uses less qubit than the available ones on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the block under "Note:" needs to be indented one level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually since the point of this cost function is to evaluate the final circuit that has gone through all the transpilation passes (and includes pulse-level data about the selected qubits that would be discard by deflate
ion), perhaps it makes sense to only run this cost function on circuits where circ.num_qubits == backend.num_qubits
is True
.
I think the problem is not just with the fact that there can be redundant layouts if some qubits are not used (but should be included in the transpired circuit). The cost itself is not evaluated correctly as the loop over layouts doesn't have any effects. The cost of the circuit will be the one of the given transpiled circuit (transpiled to a particular layout) regardless of the layout in the iteration. So we shouldn't have any layout input here and assume the circuit has already been fitted to work for a particular layout for which we calculate the cost. If we want to go evaluate different layouts with the current cost function, we should re-transpile the circuit to each layout |
|
Adding a note to the
cost_func_scaled_cr
function in thecost_funcs
module to help clarify the best usage of the fiunction. In particular, if matching layouts are searched for a transpiled circuit with less active qubits than the number of available qubits in the backend, layouts containing all possible permutations of unused qubits will be included. User must be careful that an exponential number of layouts is not retrieved when directly using transpiled circuits instead of deflated ones.