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
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
| Name | Description |
|---|---|
| coeff | Returns the coefficient of the PauliTerm. Always set to be complex |
| commutes_with | Checks if the PauliTerm term commutes with another PauliTerm other, i.e. [term,other] . |
| multiplied | Multiplies the PauliTerm with another PauliTerm out of place place. |
| multiply | Multiplies the PauliTerm with another PauliTerm in place. |
| scale | Multiplies the PauliTerm by an integer scalar in place. |
| weight | Returns the weight, the number of non-identity operators, of the PauliTerm |
| xbits | Returns the X bits of the PauliTerm. |
| zbits | Returns the Z bits of the PauliTerm. |