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 circuit_depth #454

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

DhruvaSambrani
Copy link

@DhruvaSambrani DhruvaSambrani commented Jan 29, 2023

Fixes #426

@DhruvaSambrani DhruvaSambrani changed the title add circuit_depth [WIP] add circuit_depth Jan 29, 2023
Copy link
Member

@Roger-luo Roger-luo left a comment

Choose a reason for hiding this comment

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

can we have a test?

@DhruvaSambrani
Copy link
Author

Interface question, should count_measure be a kwarg? circuit_depth(circuit, count_measure=false) vs circuit_depth(circuit, false)

@Roger-luo
Copy link
Member

Yes I think it should be a keyword argument since it's an option, thanks!

@codecov
Copy link

codecov bot commented Jan 30, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.06 🎉

Comparison is base (c60f6d9) 88.28% compared to head (d336a6b) 88.35%.

❗ Current head d336a6b differs from pull request most recent head 65e1549. Consider uploading reports for the commit 65e1549 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #454      +/-   ##
==========================================
+ Coverage   88.28%   88.35%   +0.06%     
==========================================
  Files          77       77              
  Lines        4824     4835      +11     
==========================================
+ Hits         4259     4272      +13     
+ Misses        565      563       -2     
Impacted Files Coverage Δ
lib/YaoBlocks/src/blocktools.jl 89.62% <100.00%> (+1.20%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Roger-luo
Copy link
Member

need to fix the test and make sure it passes the CI, please let me know if you have issues with that

@DhruvaSambrani
Copy link
Author

yes sure

@Roger-luo Roger-luo changed the title [WIP] add circuit_depth add circuit_depth Feb 1, 2023
@GiggleLiu
Copy link
Member

GiggleLiu commented Feb 1, 2023

Thanks for the pull request, but I think the depth counting should be implemented in a recursive style.
Suppose I have a nested chain, the counting of depth might be wrong.

You should add a test with the following circuit:

chain(chain(put(4, 2=>X), control(4, 2, 3=>Z)))

Its depth should be 2.

Please refer the implementation of gatecount.

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.

Implementation of function to calculate circuit depth
3 participants