prototype-qrao
prototype-qrao copied to clipboard
Deprecate `encoding.offset` while incorporating it into `encoding.qubit_op`
Summary
Currently, the encode()
method results in the operator being spanned across two properties: the traceless part is stored in qubit_op
, while the constant offset is stored in offset
. The current separation follows the practice of to_ising()
is Qiskit Optimization. However, this separation seems unnecessary. It conceptually simplifies things to store the operator entirely in qubit_op
, as this PR proposes.
Details and comments
This will aid in solving #8 and with #9 (via the corresponding PR, #13).
There was some concern previously that storing the identity term within the operator might lead to additional quantum experiments being performed. However, I have convinced myself now that this is not the case, so I'd like to move forward with this PR.
Here's why: Any reasonable implementation of an Estimator -- including the one in BackendEstimator
-- is going to call group_commuting
(which was introduced in Qiskit Terra 0.21) on the observables before sending them off to hardware. Since the identity term commutes with everything, it will never lead to an additional experiment being performed. There is the corner case where there are no other operators, and in that case could cause one experiment to be performed rather than zero, but that corner case is not of interest to us in QRAO.