Open antalszava opened 2 years ago
Note: this requires dedicated logic to be added and will not be resolved by other fixes (e.g., new return types).
The above-described scenario now raises NotImplementedError
. Computing these quantities with finite shots emits a warning and in practice, analytic computations are performed. Using a shot vector would simply mean duplicating a single result N
times for a shot vector of length N
and hence seems not to be useful as is.
Alternatively, if qml.mutual_info
and qml.vn_entropy
instead of depending on state information would be estimated using state tomography, then information about shots could be useful along with using a shot vector.
Perhaps rewriting them to support state tomography -- or perhaps even better, native quantum algorithms for measuring these quantities -- would be the best overall solution
Expected behavior
qml.mutual_info
andqml.vn_entropy
work with any type of shot vectors.Actual behavior
Multiple copies of the same shot number raise an error. The issue is that the
QubitDevice
method for these methods do not consider theshot_range
andbin_size
arguments of thestatistics
method, as other methods called bystatistics
do.For that reason, a scalar value is generated internally, whereas the logic for multiple shot number copies would at one point expect an iterable (i.e., array). This causes the error.
Additional information
No response
Source code
Tracebacks
System information
Existing GitHub issues