![]() |
Compute the commutator of two operators.
openfermion.utils.commutator(
operator_a, operator_b
)
Used in the notebooks
Used in the tutorials |
---|
Args | |
---|---|
operator_a, operator_b: Operators in commutator. Any operators are accepted so long as implicit subtraction and multiplication are supported; e.g. QubitOperators, FermionOperators, BosonOperators, or Scipy sparse matrices. 2D Numpy arrays are also supported. |
Raises | |
---|---|
TypeError
|
operator_a and operator_b are not of the same type. |