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

ZXW rewrite rules + Differentiation #93

Merged
merged 40 commits into from
Aug 6, 2023
Merged

ZXW rewrite rules + Differentiation #93

merged 40 commits into from
Aug 6, 2023

Conversation

exAClior
Copy link
Collaborator

No description provided.

@codecov
Copy link

codecov bot commented Jul 11, 2023

Codecov Report

Patch coverage: 79.17% and project coverage change: -0.43% ⚠️

Comparison is base (5161a51) 82.88% compared to head (6870623) 82.46%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #93      +/-   ##
==========================================
- Coverage   82.88%   82.46%   -0.43%     
==========================================
  Files          16       17       +1     
  Lines        2478     2902     +424     
==========================================
+ Hits         2054     2393     +339     
- Misses        424      509      +85     
Files Changed Coverage Δ
src/ZXCalculus.jl 100.00% <ø> (ø)
src/zxw_diagram.jl 86.20% <ø> (ø)
src/parameter.jl 76.31% <45.45%> (-20.03%) ⬇️
src/zxw_rules.jl 73.44% <73.44%> (ø)
src/utils.jl 87.05% <94.15%> (+11.28%) ⬆️
src/to_eincode.jl 98.85% <100.00%> (+0.07%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@exAClior
Copy link
Collaborator Author

Hello @ChenZhao44 , could you please take a look at my differentiation implementation while I continue to work on the integration part? I did minimal testing just in case I need to rewrite the entire thing.

src/diff.jl Outdated Show resolved Hide resolved
src/parameter.jl Outdated Show resolved Hide resolved
Project.toml Outdated Show resolved Hide resolved
@exAClior exAClior marked this pull request as ready for review July 29, 2023 02:52
@exAClior
Copy link
Collaborator Author

exAClior commented Jul 29, 2023

@ChenZhao44 Hi! I fixed and tested everything including differentiation, integration of two sites and four sites, variance calculation. Everything passed! Could you please take a look at it at your convenience? Thanks!

There are a few caveats for future user and future me.
1: If you found yourself missing a $\sqrt{2}$ in value sensitive calculation (derivative or integral), note the X spider used in ZXW Calculus related literature is actually a pink X spider, you need to adjust for $2^{(m+n-2)/2}$ where $m$ and $n$ are the number of in and out legs of the pink X spider
2: The ZXWDiagram representing the integral will be a factor of $1/2$ instead of $1/2\pi$ off from $\int_{0}^{2} \square d\theta$ where $\square$ represents the ZXDiagram calculating expectation value. This is because the spiders we used have rotation angles in units of $\pi$ not radians .

A merge of this PR should close #76 and #16

test/diff.jl Outdated Show resolved Hide resolved
test/diff.jl Outdated Show resolved Hide resolved
test/diff.jl Outdated Show resolved Hide resolved
test/to_eincode.jl Outdated Show resolved Hide resolved
test/to_eincode.jl Outdated Show resolved Hide resolved
Project.toml Outdated Show resolved Hide resolved
src/diff.jl Outdated Show resolved Hide resolved
src/diff.jl Outdated Show resolved Hide resolved
src/to_eincode.jl Outdated Show resolved Hide resolved
src/utils.jl Outdated Show resolved Hide resolved
@exAClior
Copy link
Collaborator Author

exAClior commented Aug 1, 2023

Need to fix #97

@exAClior exAClior changed the title [WIP] ZXW rewrite rules + Differentiation ZXW rewrite rules + Differentiation Aug 5, 2023
Copy link
Member

@ChenZhao44 ChenZhao44 left a comment

Choose a reason for hiding this comment

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

Looks great now!

src/zxw_rules.jl Outdated Show resolved Hide resolved
@exAClior exAClior merged commit 6bb22d9 into master Aug 6, 2023
@exAClior exAClior deleted the zxw-rewrite-rules branch August 6, 2023 01:16
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.

4 participants