Skip to content

Reference

Below is a summary of the list of functions and methods currently supported by fastfermion. For more details about how to use these functions, use help(<function name>) in the Python console.

Constructing polynomials

Function
poly Parse string expression
paulis Get 3N Pauli generators
fermis Get annihilation operators
majoranas Get Majorana operators
from_openfermion Convert from OpenFermion
to_openfermion Convert to OpenFermion

Operations on polynomials

Function
degree Degree of polynomial
dagger Adjoint of a polynomial
coefficient Get monomial's coefficient
norm Norm of the coefficient vector
truncate Remove high degree terms
compress Remove terms with small weight
extent Number of variables in a polynomial
permute Permute variables
sparse Sparse matrix representation of polynomial
commutes Check if two polynomials commute
commutator Commutator of two polynomials

NOTE: Most of the functions above (except commutes and commutator) can be invoked using the dot notation. For example, if \(A\) is a {Pauli,Fermi,Majorana} polynomial, then degree(A) or A.degree() are equivalent.

Transforms

Function
topauli Convert to Pauli polynomial
tofermi Convert to Fermi polynomial
tomajorana Convert to Majorana polynomial
jw Jordan-Wigner transform (Fermi -> Pauli)
rjw Reverse Jordan-Wigner transform (Pauli -> Fermi)

NOTE: If \(A\) is a Fermi polynomial then jw(A) and A.topauli() are equivalent. Similarly if \(A\) is a Pauli polynomial then rjw(A) and A.tofermi() are equivalent.

NOTE: The functions topauli, tofermi, tomajorana can also be invoked with the dot notation. For example, if \(A\) is a Fermi polynomial, then A.tomajorana() and tomajorana(A) are equivalent.

Unitaries (Gates) and evolution

In fastfermion, a circuit is simply represented as a list of unitaries. Currently we only support the following four types of unitaries H, S, CNOT, ROT.

Function
H Hadamard gate
S S gate
CNOT CNOT gate
ROT Pauli rotation \(U=e^{-i \theta/2 P}\) where \(P\) is a Pauli string
from_cirq Convert Cirq circuit into a list of fastfermion unitaries
propagate Propagate a Pauli polynomial through a circuit (Heisenberg evolution)