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

Added conj to qml math, fixed some ops #1143

Merged
merged 8 commits into from
Mar 22, 2021
Merged

Added conj to qml math, fixed some ops #1143

merged 8 commits into from
Mar 22, 2021

Conversation

chaserileyroberts
Copy link
Contributor

@chaserileyroberts chaserileyroberts commented Mar 16, 2021

Context:
qml.math.conj didn't exist before. This is needed to make adjoint transforms differentiable.

Description of the Change:
Added qml.math.conj and fixed affected adjoint transforms.

Benefits:
qml.math.conj can now be used, adjoints are now differentiable transforms.

Possible Drawbacks:
None

Related GitHub Issues:
None

@github-actions
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit .github/CHANGELOG.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 Mar 16, 2021

Codecov Report

Merging #1143 (a0cb441) into master (9a3cee8) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1143   +/-   ##
=======================================
  Coverage   97.97%   97.97%           
=======================================
  Files         142      142           
  Lines       10279    10289   +10     
=======================================
+ Hits        10071    10081   +10     
  Misses        208      208           
Impacted Files Coverage Δ
pennylane/math/__init__.py 100.00% <ø> (ø)
pennylane/math/autograd_box.py 100.00% <100.00%> (ø)
pennylane/math/fn.py 100.00% <100.00%> (ø)
pennylane/math/jax_box.py 100.00% <100.00%> (ø)
pennylane/math/numpy_box.py 98.57% <100.00%> (+0.02%) ⬆️
pennylane/math/tensorbox.py 96.02% <100.00%> (+0.05%) ⬆️
pennylane/math/tf_box.py 100.00% <100.00%> (ø)
pennylane/math/torch_box.py 100.00% <100.00%> (ø)
pennylane/ops/cv.py 100.00% <100.00%> (ø)
pennylane/ops/qubit.py 97.91% <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 9a3cee8...a0cb441. Read the comment docs.

pennylane/math/fn.py Outdated Show resolved Hide resolved
Copy link
Member

@josh146 josh146 left a comment

Choose a reason for hiding this comment

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

Thanks @Thenerdstation 💯

pennylane/math/fn.py Show resolved Hide resolved
@@ -605,7 +606,7 @@ def _heisenberg_rep(p):

def adjoint(self, do_queue=False):
U = self.parameters[0]
return Interferometer(U.conj().T, wires=self.wires, do_queue=do_queue)
return Interferometer(qml_math.T(qml_math.conj(U)), wires=self.wires, do_queue=do_queue)
Copy link
Member

Choose a reason for hiding this comment

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

🙏

@chaserileyroberts chaserileyroberts merged commit 34954b5 into master Mar 22, 2021
@chaserileyroberts chaserileyroberts deleted the conj_fix branch March 22, 2021 15:28
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.

None yet

2 participants