[BUG] Discrepancy between quantum_fisher
and adjoint_metric_tensor
depending on angle order
#6345
Closed
1 task done
Labels
bug 🐛
Something isn't working
Expected behavior
For a given circuit, I would expect that computing the QFIM via either
quantum_fisher
oradjoint_metric_tensor
gives the same result, since according to here,quantum_fisher
is supposed to default toadjoint_metric_tensor
whenshots=None
and the device isdefault.qubit
.Given the circuit below, I can pass in an array
angles
and draw from its angles in one of two orderings:Actual behavior
I compute 4 different tests, using the two different orderings and two different QFIM functions:
The print statements return
I find that when the ordering is
alternate=False
, i.e. when the order of the angles as-is matches the order in which they are actually applied/recorded on the qtape, thenquantum_fisher
returns the same matrix asadjoint_metric_tensor
(up to a factor of 4, as expected). However, when the angles are alternating, the two QFIMs (i.e.qfim3
andqfim4
below) do not agree, and neither of these equal thealternate=False
case. I suspect that one of these functions only respects the ordering on the qtape after the circuit has been built (which I think is the intended behavior), but the other is still aware of the original ordering of the input. And if that were the case, then whichever function respected the ordering of the original input should (I think) return the same QFIM as in the first case, since the circuit structure and input is the same across all 4 cases. For context, I am trying to study certain sub-blocks of the QFIM, so knowing which angles correspond to which row/column indices in the QFIM is important.Additional information
No response
Source code
No response
Tracebacks
No response
System information
Name: PennyLane Version: 0.38.0 Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network. Home-page: https://github.com/PennyLaneAI/pennylane Author: Author-email: License: Apache License 2.0 Location: /Users/joey/miniconda3/envs/lanl/lib/python3.12/site-packages Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, toml, typing-extensions Required-by: PennyLane_Lightning Platform info: macOS-14.4.1-arm64-arm-64bit Python version: 3.12.6 Numpy version: 1.26.4 Scipy version: 1.14.1 Installed devices: - lightning.qubit (PennyLane_Lightning-0.38.0) - default.clifford (PennyLane-0.38.0) - default.gaussian (PennyLane-0.38.0) - default.mixed (PennyLane-0.38.0) - default.qubit (PennyLane-0.38.0) - default.qubit.autograd (PennyLane-0.38.0) - default.qubit.jax (PennyLane-0.38.0) - default.qubit.legacy (PennyLane-0.38.0) - default.qubit.tf (PennyLane-0.38.0) - default.qubit.torch (PennyLane-0.38.0) - default.qutrit (PennyLane-0.38.0) - default.qutrit.mixed (PennyLane-0.38.0) - default.tensor (PennyLane-0.38.0) - null.qubit (PennyLane-0.38.0)
Existing GitHub issues
The text was updated successfully, but these errors were encountered: