openfermion.linalg.expectation_computational_basis_state

Compute expectation value of operator with a state.

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.

A real float giving expectation value.

TypeError Incorrect operator or state type.