Skip to content

Commit

Permalink
Add helper func apply_operation for default mixed (#6379)
Browse files Browse the repository at this point in the history
**Context:**
Before getting into the implementation of new `default_mixed` we need to
separate most of the useful logics from the older version one. One of
the most important things is the `apply_operation`. Basically, what we
want to do is to condensate everything into a new sub-module under
`qml/devices/qubit_mixed` such that previous empirical heuristics
regarding how to select between `einsum` and `tensordot` can be carried
over and wrapped independently.

**Description of the Change:**
New script containing the helper funcs as described above.

**Benefits:**
Better modularization. Getting ready for the implementaion of a new
`default_mixed` in the future.

**Possible Drawbacks:**

**Related GitHub Issues:**

**Related Shortcut Stories**
[sc-73319]

---------

Co-authored-by: Mudit Pandey <[email protected]>
Co-authored-by: Astral Cai <[email protected]>
Co-authored-by: Christina Lee <[email protected]>
  • Loading branch information
4 people authored Nov 1, 2024
1 parent 195c95d commit bee380f
Show file tree
Hide file tree
Showing 7 changed files with 1,534 additions and 0 deletions.
14 changes: 14 additions & 0 deletions doc/releases/changelog-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@

<h3>Improvements 🛠</h3>

<h4>Other Improvements</h4>

* Added `qml.devices.qubit_mixed` module for mixed-state qubit device support. This module introduces:
- A new API for mixed-state operations
- An `apply_operation` helper function featuring:
- Two density matrix contraction methods using `einsum` and `tensordot`
- Optimized handling of special cases including:
- Diagonal operators
- Identity operators
- CX (controlled-X)
- Multi-controlled X gates
- Grover operators
[(#6379)](https://github.com/PennyLaneAI/pennylane/pull/6379)

<h3>Breaking changes 💔</h3>

<h3>Deprecations 👋</h3>
Expand Down
26 changes: 26 additions & 0 deletions pennylane/devices/qubit_mixed/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2018-2024 Xanadu Quantum Technologies Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Submodule for performing qubit mixed-state simulations of quantum circuits.
This submodule is internal and subject to change without a deprecation cycle. Use
at your own discretion.
.. currentmodule:: pennylane.devices.qubit_mixed
.. autosummary::
:toctree: api
apply_operation
"""
from .apply_operation import apply_operation
Loading

0 comments on commit bee380f

Please sign in to comment.