QuantumBFS / Yao.jl

Extensible, Efficient Quantum Algorithm Design for Humans.
https://yaoquantum.org
Other
918 stars 119 forks source link

add `circuit_depth` #454

Open DhruvaSambrani opened 1 year ago

DhruvaSambrani commented 1 year ago

Fixes #426

DhruvaSambrani commented 1 year ago

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

Roger-luo commented 1 year ago

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

codecov[bot] commented 1 year ago

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 ```diff @@ 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](https://app.codecov.io/gh/QuantumBFS/Yao.jl/pull/454?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=QuantumBFS) | Coverage Δ | | |---|---|---| | [lib/YaoBlocks/src/blocktools.jl](https://app.codecov.io/gh/QuantumBFS/Yao.jl/pull/454?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=QuantumBFS#diff-bGliL1lhb0Jsb2Nrcy9zcmMvYmxvY2t0b29scy5qbA==) | `89.62% <100.00%> (+1.20%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/QuantumBFS/Yao.jl/pull/454/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=QuantumBFS)

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

Roger-luo commented 1 year ago

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

DhruvaSambrani commented 1 year ago

yes sure

GiggleLiu commented 1 year ago

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.