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 norm for second quantized Hamiltonian #2653

Merged
merged 19 commits into from
Jun 20, 2022

Conversation

soranjh
Copy link
Contributor

@soranjh soranjh commented Jun 2, 2022

Context:
This PR adds functions for computing the 1-norm of a molecular Hamiltonian from the one- and two-electron integrals and eigenvalues of the factorized two-electron integral tensor.

Description of the Change:

Benefits:

Possible Drawbacks:

Related GitHub Issues:

@soranjh soranjh added WIP 🚧 Work-in-progress qchem ⚛️ Related to the QChem package labels Jun 2, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jun 2, 2022

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@codecov
Copy link

codecov bot commented Jun 2, 2022

Codecov Report

Merging #2653 (fd3d632) into resource_estimation_algorithms (0e84772) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@                       Coverage Diff                       @@
##           resource_estimation_algorithms    #2653   +/-   ##
===============================================================
  Coverage                           99.61%   99.61%           
===============================================================
  Files                                 255      256    +1     
  Lines                               20821    20830    +9     
===============================================================
+ Hits                                20741    20750    +9     
  Misses                                 80       80           
Impacted Files Coverage Δ
pennylane/resources/__init__.py 100.00% <100.00%> (ø)
pennylane/resources/second_quantization.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e84772...fd3d632. Read the comment docs.

@soranjh soranjh marked this pull request as ready for review June 7, 2022 13:05
@soranjh soranjh changed the title [WIP] add norm for second quantized Hamiltonian Add norm for second quantized Hamiltonian Jun 7, 2022
@soranjh soranjh removed the WIP 🚧 Work-in-progress label Jun 7, 2022
pennylane/resources/__init__.py Outdated Show resolved Hide resolved
pennylane/resources/df.py Outdated Show resolved Hide resolved
pennylane/resources/df.py Outdated Show resolved Hide resolved
pennylane/resources/df.py Outdated Show resolved Hide resolved
@soranjh soranjh requested a review from ixfoduap June 13, 2022 21:58
Copy link
Contributor

@Jaybsoni Jaybsoni left a comment

Choose a reason for hiding this comment

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

Looks good Soran! Just a few quick comments:

  • Is this quantity differentiable? Could we compute the gradient wrt the one and two electron integral parameters? If this doesn't make sense to do then no worries, otherwise it might be worth adding a unit test to check for
  • I imagine this function will not be user facing but mostly used internally in the resource estimation pipeline. If it is user facing, it might be worth adding tests to make sure that if the parameters one, two, eigvals are given in a different framework (autograd or tf arrays) then this function doesn't fail.
  • Codecov is complaining about a few lines which still need to be tested. (you can use #pragma no cover to suppress lines you think have been sufficiently tested but still cause errors in Codcov)

@soranjh
Copy link
Contributor Author

soranjh commented Jun 14, 2022

Looks good Soran! Just a few quick comments:

  • Is this quantity differentiable? Could we compute the gradient wrt the one and two electron integral parameters? If this doesn't make sense to do then no worries, otherwise it might be worth adding a unit test to check for

Thanks Jay. I am not actually sure about the benefit of making the norm differentiable wrt the input parameters.

  • I imagine this function will not be user facing but mostly used internally in the resource estimation pipeline. If it is user facing, it might be worth adding tests to make sure that if the parameters one, two, eigvals are given in a different framework (autograd or tf arrays) then this function doesn't fail.

I tested the function with inputs given as autograd numpy array and tensorflow varibales and it works. I can add such tests but regarding what mentioned above about differentiability, not sure if these tests are still necessary. If they are still useful, I can add them.

  • Codecov is complaining about a few lines which still need to be tested. (you can use #pragma no cover to suppress lines you think have been sufficiently tested but still cause errors in Codcov)

hmm, I see a full coverage for norm_df, and do not see codecov complaining. Where is the complain?

@soranjh soranjh requested a review from Jaybsoni June 14, 2022 21:31
@Jaybsoni
Copy link
Contributor

Looks good Soran! Just a few quick comments:

  • Is this quantity differentiable? Could we compute the gradient wrt the one and two electron integral parameters? If this doesn't make sense to do then no worries, otherwise it might be worth adding a unit test to check for

Thanks Jay. I am not actually sure about the benefit of making the norm differentiable wrt the input parameters.

  • I imagine this function will not be user facing but mostly used internally in the resource estimation pipeline. If it is user facing, it might be worth adding tests to make sure that if the parameters one, two, eigvals are given in a different framework (autograd or tf arrays) then this function doesn't fail.

I tested the function with inputs given as autograd numpy array and tensorflow varibales and it works. I can add such tests but regarding what mentioned above about differentiability, not sure if these tests are still necessary. If they are still useful, I can add them.

  • Codecov is complaining about a few lines which still need to be tested. (you can use #pragma no cover to suppress lines you think have been sufficiently tested but still cause errors in Codcov)

hmm, I see a full coverage for norm_df, and do not see codecov complaining. Where is the complain?

Cool, if differentiability isn't a concern then I doubt we need to test it.

Thats weird, when I reviewed it initially there were some inline comments from codecov complaining about some trivial lines of code. I guess if its not complaining now then this should be good to go. 💯

Copy link
Contributor

@Jaybsoni Jaybsoni left a comment

Choose a reason for hiding this comment

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

Looks good !

@soranjh soranjh merged commit 04c2315 into resource_estimation_algorithms Jun 20, 2022
@soranjh soranjh deleted the resource_secondq_norm branch June 20, 2022 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
qchem ⚛️ Related to the QChem package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants