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

[QIM-2] Add a qml.math.state_to_density_matrix for matrices and qml.math.partial_trace to math module #2569

Merged
merged 124 commits into from
Jun 10, 2022

Conversation

rmoyard
Copy link
Contributor

@rmoyard rmoyard commented May 12, 2022

Quantum Information module PR # 2
Context:

Currently the way to get the (reduced) density matrix from a matrix is a function in the device default.mixed.

Description of the Change:

Move the density matrix capabilities for state vector to the math module and implement partial_trace.
We add _density_matrix_from_matrix internal function that takes 2-d tensors for all interfaces as input and returns the (reduced) density matrix. It also add the matrix case to the function state_to_density_matrix which will be the user facing function that accepts state vectors, density matrices and QNodes returning states.

Benefits:

The reduced density matrix capabilities for matrices are now in the math module and it becomes a function accessible across the whole code base.

@github-actions
Copy link
Contributor

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.

@rmoyard rmoyard added the WIP 🚧 Work-in-progress label May 12, 2022
@codecov
Copy link

codecov bot commented May 12, 2022

Codecov Report

Merging #2569 (52d3740) into master (8332b0e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #2569   +/-   ##
=======================================
  Coverage   99.60%   99.60%           
=======================================
  Files         249      249           
  Lines       20307    20368   +61     
=======================================
+ Hits        20226    20288   +62     
+ Misses         81       80    -1     
Impacted Files Coverage Δ
pennylane/devices/default_qubit.py 100.00% <ø> (ø)
pennylane/_qubit_device.py 99.09% <100.00%> (+0.30%) ⬆️
pennylane/devices/default_mixed.py 100.00% <100.00%> (ø)
pennylane/math/quantum.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 8332b0e...52d3740. Read the comment docs.

@rmoyard rmoyard changed the title Create a qml.math.density_matrix for matrix and qml.math.partial_trace [WIP] Create a qml.math.density_matrix for matrix and qml.math.partial_trace May 12, 2022
@rmoyard rmoyard changed the base branch from master to density_matrix_from_array May 19, 2022 18:05
Base automatically changed from density_matrix_from_array to master June 10, 2022 05:30
@rmoyard rmoyard merged commit 78717d4 into master Jun 10, 2022
@rmoyard rmoyard deleted the density_matrix_from_matrix branch June 10, 2022 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review-ready 👌 PRs which are ready for review by someone from the core team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants