Skip to main content

PauliTerm

Base class: Object

Object that represents a numerically efficient Pauli String

Represents a Pauli string and a complex coefficient efficiently using a bitstring representation. This class leverages bit logic to perform common operations on pauli strings much faster than those represented by OperatorProducts and OperatorSum of OperatorNamed Pauli operators. Each Pauli string is represented via a complex coefficient and two integers called xbits and zbits. Bits at the same locations in the int encode the information of one pauli operator with the following mapping: 00 (I), 10 (X), 01 (Z), 11 (Y). The class takes care of handling the phase accrued during multiplication of different terms.

Constructors

PauliTerm(const integer xbits, const integer zbits) -> PauliTerm

Constructs a PauliTerm from two integers representing the X and Z bits.

Parameters

  • xbits: The integer representing the X bits.
  • zbits: The integer representing the Z bits.

PauliTerm(const integer xbits, const integer zbits, const complex coeff) -> PauliTerm

Constructs a PauliTerm from two integers representing the X and Z bits and a complex coefficient.

Parameters

  • xbits: The integer representing the X bits.
  • zbits: The integer representing the Z bits.
  • coeff: The complex coefficient.

PauliTerm(const integer xbits, const integer zbits, const real coeff) -> PauliTerm

Constructs a PauliTerm from two integers representing the X and Z bits and a real coefficient.

Parameters

  • xbits: The integer representing the X bits.
  • zbits: The integer representing the Z bits.
  • coeff: The real coefficient.

Members

NameDescription
coeffReturns the coefficient of the PauliTerm. Always set to be complex
commutes_withChecks if the PauliTerm term commutes with another PauliTerm other, i.e. [term,other] .
multipliedMultiplies the PauliTerm with another PauliTerm out of place place.
multiplyMultiplies the PauliTerm with another PauliTerm in place.
scaleMultiplies the PauliTerm by an integer scalar in place.
weightReturns the weight, the number of non-identity operators, of the PauliTerm
xbitsReturns the X bits of the PauliTerm.
zbitsReturns the Z bits of the PauliTerm.