pygsti.extras.idletomography.pauliobjs
Pauli state/operation/outcome objects for Idle Tomography
Module Contents
Classes
A string of 0's and 1's representing a definite outcome in the Z-basis. |
|
A N-qubit state that is the tensor product of N |
|
A N-qubit pauli operator, consisting of |
- class pygsti.extras.idletomography.pauliobjs.NQOutcome(string_rep)
Bases:
object
A string of 0’s and 1’s representing a definite outcome in the Z-basis.
Create a NQOutcome.
Parameters
- string_repstr
A string of 0s and 1s, one per qubit, e.g. “0010”.
- rep
- classmethod weight_1_string(n, i)
creates a n-bit string with a 1 in location i.
- classmethod weight_2_string(n, i, j)
creates a n-bit string with 1s in locations i and j.
- class pygsti.extras.idletomography.pauliobjs.NQPauliState(string_rep, signs=None)
Bases:
object
A N-qubit state that is the tensor product of N 1-qubit Pauli eigenstates. These can be represented as a string of Xs, Ys and Zz (but not Is) each with a +/- sign indicating which of the two eigenstates is meant.
A NQPauliState object can also be used to represent a POVM whose effects are the projections onto the 2^N tensor products of (the given) Pauli eigenstates. The +/- sign in this case indicates which eigenstate is equated with the “0” (vs “1”) outcome.
Create a NQPauliState
Parameters
- string_repstr
A string with letters in {X,Y,Z} (note: I is not allowed!), specifying the Pauli basis for each qubit.
- signstuple, optional
A tuple of 0s and/or 1s. A zero means the “+” eigenvector is either prepared or corresponds to the “0” outcome (if this NQPauliState is used to describe a measurment basis). A one means the opposite: the “-” eigenvector is prepared and it corresponds to a “0” outcome. The default is all zeros.
- rep
- signs = 'None'
- to_circuit(pauli_basis_dict)
Convert this Pauli basis state or measurement to a fiducial operation sequence.
When the returned operation sequence follows a preparation in the |0…0> Z-basis state or is followed by a Z-basis measurement (with all “+” signs), then the Pauli state preparation or measurement described by this object will be performed.
Parameters
- pauli_basis_dictdict
A dictionary w/keys like “+X” or “-Y” and values that are tuples of gate names (not labels, which include qubit or other state-space designations), e.g. (“Gx”,”Gx”). This dictionary describes how to prepare or measure in Pauli bases.
Returns
Circuit
- class pygsti.extras.idletomography.pauliobjs.NQPauliOp(string_rep, sign=1)
Bases:
object
A N-qubit pauli operator, consisting of a 1-qubit Pauli operation on each qubits.
Create a NQPauliOp.
Parameters
- string_repstr
A string with letters in {I,X,Y,Z}, specifying the Pauli operator for each qubit.
- sign{1, -1}
An overall sign (prefactor) for this operator.
- rep
- sign = '1'
- classmethod weight_1_pauli(n, i, pauli)
Creates a n-qubit Pauli operator with the Pauli indexed by pauli in location i.
Parameters
- nint
The number of qubits
- iint
The index of the single non-trivial Pauli operator.
- pauliint
An integer 0 <= P <= 2 indexing the non-trivial Pauli at location i as follows: 0=’X’, 1=’Y’, 2=’Z’.
Returns
NQPauliOp
- classmethod weight_2_pauli(n, i, j, pauli1, pauli2)
Creates a n-qubit Pauli operator with the Paulis indexed by pauli1 and pauli2 in locations i and j respectively.
Parameters
- nint
The number of qubits
- i, jint
The indices of the non-trivial Pauli operators.
- pauli1,pauli2int
Integers 0 <= pauli <= 2 indexing the non-trivial Paulis at locations i and j, respectively, as follows: 0=’X’, 1=’Y’, 2=’Z’.
Returns
NQPauliOp
- subpauli(indices)
Returns a new NQPauliOp object which sets all (1-qubit) operators to “I” except those in indices, which remain as they are in this object.
Parameters
- indicesiterable
A sequence of integer indices between 0 and N-1, where N is the number of qubits in this pauli operator.
Returns
NQPauliOp
- dot(other)
Computes the Hilbert-Schmidt dot product (normed to 1) between this Pauli operator and other.
Parameters
- otherNQPauliOp
The other operator to take a dot product with.
Returns
- integer
Either 0, 1, or -1.
- statedot(state)
Computes a dot product between state and this operator. (note that an X-basis ‘+’ state is represented by (I+X) not just X)
Parameters
state : NQPauliState
Returns
int
- commuteswith(other)
Determine whether this operator commutes (or anticommutes) with other.
Parameters
other : NQPauliOp
Returns
bool
- icommutator_over_2(other)
Compute i[self, other]/2 where [,] is the commutator.
Parameters
- otherNQPauliOp or NQPauliState
The operator to take a commutator with. A NQPauliState is treated as an operator (i.e. ‘X’ basis state => ‘X’ Pauli operation) with sign given by the product of its 1-qubit basis signs.
Returns
NQPauliOp