|View source on GitHub|
Class for storing tensor representations of operators that correspond
openfermion.ops.PolynomialTensor( n_body_tensors )
with multilinear polynomials in the fermionic ladder operators. For instance, in a quadratic Hamiltonian (degree 2 polynomial) which conserves particle number, there are only terms of the form a^\dagger_p a_q, and the coefficients can be stored in an n_qubits x n_qubits matrix. Higher order terms would be described with tensors of higher dimension. Note that each tensor must have an even number of dimensions, since parity is conserved. Much of the functionality of this class is redudant with FermionOperator but enables much more efficient numerical computations in many cases, such as basis rotations.
|n_body_tensors(dict or None): A dictionary storing the tensors describing n-body interactions. If None, n_body_tensors are assumed to be generated on-the-fly by other data (for subclassing purposes).|
||The value of the constant term.|
projected_n_body_tensors( selection, exact=False )
Keep only selected elements.
|selection (Union[int, Iterable[int]): If int, keeps terms with at most (exactly, if exact is True) that many unique indices. If iterable, keeps only terms containing (all of, if exact is True) the specified indices. exact (bool): Whether or not the selection is strict.|
rotate_basis( rotation_matrix )
Rotate the orbital basis of the PolynomialTensor.
||A square numpy array or matrix having dimensions of n_qubits by n_qubits. Assumed to be real and invertible.|
with_function_applied_elementwise( func )
__add__( addend )
__eq__( other )
__getitem__( args )
Look up matrix element.
Tuples indicating which coefficient to get. For instance,
Iterate over non-zero elements of PolynomialTensor.
__mod__( other )
__mul__( multiplier )
__ne__( other )
__radd__( addend )
__rmul__( multiplier )
__rsub__( subtrahend )
__sub__( subtrahend )
__truediv__( dividend )