pennylane icon indicating copy to clipboard operation
pennylane copied to clipboard

Qutrit Rotations #4 (TRZ)

Open mudit2812 opened this issue 3 years ago • 1 comments

Context: There are very few simulators available today that offer qudit simulation. One notable example is Google's Cirq, which includes support for qudit operations. However, the simulator is far from complete, and a key drawback is the lack of operations available, which creates a need for users to define operations themselves. Popular libraries such as Qiskit and QuTiP also include some qudit manipulation capabilities, but with few use cases. Beyond these libraries, qudit simulation solutions are quite limited. Moreover, qudit simulation is a feature that is already in demand, as seen in this issue on the PennyLane repository.

This PR builds on previous PR's working on qutrit simulation by adding a parametrized Z rotation operation. This change builds the foundation for making parametrized qutrit circuits, and thus, allows testing variational qutrit algorithms with PennyLane.

Description of the Change:

  • Added TRZ() operation, which applies an Z rotation to a subspace specified by the user. The subspace determines which 2 of 3 one-qutrit basis states the operation applies to.

Benefits:

  • Users can now perform a parametrized Z rotation on qutrit devices.

Possible Drawbacks:

Related GitHub Issues: https://github.com/PennyLaneAI/pennylane/issues/2190

mudit2812 avatar Jul 20 '22 21:07 mudit2812

Codecov Report

Merging #2847 (fc62f94) into master (c4a84d2) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #2847   +/-   ##
=======================================
  Coverage   99.77%   99.77%           
=======================================
  Files         344      344           
  Lines       30988    31040   +52     
=======================================
+ Hits        30918    30970   +52     
  Misses         70       70           
Impacted Files Coverage Δ
pennylane/devices/default_qutrit.py 100.00% <ø> (ø)
pennylane/ops/qutrit/__init__.py 100.00% <ø> (ø)
pennylane/ops/qutrit/non_parametric_ops.py 100.00% <ø> (ø)
pennylane/math/quantum.py 100.00% <100.00%> (ø)
pennylane/operation.py 97.32% <100.00%> (+<0.01%) :arrow_up:
pennylane/ops/qutrit/parametric_ops.py 100.00% <100.00%> (ø)
pennylane/qnn/keras.py 100.00% <100.00%> (ø)
pennylane/templates/subroutines/qsvt.py 100.00% <100.00%> (ø)

codecov[bot] avatar Jul 21 '22 20:07 codecov[bot]

Re: changing subspace to tuples in documentation and tests,

I was thinking about it when I first changed the TRX subspace to be a tuple by default, but during subspace validation the given subspace is cast into a tuple anyway, so users can pass in lists without causing anything to break. I think it makes sense to have tuples in the documentation, though it's not needed as the output with both lists and tuples is correct, but it's definitely not necessary to do so in tests.

mudit2812 avatar May 24 '23 22:05 mudit2812