Simple package providing bitstring representations of tensor products of Pauli operators for efficient manipulations. In this representation, the Pauli string operator is represented as two binary strings, one for x and one for z.
The format used for an arbitrary Pauli is as follows:
$$
\begin{align}
P_n =& i^\theta Z^{z_1} X^{x_1} ⊗ Z^{z_2} X^{x_2} ⊗ ⋯ ⊗ Z^{z_N} X^{x_N} \
=& i^\theta \bigotimes_j Z^{z_j} X^{x_j}
\end{align}
$$
where the Int128 integers so that have access to relatively large pauli strings, i.e., up to 128 qubits. Using only
This package provides the following types:
FixedPhasePauli, which contains only the base operator string. Here,Nis the number of qubits (currently maxed at 128).
struct FixedPhasePauli{N} <: AbstractPauli{N}
z::Int128
x::Int128
end-
Pauli, which includes both the base operator string, as well as a phase,$\theta$ . This allows us to multiply and such, while keep track of the phases.
struct Pauli{N} <: AbstractPauli{N}
θ::UInt8
pauli::FixedPhasePauli{N}
endScaledPauli. This allows us to describe aPauliscaled by an arbitrary Float. We may want to parameterize the type here in the future.
struct ScaledPauli{N} <: AbstractPauli{N}
coeff::ComplexF64
pauli::FixedPhasePauli{N}
endPauliSumwhich provides a way to define a sum ofScaledPauli's. While there are multiple ways one might choose to do this, here, we use a dictionary, where theFixedPhasePauliis the key, and the value is the coefficient.
struct PauliSum{N}
ops::Dict{FixedPhasePauli{N},ComplexF64}
endScaledPauliVectoris simply an alias to a vector ofScaledPauli's. This also represents a sum ofScaledPauli's.
ScaledPauliVector{N} = Vector{ScaledPauli{N}}KetBitStringis a simple bitstring representation of a computational basis state. This is provided to give access to computing things like expectation values and just general wavefunctions. p
"""
An occupation number vector, up to 128 qubits
"""
struct KetBitString{N}
v::Int128
endThe following functions are overloaded to allow the objects to interact intuitively:
*,⊗,⊕,+
Addition needs a bit more specification, since, unlike *, a sum of Pauli's is not a Pauli. As such, we simply choose to return a PauliSum type when adding two AbstractPauli's.