(Go: >> BACK << -|- >> HOME <<)

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

Surround filter #257

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

Surround filter #257

wants to merge 10 commits into from

Conversation

edyounis
Copy link
Member

New features:

  • Circuit.surround now can take a scoring function and a filter
    • The filter will prune the search space if provided
    • The scoring function can be used to change the scoring mechanism from the default gate count
    • The method is also now faster and more robust as it has been updated with the DAG methods
    • The starting point can now also be a region
  • Circuit.next and Circuit.prev can now also take a CircuitRegion and return the next or prev points of the entire region

Bug Fixes:

  • Fixed issues in circuit grid iteration with exclude=True
  • Fixed Circuit.check_region missing bad regions where a gate would be half-in-half-out

@edyounis edyounis requested a review from mtweiden July 11, 2024 01:15
@edyounis edyounis requested a review from alonkukl July 18, 2024 11:48
@edyounis edyounis mentioned this pull request Jul 18, 2024

point = self.normalize_point(point)
def default_scoring_fn(region: CircuitRegion) -> float:
return float(sum(op.num_qudits for op in self[region]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this isn't super important as it's just a default, but this means single- and multi- qudit operations are very similarly important.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is an important point. I thought going by the number of qudits in a gate would be enough, but your comment made me realize this needs more. For example, a region with two single-qubit gates is equivalent to one with a two-qubit gate. How do you think we should solve this? Multiply by a factor, e.g., x100?

region = circuit.surround((1, 3), 4)
assert region.location == CircuitLocation([2, 3, 4, 5])

def test_surround_filter_hard(self) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are some other use cases for filtering? It seems like maybe a MachineModel/topology or gateset check would be a nice extra test to have.

break
# Absorb Single-qudit gates
index = point[0]
while index < self.num_cycles - 1:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the parts that do "Absorb Single-qudit gates" and "Check for gates in the middle not in region" should be sub-functions on there own.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, using the flag "valid_region" gave me that same thought, but I can't see a way that makes it any simpler. How are you thinking to do this?

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.

None yet

3 participants