PauliString
Base class: Object
Object that represents a numerically efficient Pauli String
Represents a Pauli string and it's 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 OperatorSums 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 integer 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
PauliString(integer num_spins) -> PauliString
Constructs an identity PauliString for a system.
Parameters
- num_spins: The number of spins in the system, from 1 through 256.
PauliString(const PauliString other) -> PauliString
Copy constructs a PauliString from another PauliString
Parameters
- other: The PauliString to copy.
PauliString(const string characters, const List<integer> sites, integer num_spins) -> PauliString
Constructs a PauliString from Pauli characters and their sites.
Parameters
- characters: String containing the characters I, X, Y, or Z.
- sites: Sites corresponding to the supplied characters.
- num_spins: The number of spins in the system.
Members
| Name | Description |
|---|---|
| coefficient | Returns the complex coefficient of a PauliString. |
| commutes_with | Checks whether two PauliStrings commute: . |
| display | Displays the coefficient and bit representation of a PauliString. |
| expval | Calculates the expectation value of a PauliString . |
| multiplied | Right-multiplies the PauliString by another PauliString out of place: . |
| multiply | Right-multiplies the PauliString by another PauliString in place: . |
| num_spins | Returns the number of spins represented by a PauliString. |
| weight | Returns the weight of a PauliString—the number of non-identity operators. |
| xbits | Returns the X bits of a PauliString as a list of 64-bit chunks. Chunk n contains sites 64n through 64n+63. |
| zbits | Returns the Z bits of a PauliString as a list of 64-bit chunks. Chunk n contains sites 64n through 64n+63. |