Pauli Operators¶
Quantum operators can be expressed as combinations of Pauli operators I, X, Y, Z:
>>> operator = sZ(0)*sZ(1) + sX(2)*sY(3)
>>> print(operator)
(1+0j)*Z0*Z1 + (1+0j)*X2*Y3
Construction functions¶
|
A function that returns the sigma_X operator on a particular qubit. |
|
A function that returns the sigma_Y operator on a particular qubit. |
|
A function that returns the sigma_Z operator on a particular qubit. |
|
A function that returns the identity operator, optionally on a particular qubit. |
|
The identity operator. |
|
The zero operator. |
Working with operators¶
|
Simplify the sum of Pauli operators according to Pauli algebra rules. |
|
Check if commuting a PauliTerm commutes with a list of other terms by natural calculation. |
|
Gather the Pauli terms of pauli_terms variable into commuting sets |
|
Tests to see if a PauliTerm or PauliSum is a scalar multiple of identity |
|
Tests to see if a PauliTerm or PauliSum is zero. |
|
Creates a pyQuil program that simulates the unitary evolution exp(-1j * term) |
|
Returns a function f(alpha) that constructs the Program corresponding to exp(-1j*alpha*term). |
|
Returns a function that maps all substituent PauliTerms and sums them into a program. |
|
Generate trotterization coefficients for a given number of Trotter steps. |
|
Create a Quil program that approximates exp( (A + B)t) where A and B are PauliTerm operators. |
Classes¶
-
class
pyquil.paulis.
PauliSum
(terms)[source]¶ A sum of one or more PauliTerms.
- Parameters
terms (Sequence) – A Sequence of PauliTerms.
Methods
The support of all the operators in the PauliSum object.
simplify
()Simplifies the sum of Pauli operators according to Pauli algebra rules.
Get a Pyquil Program corresponding to each term in the PauliSum and a coefficient for each program
from_compact_str
(str_pauli_sum)Construct a PauliSum from the result of str(pauli_sum)
-
class
pyquil.paulis.
PauliTerm
(op, index, coefficient=1.0)[source]¶ A term is a product of Pauli operators operating on different qubits.
Create a new Pauli Term with a Pauli operator at a particular index and a leading coefficient.
- Parameters
Methods
id
([sort_ops])Returns an identifier string for the PauliTerm (ignoring the coefficient).
Return a frozenset of operations in this term.
copy
()Properly creates a new PauliTerm, with a completely new dictionary of operators
- rtype
from_list
(terms_list[, coefficient])Allocates a Pauli Term from a list of operators and indices.
pauli_string
([qubits])Return a string representation of this PauliTerm without its coefficient and with implicit qubit indices.