pyqtorch
pyqtorch copied to clipboard
[Feature] Add expectation value for density matrix
Pyqtorch has recently incorporated noisy gates and circuit through the addition of Kraus operators #148.
Consequently, it becomes pertinent to modify the actual expectation()
function to be able to support the noisy circuit, and thus the density matrix formalism.
For a density matrix the expectation value of the observable $A$ is:
$$\langle A \rangle = \text{Tr}(A \rho)$$
Also, Modify the sample
method to support the DensityMatrix
formalism