Open albi3ro opened 1 week ago
Pennylane allows specifying measurements like ExpectationMP via a combination of wires + eigenvalues:
ExpectationMP
ExpectationMP(eigvals=np.array([-1.0, 1.0]), wires=qml.wires.Wires((0,1)))
While not user-facing, this can be produced internally, for example from:
>>> qml.expval(qml.X(0)).expand().circuit [Hadamard(wires=[0]), expval(eigvals=[ 1. -1.], wires=[0])]
Trying to measure such an observable on default.qubit gives:
default.qubit
File [pennylane/pennylane/devices/qubit/measure.py:190](pennylane/pennylane/devices/qubit/measure.py#line=189), in get_measurement_function(measurementprocess, state) 187 return state_diagonalizing_gates 189 if isinstance(measurementprocess, ExpectationMP): --> 190 if measurementprocess.obs.name == "SparseHamiltonian": 191 return csr_dot_products 193 if measurementprocess.obs.name == "Hermitian": AttributeError: 'NoneType' object has no attribute 'name'
I'm not too concerned about this, as there's really no user-facing of creating this, but we should at least track it.
A valid option might be to remove support for the eigvals+wires representation, if we are uninterested in supporting and maintaining it.
Pennylane allows specifying measurements like
ExpectationMP
via a combination of wires + eigenvalues:While not user-facing, this can be produced internally, for example from:
Trying to measure such an observable on
default.qubit
gives:I'm not too concerned about this, as there's really no user-facing of creating this, but we should at least track it.
A valid option might be to remove support for the eigvals+wires representation, if we are uninterested in supporting and maintaining it.