catalyst
catalyst copied to clipboard
Catalyst treats a density matrix measurement as a state measurement
Issue description
Description of the issue - include code snippets and screenshots here if relevant. You may use the following template below
- Expected behavior: (What you expect to happen)
I would the expect the same behavior as in a non-qjit execution. Requesting qml.density_matrix(wires) should return a density matrix.
Without the qjit, I get:
array([[0.46939564+0.j , 0. +0.11985638j,
0.46939564+0.j , 0. +0.11985638j],
[0. -0.11985638j, 0.03060436+0.j ,
0. -0.11985638j, 0.03060436+0.j ],
[0.46939564+0.j , 0. +0.11985638j,
0.46939564+0.j , 0. +0.11985638j],
[0. -0.11985638j, 0.03060436+0.j ,
0. -0.11985638j, 0.03060436+0.j ]])
- Actual behavior: (What actually happens)
We just get the state.
- Reproduces how often: (What percentage of the time does it reproduce?)
Every time I execute it.
- System information: (post the output of
import pennylane as qml; qml.about())
master pennylane, recent catalyst
Source code and tracebacks
dev = qml.device('lightning.qubit', wires=2)
@qml.qjit
@qml.qnode(dev)
def circuit(phi):
qml.Hadamard(0)
qml.IsingXX(phi, wires=(0,1))
return qml.density_matrix(wires=(0,1))
circuit(0.5)
array([0.68512454+0.j , 0. -0.17494102j,
0.68512454+0.j , 0. -0.17494102j])
Please include any additional code snippets and error tracebacks related to the issue here.
Additional information
Any additional information, configuration or data that might be necessary to reproduce the issue.