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: All of the functions above 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.

Pauli unitaries and propagation

In fastfermion, a (Pauli) circuit is simply represented as a list of unitaries. Currently fastfermion supports the following types of unitaries H, S, CZ, CNOT, SWAP, ROT.

Function
H Hadamard gate
S S gate
CZ CZ gate
CNOT CNOT gate
SWAP SWAP 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)

Majorana rotations and propagation

fastfermion can also be used for Majorana propagation.

Function
MROT Majorana rotation \(U = e^{-i\theta/2 M}\) where \(M\) is a Hermitian Majorana monomial
propagate Propagate a Majorana polynomial through a sequence of Majorana rotations