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,N
is 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}
end
ScaledPauli
. This allows us to describe aPauli
scaled 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}
end
PauliSum
which 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 theFixedPhasePauli
is the key, and the value is the coefficient.
struct PauliSum{N}
ops::Dict{FixedPhasePauli{N},ComplexF64}
end
ScaledPauliVector
is simply an alias to a vector ofScaledPauli
's. This also represents a sum ofScaledPauli
's.
ScaledPauliVector{N} = Vector{ScaledPauli{N}}
KetBitString
is 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
end
The 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.