|View source on GitHub|
Class for storing tensor representations of operators that correspond with multilinear polynomials in the fermionic ladder operators.
openfermion.ops.PolynomialTensor( n_body_tensors )
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 redundant with FermionOperator but enables much more efficient numerical computations in many cases, such as basis rotations.
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).
projected_n_body_tensors( selection, exact=False )
Keep only selected elements.
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.
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 )