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 conditional parameter to gate counting #1662

Merged
merged 7 commits into from
Nov 8, 2024
Merged

Conversation

cqc-melf
Copy link
Contributor

@cqc-melf cqc-melf commented Nov 7, 2024

Description

Solves #1477

Related issues

Please mention any github issues addressed by this PR.

Checklist

  • I have performed a self-review of my code.
  • I have commented hard-to-understand parts of my code.
  • I have made corresponding changes to the public API documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have updated the changelog with any user-facing changes.

@cqc-melf cqc-melf marked this pull request as ready for review November 7, 2024 19:52
@@ -1119,6 +1119,7 @@ class Circuit {
std::map<OpType, unsigned> op_counts() const;

unsigned count_gates(const OpType &op_type) const;
unsigned count_gates_conditional(const OpType &op_type) const;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should just add an optional argument to count_gates() to make it count conditionals as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 127a9cc

"type: The operation type to search for\n:return: the "
"number of operations matching `type`",
py::arg("type"))
"type: The operation type to search for\n:param "
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"type: The operation type to search for\n:param "
"type: The operation type to search for\n\n:param "

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 127a9cc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this for the return, too.

"number of operations matching `type`",
py::arg("type"))
"type: The operation type to search for\n:param "
"conditional: if set to true, conditional gates will "
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think include_conditional would be a better name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 127a9cc

@cqc-melf cqc-melf merged commit 9b31e67 into main Nov 8, 2024
32 checks passed
@cqc-melf cqc-melf deleted the melf/count-conditional branch November 8, 2024 15:40
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.

2 participants