Compute expectation value of operator with a state.
openfermion.linalg.expectation_computational_basis_state(
operator, computational_basis_state
)
Args |
operator
|
Qubit or FermionOperator to evaluate expectation value of.
If operator is a FermionOperator, it must be normal-ordered.
computational_basis_state (scipy.sparse vector / list): normalized
computational basis state (if scipy.sparse vector), or list of
occupied orbitals.
|
Returns |
A real float giving expectation value.
|
Raises |
TypeError
|
Incorrect operator or state type.
|