Yao.jl icon indicating copy to clipboard operation
Yao.jl copied to clipboard

add `circuit_depth`

Open DhruvaSambrani opened this issue 2 years ago • 6 comments

Fixes #426

DhruvaSambrani avatar Jan 29 '23 14:01 DhruvaSambrani

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

DhruvaSambrani avatar Jan 30 '23 15:01 DhruvaSambrani

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

Roger-luo avatar Jan 30 '23 17:01 Roger-luo

Codecov Report

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

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

:exclamation: 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%) :arrow_up:

... and 1 file with indirect coverage changes

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

codecov[bot] avatar Jan 30 '23 17:01 codecov[bot]

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

Roger-luo avatar Jan 30 '23 19:01 Roger-luo

yes sure

DhruvaSambrani avatar Jan 30 '23 19:01 DhruvaSambrani

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.

GiggleLiu avatar Feb 01 '23 09:02 GiggleLiu