Return a fermionic or bosonic number operator.
openfermion.hamiltonians.number_operator(
n_modes: int, mode: Optional[int] = None, coefficient=1.0, parity: int = -1
) -> Union[openfermion.ops.BosonOperator
, openfermion.ops.FermionOperator
]
Used in the notebooks
Args |
n_modes (int): The number of modes in the system.
mode (int, optional): The mode on which to return the number
operator. If None, return total number operator on all sites.
coefficient (float): The coefficient of the term.
parity (int): Returns the fermionic number operator
if parity=-1 (default),
and returns the bosonic number operator
if parity=1.
|
Returns |
operator (BosonOperator or FermionOperator)
|