Skip to content
This repository was archived by the owner on Aug 26, 2026. It is now read-only.

Change photon_number_expectation - #396

Open
dorakingx wants to merge 2 commits into
XanaduAI:masterfrom
dorakingx:number_expectation
Open

dorakingx wants to merge 2 commits into
XanaduAI:masterfrom
dorakingx:number_expectation

Conversation

@dorakingx

@dorakingx dorakingx commented Aug 12, 2024

Copy link
Copy Markdown

Before submitting

Please complete the following checklist when submitting a PR:

  • All new features must include a unit test.
    If you've fixed a bug or added code that should be tested, add a test to the
    tests directory!

  • All new Python code must be clearly commented and documented.
    If you do make documentation changes, make sure that the docs build and
    render correctly by running make docs.

  • Ensure that the test suite passes, by running make test.

  • Add a new entry to the .github/CHANGELOG.md file, summarizing the
    change, and including a link back to the PR.

  • The Walrus source code conforms to
    PEP8 standards.
    We check all of our code against Pylint.
    To lint modified files, simply pip install pylint, and then
    run pylint thewalrus/path/to/file.py.

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


Context:

Description of the Change:

Benefits:

Possible Drawbacks:

Related GitHub Issues:

@nquesada

Copy link
Copy Markdown
Contributor

Is this related to this bug: #336 ?

@dorakingx

Copy link
Copy Markdown
Author

No, it's not. When calculating the variance of third-body correlations, I needed to compute the expected value of polynomial products such as N_1^2N_2 . However, I was only able to handle cases where all exponents were either 1 or 2. Therefore, I modified the photon_number_expectation function to allow for the calculation of expected values with a wider range of exponents.

@nquesada

Copy link
Copy Markdown
Contributor

Understood. You will need to add new tests in test_quantum.py and make sure to pass pylint and black on the PR. Finally, should you be interested in the theory behind photon_number_moments, we wrote a paper explaining all sort of useful properties: https://arxiv.org/abs/2212.06067 .

@dorakingx dorakingx closed this Aug 14, 2024
@dorakingx dorakingx reopened this Aug 14, 2024
@nquesada

Copy link
Copy Markdown
Contributor

Hi @dorakingx: are you planning to add a unit test for your proposed changes?

@dorakingx

Copy link
Copy Markdown
Author

Actually, since my project no longer requires calculating the expected value of polynomial products, I don't plan to add any tests.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants