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 note to cost func #55

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

add note to cost func #55

wants to merge 4 commits into from

Conversation

miamico
Copy link

@miamico miamico commented Oct 27, 2022

Adding a note to the cost_func_scaled_cr function in the cost_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.

@coveralls
Copy link

coveralls commented Oct 27, 2022

Pull Request Test Coverage Report for Build 3348830215

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 88.75%

Totals Coverage Status
Change from base Build 3338525469: 0.0%
Covered Lines: 2414
Relevant Lines: 2720

💛 - Coveralls

@kevinsung kevinsung requested a review from nbronn October 28, 2022 18:59
@@ -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
Copy link
Collaborator

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.

Copy link
Collaborator

@nbronn nbronn left a 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 deflateion), perhaps it makes sense to only run this cost function on circuits where circ.num_qubits == backend.num_qubits is True.

@miamico
Copy link
Author

miamico commented Oct 31, 2022

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

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants